url
stringlengths 45
122
| content
stringlengths 380
3.07M
|
---|---|
https://dev.mysql.com/doc/refman/8.4/en/innodb-statistics-estimation.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="innodb-statistics-estimation">
</a>
17.8.10.2 Configuring Non-Persistent Optimizer Statistics Parameters
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045162087008">
</a>
<a class="indexterm" name="idm46045162085936">
</a>
<a class="indexterm" name="idm46045162084896">
</a>
<p>
This section describes how to configure non-persistent optimizer
statistics. Optimizer statistics are not persisted to disk when
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_persistent">
<code class="literal">
innodb_stats_persistent=OFF
</code>
</a>
or
when individual tables are created or altered with
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
STATS_PERSISTENT=0
</code>
</a>
.
Instead, statistics are stored in memory, and are lost when the
server is shut down. Statistics are also updated periodically by
certain operations and under certain conditions.
</p>
<p>
Optimizer statistics are persisted to disk by default, enabled
by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_persistent">
<code class="literal">
innodb_stats_persistent
</code>
</a>
configuration option. For information about persistent optimizer
statistics, see
<a class="xref" href="innodb-persistent-stats.html" title="17.8.10.1 Configuring Persistent Optimizer Statistics Parameters">
Section 17.8.10.1, “Configuring Persistent Optimizer Statistics Parameters”
</a>
.
</p>
<h5>
<a name="innodb-statistics-estimation-update">
</a>
Optimizer Statistics Updates
</h5>
<p>
Non-persistent optimizer statistics are updated when:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Running
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
Running
<a class="link" href="show-table-status.html" title="15.7.7.38 SHOW TABLE STATUS Statement">
<code class="literal">
SHOW TABLE STATUS
</code>
</a>
,
<a class="link" href="show-index.html" title="15.7.7.23 SHOW INDEX Statement">
<code class="literal">
SHOW INDEX
</code>
</a>
, or querying the
Information Schema
<a class="link" href="information-schema-tables-table.html" title="28.3.38 The INFORMATION_SCHEMA TABLES Table">
<code class="literal">
TABLES
</code>
</a>
or
<a class="link" href="information-schema-statistics-table.html" title="28.3.34 The INFORMATION_SCHEMA STATISTICS Table">
<code class="literal">
STATISTICS
</code>
</a>
tables with the
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_on_metadata">
<code class="literal">
innodb_stats_on_metadata
</code>
</a>
option enabled.
</p>
<p>
The default setting for
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_on_metadata">
<code class="literal">
innodb_stats_on_metadata
</code>
</a>
is
<code class="literal">
OFF
</code>
. Enabling
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_on_metadata">
<code class="literal">
innodb_stats_on_metadata
</code>
</a>
may reduce access speed for schemas that have a large number
of tables or indexes, and reduce stability of execution
plans for queries that involve
<code class="literal">
InnoDB
</code>
tables.
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_on_metadata">
<code class="literal">
innodb_stats_on_metadata
</code>
</a>
is
configured globally using a
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
statement.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa98150885"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_stats_on_metadata<span class="token operator">=</span><span class="token keyword">ON</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_on_metadata">
<code class="literal">
innodb_stats_on_metadata
</code>
</a>
only applies when optimizer
<a class="link" href="glossary.html#glos_statistics" title="statistics">
statistics
</a>
are
configured to be non-persistent (when
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_persistent">
<code class="literal">
innodb_stats_persistent
</code>
</a>
is disabled).
</p>
</div>
</li>
<li class="listitem">
<p>
Starting a
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client with the
<a class="link" href="mysql-command-options.html#option_mysql_auto-rehash">
<code class="option">
--auto-rehash
</code>
</a>
option enabled,
which is the default. The
<a class="link" href="mysql-command-options.html#option_mysql_auto-rehash">
<code class="option">
auto-rehash
</code>
</a>
option causes all
<code class="literal">
InnoDB
</code>
tables to be opened, and the open
table operations cause statistics to be recalculated.
</p>
<p>
To improve the start up time of the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client and to updating statistics, you can turn off
<a class="link" href="mysql-command-options.html#option_mysql_auto-rehash">
<code class="option">
auto-rehash
</code>
</a>
using the
<a class="link" href="mysql-command-options.html#option_mysql_auto-rehash">
<code class="option">
--disable-auto-rehash
</code>
</a>
option. The
<a class="link" href="mysql-command-options.html#option_mysql_auto-rehash">
<code class="option">
auto-rehash
</code>
</a>
feature enables automatic name completion of database,
table, and column names for interactive users.
</p>
</li>
<li class="listitem">
<p>
A table is first opened.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
InnoDB
</code>
detects that 1 / 16 of table has
been modified since the last time statistics were updated.
</p>
</li>
</ul>
</div>
<h5>
<a name="idm46045162042176">
</a>
Configuring the Number of Sampled Pages
</h5>
<p>
The MySQL query optimizer uses estimated
<a class="link" href="glossary.html#glos_statistics" title="statistics">
statistics
</a>
about key
distributions to choose the indexes for an execution plan, based
on the relative
<a class="link" href="glossary.html#glos_selectivity" title="selectivity">
selectivity
</a>
of the
index. When
<code class="literal">
InnoDB
</code>
updates optimizer
statistics, it samples random pages from each index on a table
to estimate the
<a class="link" href="glossary.html#glos_cardinality" title="cardinality">
cardinality
</a>
of the
index. (This technique is known as
<a class="link" href="glossary.html#glos_random_dive" title="random dive">
random dives
</a>
.)
</p>
<p>
To give you control over the quality of the statistics estimate
(and thus better information for the query optimizer), you can
change the number of sampled pages using the parameter
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_transient_sample_pages">
<code class="literal">
innodb_stats_transient_sample_pages
</code>
</a>
.
The default number of sampled pages is 8, which could be
insufficient to produce an accurate estimate, leading to poor
index choices by the query optimizer. This technique is
especially important for large tables and tables used in
<a class="link" href="glossary.html#glos_join" title="join">
joins
</a>
. Unnecessary
<a class="link" href="glossary.html#glos_full_table_scan" title="full table scan">
full table scans
</a>
for
such tables can be a substantial performance issue. 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 tips on tuning such
queries.
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_transient_sample_pages">
<code class="literal">
innodb_stats_transient_sample_pages
</code>
</a>
is a global parameter that can be set at runtime.
</p>
<p>
The value of
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_transient_sample_pages">
<code class="literal">
innodb_stats_transient_sample_pages
</code>
</a>
affects the index sampling for all
<code class="literal">
InnoDB
</code>
tables and indexes when
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_persistent">
<code class="literal">
innodb_stats_persistent=0
</code>
</a>
. Be
aware of the following potentially significant impacts when you
change the index sample size:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Small values like 1 or 2 can result in inaccurate
estimates of cardinality.
</p>
</li>
<li class="listitem">
<p>
Increasing the
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_transient_sample_pages">
<code class="literal">
innodb_stats_transient_sample_pages
</code>
</a>
value might require more disk reads. Values much larger
than 8 (say, 100), can cause a significant slowdown in the
time it takes to open a table or execute
<code class="literal">
SHOW
TABLE STATUS
</code>
.
</p>
</li>
<li class="listitem">
<p>
The optimizer might choose very different query plans
based on different estimates of index selectivity.
</p>
</li>
</ul>
</div>
<p>
</p>
<p>
Whatever value of
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_transient_sample_pages">
<code class="literal">
innodb_stats_transient_sample_pages
</code>
</a>
works best for a system, set the option and leave it at that
value. Choose a value that results in reasonably accurate
estimates for all tables in your database without requiring
excessive I/O. Because the statistics are automatically
recalculated at various times other than on execution of
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
, it does not make
sense to increase the index sample size, run
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
, then decrease
sample size again.
</p>
<p>
Smaller tables generally require fewer index samples than larger
tables. If your database has many large tables, consider using a
higher value for
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_transient_sample_pages">
<code class="literal">
innodb_stats_transient_sample_pages
</code>
</a>
than if you have mostly smaller tables.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-innodb-lock-waits.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-innodb-lock-waits">
</a>
30.4.3.9 The innodb_lock_waits and x$innodb_lock_waits Views
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045063132128">
</a>
<a class="indexterm" name="idm46045063130672">
</a>
<a class="indexterm" name="idm46045063129184">
</a>
<a class="indexterm" name="idm46045063127680">
</a>
<p>
These views summarize the
<code class="literal">
InnoDB
</code>
locks that
transactions are waiting for. By default, rows are sorted by
descending lock age.
</p>
<p>
The
<a class="link" href="sys-innodb-lock-waits.html" title="30.4.3.9 The innodb_lock_waits and x$innodb_lock_waits Views">
<code class="literal">
innodb_lock_waits
</code>
</a>
and
<a class="link" href="sys-innodb-lock-waits.html" title="30.4.3.9 The innodb_lock_waits and x$innodb_lock_waits Views">
<code class="literal">
x$innodb_lock_waits
</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">
wait_started
</code>
</p>
<p>
The time at which the lock wait started.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
wait_age
</code>
</p>
<p>
How long the lock has been waited for, as a
<a class="link" href="time.html" title="13.2.3 The TIME Type">
<code class="literal">
TIME
</code>
</a>
value.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
wait_age_secs
</code>
</p>
<p>
How long the lock has been waited for, in seconds.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
locked_table_schema
</code>
</p>
<p>
The schema that contains the locked table.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
locked_table_name
</code>
</p>
<p>
The name of the locked table.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
locked_table_partition
</code>
</p>
<p>
The name of the locked partition, if any;
<code class="literal">
NULL
</code>
otherwise.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
locked_table_subpartition
</code>
</p>
<p>
The name of the locked subpartition, if any;
<code class="literal">
NULL
</code>
otherwise.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
locked_index
</code>
</p>
<p>
The name of the locked index.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
locked_type
</code>
</p>
<p>
The type of the waiting lock.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
waiting_trx_id
</code>
</p>
<p>
The ID of the waiting transaction.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
waiting_trx_started
</code>
</p>
<p>
The time at which the waiting transaction started.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
waiting_trx_age
</code>
</p>
<p>
How long the waiting transaction has been waiting, as a
<a class="link" href="time.html" title="13.2.3 The TIME Type">
<code class="literal">
TIME
</code>
</a>
value.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
waiting_trx_rows_locked
</code>
</p>
<p>
The number of rows locked by the waiting transaction.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
waiting_trx_rows_modified
</code>
</p>
<p>
The number of rows modified by the waiting transaction.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
waiting_pid
</code>
</p>
<p>
The processlist ID of the waiting transaction.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
waiting_query
</code>
</p>
<p>
The statement that is waiting for the lock.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
waiting_lock_id
</code>
</p>
<p>
The ID of the waiting lock.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
waiting_lock_mode
</code>
</p>
<p>
The mode of the waiting lock.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
blocking_trx_id
</code>
</p>
<p>
The ID of the transaction that is blocking the waiting
lock.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
blocking_pid
</code>
</p>
<p>
The processlist ID of the blocking transaction.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
blocking_query
</code>
</p>
<p>
The statement the blocking transaction is executing. This
field reports NULL if the session that issued the blocking
query becomes idle. For more information, see
<a class="xref" href="innodb-information-schema-examples.html#innodb-information-schema-examples-null-blocking-query" title="Identifying a Blocking Query After the Issuing Session Becomes Idle">
Identifying a Blocking Query After the Issuing Session Becomes Idle
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
blocking_lock_id
</code>
</p>
<p>
The ID of the lock that is blocking the waiting lock.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
blocking_lock_mode
</code>
</p>
<p>
The mode of the lock that is blocking the waiting lock.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
blocking_trx_started
</code>
</p>
<p>
The time at which the blocking transaction started.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
blocking_trx_age
</code>
</p>
<p>
How long the blocking transaction has been executing, as a
<a class="link" href="time.html" title="13.2.3 The TIME Type">
<code class="literal">
TIME
</code>
</a>
value.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
blocking_trx_rows_locked
</code>
</p>
<p>
The number of rows locked by the blocking transaction.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
blocking_trx_rows_modified
</code>
</p>
<p>
The number of rows modified by the blocking transaction.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
sql_kill_blocking_query
</code>
</p>
<p>
The
<a class="link" href="kill.html" title="15.7.8.4 KILL Statement">
<code class="literal">
KILL
</code>
</a>
statement to
execute to kill the blocking statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
sql_kill_blocking_connection
</code>
</p>
<p>
The
<a class="link" href="kill.html" title="15.7.8.4 KILL Statement">
<code class="literal">
KILL
</code>
</a>
statement to
execute to kill the session running the blocking
statement.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/flow-control-statements.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="flow-control-statements">
</a>
15.6.5 Flow Control Statements
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="case.html">
15.6.5.1 CASE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="if.html">
15.6.5.2 IF Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="iterate.html">
15.6.5.3 ITERATE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="leave.html">
15.6.5.4 LEAVE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="loop.html">
15.6.5.5 LOOP Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="repeat.html">
15.6.5.6 REPEAT Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="return.html">
15.6.5.7 RETURN Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="while.html">
15.6.5.8 WHILE Statement
</a>
</span>
</dt>
</dl>
</div>
<p>
MySQL supports the
<a class="link" href="if.html" title="15.6.5.2 IF Statement">
<code class="literal">
IF
</code>
</a>
,
<a class="link" href="case.html" title="15.6.5.1 CASE Statement">
<code class="literal">
CASE
</code>
</a>
,
<a class="link" href="iterate.html" title="15.6.5.3 ITERATE Statement">
<code class="literal">
ITERATE
</code>
</a>
,
<a class="link" href="leave.html" title="15.6.5.4 LEAVE Statement">
<code class="literal">
LEAVE
</code>
</a>
<a class="link" href="loop.html" title="15.6.5.5 LOOP Statement">
<code class="literal">
LOOP
</code>
</a>
,
<a class="link" href="while.html" title="15.6.5.8 WHILE Statement">
<code class="literal">
WHILE
</code>
</a>
, and
<a class="link" href="repeat.html" title="15.6.5.6 REPEAT Statement">
<code class="literal">
REPEAT
</code>
</a>
constructs for flow control
within stored programs. It also supports
<a class="link" href="return.html" title="15.6.5.7 RETURN Statement">
<code class="literal">
RETURN
</code>
</a>
within stored functions.
</p>
<p>
Many of these constructs contain other statements, as indicated by
the grammar specifications in the following sections. Such
constructs may be nested. For example, an
<a class="link" href="if.html" title="15.6.5.2 IF Statement">
<code class="literal">
IF
</code>
</a>
statement might contain a
<a class="link" href="while.html" title="15.6.5.8 WHILE Statement">
<code class="literal">
WHILE
</code>
</a>
loop, which itself contains a
<a class="link" href="case.html" title="15.6.5.1 CASE Statement">
<code class="literal">
CASE
</code>
</a>
statement.
</p>
<p>
MySQL does not support
<code class="literal">
FOR
</code>
loops.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/show-create-trigger.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="show-create-trigger">
</a>
15.7.7.12 SHOW CREATE TRIGGER Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045170832016">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa54064500"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CREATE</span> <span class="token keyword">TRIGGER</span> <em class="replaceable">trigger_name</em></code></pre>
</div>
<p>
This statement shows the
<a class="link" href="create-trigger.html" title="15.1.22 CREATE TRIGGER Statement">
<code class="literal">
CREATE
TRIGGER
</code>
</a>
statement that creates the named trigger. This
statement requires the
<a class="link" href="privileges-provided.html#priv_trigger">
<code class="literal">
TRIGGER
</code>
</a>
privilege for the table associated with the trigger.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa46946731"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">TRIGGER</span> ins_sum\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>
Trigger<span class="token punctuation">:</span> ins_sum
sql_mode<span class="token punctuation">:</span> ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,
NO_ZERO_IN_DATE,NO_ZERO_DATE,
ERROR_FOR_DIVISION_BY_ZERO,
NO_ENGINE_SUBSTITUTION
SQL Original Statement<span class="token punctuation">:</span> CREATE DEFINER=`me`@`localhost` TRIGGER `ins_sum`
BEFORE INSERT ON `account`
FOR EACH ROW SET @sum = @sum + NEW.amount
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
Created<span class="token punctuation">:</span> 2018-08-08 10<span class="token punctuation">:</span>10<span class="token punctuation">:</span>12.61</span></code></pre>
</div>
<p>
<a class="link" href="show-create-trigger.html" title="15.7.7.12 SHOW CREATE TRIGGER Statement">
<code class="literal">
SHOW CREATE TRIGGER
</code>
</a>
output has
these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
Trigger
</code>
: The trigger name.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
sql_mode
</code>
: The SQL mode in effect when the
trigger executes.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SQL Original Statement
</code>
: The
<a class="link" href="create-trigger.html" title="15.1.22 CREATE TRIGGER Statement">
<code class="literal">
CREATE TRIGGER
</code>
</a>
statement that
defines the trigger.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
character_set_client
</code>
: 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 trigger was created.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
collation_connection
</code>
: 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 trigger was created.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Database Collation
</code>
: The collation of the
database with which the trigger is associated.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Created
</code>
: The date and time when the
trigger was created. This is a
<code class="literal">
TIMESTAMP(2)
</code>
value (with a fractional
part in hundredths of seconds) for triggers.
</p>
</li>
</ul>
</div>
<p>
Trigger information is also available from the
<code class="literal">
INFORMATION_SCHEMA
</code>
<a class="link" href="information-schema-triggers-table.html" title="28.3.44 The INFORMATION_SCHEMA TRIGGERS Table">
<code class="literal">
TRIGGERS
</code>
</a>
table. See
<a class="xref" href="information-schema-triggers-table.html" title="28.3.44 The INFORMATION_SCHEMA TRIGGERS Table">
Section 28.3.44, “The INFORMATION_SCHEMA TRIGGERS Table”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-file-space.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-file-space">
</a>
17.11.2 File Space Management
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045160695280">
</a>
<p>
The data files that you define in the configuration file using the
<a class="link" href="innodb-parameters.html#sysvar_innodb_data_file_path">
<code class="literal">
innodb_data_file_path
</code>
</a>
configuration option form the
<code class="literal">
InnoDB
</code>
<a class="link" href="glossary.html#glos_system_tablespace" title="system tablespace">
system tablespace
</a>
.
The files are logically concatenated to form the system
tablespace. There is no striping in use. You cannot define where
within the system tablespace your tables are allocated. In a newly
created system tablespace,
<code class="literal">
InnoDB
</code>
allocates
space starting from the first data file.
</p>
<p>
To avoid the issues that come with storing all tables and indexes
inside the system tablespace, you can enable the
<a class="link" href="innodb-parameters.html#sysvar_innodb_file_per_table">
<code class="literal">
innodb_file_per_table
</code>
</a>
configuration option (the default), which stores each newly
created table in a separate tablespace file (with extension
<code class="literal">
.ibd
</code>
). For tables stored this way, there is
less fragmentation within the disk file, and when the table is
truncated, the space is returned to the operating system rather
than still being reserved by InnoDB within the system tablespace.
For more information, see
<a class="xref" href="innodb-file-per-table-tablespaces.html" title="17.6.3.2 File-Per-Table Tablespaces">
Section 17.6.3.2, “File-Per-Table Tablespaces”
</a>
.
</p>
<p>
You can also store tables in
<a class="link" href="glossary.html#glos_general_tablespace" title="general tablespace">
general
tablespaces
</a>
. General tablespaces are shared tablespaces
created using
<a class="link" href="create-tablespace.html" title="15.1.21 CREATE TABLESPACE Statement">
<code class="literal">
CREATE TABLESPACE
</code>
</a>
syntax. They can be created outside of the MySQL data directory,
are capable of holding multiple tables, and support tables of all
row formats. For more information, see
<a class="xref" href="general-tablespaces.html" title="17.6.3.3 General Tablespaces">
Section 17.6.3.3, “General Tablespaces”
</a>
.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-pages-extents-segments-tablespaces">
</a>
Pages, Extents, Segments, and Tablespaces
</h4>
</div>
</div>
</div>
<p>
Each tablespace consists of database
<a class="link" href="glossary.html#glos_page" title="page">
pages
</a>
. Every tablespace in a
MySQL instance has the same
<a class="link" href="glossary.html#glos_page_size" title="page size">
page
size
</a>
. By default, all tablespaces have a page size of
16KB; you can reduce the page size to 8KB or 4KB by specifying
the
<a class="link" href="innodb-parameters.html#sysvar_innodb_page_size">
<code class="literal">
innodb_page_size
</code>
</a>
option
when you create the MySQL instance. You can also increase the
page size to 32KB or 64KB. For more information, refer to the
<a class="link" href="innodb-parameters.html#sysvar_innodb_page_size">
<code class="literal">
innodb_page_size
</code>
</a>
documentation.
</p>
<p>
The pages are grouped into
<a class="link" href="glossary.html#glos_extent" title="extent">
extents
</a>
of size 1MB for pages
up to 16KB in size (64 consecutive 16KB pages, or 128 8KB pages,
or 256 4KB pages). For a page size of 32KB, extent size is 2MB.
For page size of 64KB, extent size is 4MB. The
<span class="quote">
“
<span class="quote">
files
</span>
”
</span>
inside a tablespace are called
<a class="link" href="glossary.html#glos_segment" title="segment">
segments
</a>
in
<code class="literal">
InnoDB
</code>
. (These segments are different from
the
<a class="link" href="glossary.html#glos_rollback_segment" title="rollback segment">
rollback
segment
</a>
, which actually contains many tablespace
segments.)
</p>
<p>
When a segment grows inside the tablespace,
<code class="literal">
InnoDB
</code>
allocates the first 32 pages to it one
at a time. After that,
<code class="literal">
InnoDB
</code>
starts to
allocate whole extents to the segment.
<code class="literal">
InnoDB
</code>
can add up to 4 extents at a time to a large segment to ensure
good sequentiality of data.
</p>
<p>
Two segments are allocated for each index in
<code class="literal">
InnoDB
</code>
. One is for nonleaf nodes of the
<a class="link" href="glossary.html#glos_b_tree" title="B-tree">
B-tree
</a>
, the other is for the
leaf nodes. Keeping the leaf nodes contiguous on disk enables
better sequential I/O operations, because these leaf nodes
contain the actual table data.
</p>
<p>
Some pages in the tablespace contain bitmaps of other pages, and
therefore a few extents in an
<code class="literal">
InnoDB
</code>
tablespace cannot be allocated to segments as a whole, but only
as individual pages.
</p>
<p>
When you ask for available free space in the tablespace by
issuing a
<a class="link" href="show-table-status.html" title="15.7.7.38 SHOW TABLE STATUS Statement">
<code class="literal">
SHOW TABLE STATUS
</code>
</a>
statement,
<code class="literal">
InnoDB
</code>
reports the extents that
are definitely free in the tablespace.
<code class="literal">
InnoDB
</code>
always reserves some extents for cleanup and other internal
purposes; these reserved extents are not included in the free
space.
</p>
<p>
When you delete data from a table,
<code class="literal">
InnoDB
</code>
contracts the corresponding B-tree indexes. Whether the freed
space becomes available for other users depends on whether the
pattern of deletes frees individual pages or extents to the
tablespace. Dropping a table or deleting all rows from it is
guaranteed to release the space to other users, but remember
that deleted rows are physically removed only by the
<a class="link" href="glossary.html#glos_purge" title="purge">
purge
</a>
operation, which happens
automatically some time after they are no longer needed for
transaction rollbacks or consistent reads. (See
<a class="xref" href="innodb-multi-versioning.html" title="17.3 InnoDB Multi-Versioning">
Section 17.3, “InnoDB Multi-Versioning”
</a>
.)
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-config-reserved-file-segment-pages">
</a>
Configuring the Percentage of Reserved File Segment Pages
</h4>
</div>
</div>
</div>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_segment_reserve_factor">
<code class="literal">
innodb_segment_reserve_factor
</code>
</a>
variablepermits defining the percentage of tablespace file
segment pages reserved as empty pages. A percentage of pages are
reserved for future growth so that pages in the B-tree can be
allocated contiguously. The ability to modify the percentage of
reserved pages permits fine-tuning
<code class="literal">
InnoDB
</code>
to
address issues of data fragmentation or inefficient use of
storage space.
</p>
<p>
The setting is applicable to file-per-table and general
tablespaces. The
<a class="link" href="innodb-parameters.html#sysvar_innodb_segment_reserve_factor">
<code class="literal">
innodb_segment_reserve_factor
</code>
</a>
default setting is 12.5 percent.
</p>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_segment_reserve_factor">
<code class="literal">
innodb_segment_reserve_factor
</code>
</a>
variable is dynamic and can be configured using a
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
statement. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa12191497"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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_segment_reserve_factor<span class="token operator">=</span><span class="token number">10</span><span class="token punctuation">;</span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-pages-rows">
</a>
How Pages Relate to Table Rows
</h4>
</div>
</div>
</div>
<p>
For for 4KB, 8KB, 16KB, and 32KB
<a class="link" href="innodb-parameters.html#sysvar_innodb_page_size">
<code class="literal">
innodb_page_size
</code>
</a>
settings, the
maximum row length is slightly less than half a database page
size. For example, the maximum row length is slightly less than
8KB for the default 16KB
<code class="literal">
InnoDB
</code>
page size.
For a 64KB
<a class="link" href="innodb-parameters.html#sysvar_innodb_page_size">
<code class="literal">
innodb_page_size
</code>
</a>
setting, the maximum row length is slightly less than 16KB.
</p>
<p>
If a row does not exceed the maximum row length, all of it is
stored locally within the page. If a row exceeds the maximum row
length,
<a class="link" href="glossary.html#glos_variable_length_type" title="variable-length type">
variable-length
columns
</a>
are chosen for external off-page storage until
the row fits within the maximum row length limit. External
off-page storage for variable-length columns differs by row
format:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<span class="emphasis">
<em>
COMPACT and REDUNDANT Row Formats
</em>
</span>
</p>
<p>
When a variable-length column is chosen for external
off-page storage,
<code class="literal">
InnoDB
</code>
stores the first
768 bytes locally in the row, and the rest externally into
overflow pages. Each such column has its own list of
overflow pages. The 768-byte prefix is accompanied by a
20-byte value that stores the true length of the column and
points into the overflow list where the rest of the value is
stored. 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>
<span class="emphasis">
<em>
DYNAMIC and COMPRESSED Row Formats
</em>
</span>
</p>
<p>
When a variable-length column is chosen for external
off-page storage,
<code class="literal">
InnoDB
</code>
stores a 20-byte
pointer locally in the row, and the rest externally into
overflow pages. See
<a class="xref" href="innodb-row-format.html" title="17.10 InnoDB Row Formats">
Section 17.10, “InnoDB Row Formats”
</a>
.
</p>
</li>
</ul>
</div>
<p>
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
LONGBLOB
</code>
</a>
and
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
LONGTEXT
</code>
</a>
columns
must be less than 4GB, and the total row length, including
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
and
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
columns, must be less than
4GB.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/index-hints.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="index-hints">
</a>
10.9.4 Index Hints
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045223458208">
</a>
<a class="indexterm" name="idm46045223457136">
</a>
<a class="indexterm" name="idm46045223455648">
</a>
<a class="indexterm" name="idm46045223454576">
</a>
<a class="indexterm" name="idm46045223453504">
</a>
<a class="indexterm" name="idm46045223452432">
</a>
<a class="indexterm" name="idm46045223451360">
</a>
<a class="indexterm" name="idm46045223450288">
</a>
<p>
Index hints give the optimizer information about how to choose
indexes during query processing. Index hints, described here,
differ from optimizer hints, described in
<a class="xref" href="optimizer-hints.html" title="10.9.3 Optimizer Hints">
Section 10.9.3, “Optimizer Hints”
</a>
. Index and optimizer hints may
be used separately or together.
</p>
<p>
Index hints apply to
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
and
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
statements. They also work
with multi-table
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statements, but not with single-table
<code class="literal">
DELETE
</code>
,
as shown later in this section.
</p>
<p>
Index hints are specified following a table name. (For the
general syntax for specifying tables in a
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement, see
<a class="xref" href="join.html" title="15.2.13.2 JOIN Clause">
Section 15.2.13.2, “JOIN Clause”
</a>
.) The syntax for referring to an
individual table, including index hints, looks like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15331343"><div class="copy-help left">Press ⌘+C to copy</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">tbl_name</em> <span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token keyword">AS</span><span class="token punctuation">]</span> <em class="replaceable">alias</em><span class="token punctuation">]</span> <span class="token punctuation">[</span><em class="replaceable">index_hint_list</em><span class="token punctuation">]</span>
<em class="replaceable">index_hint_list</em>:
<em class="replaceable">index_hint</em> <span class="token punctuation">[</span><em class="replaceable">index_hint</em><span class="token punctuation">]</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<em class="replaceable">index_hint</em>:
<span class="token keyword">USE</span> {<span class="token keyword">INDEX</span><span class="token operator">|</span><span class="token keyword">KEY</span>}
<span class="token punctuation">[</span><span class="token keyword">FOR</span> {<span class="token keyword">JOIN</span><span class="token operator">|</span><span class="token keyword">ORDER</span> <span class="token keyword">BY</span><span class="token operator">|</span><span class="token keyword">GROUP</span> <span class="token keyword">BY</span>}<span class="token punctuation">]</span> <span class="token punctuation">(</span><span class="token punctuation">[</span><em class="replaceable">index_list</em><span class="token punctuation">]</span><span class="token punctuation">)</span>
<span class="token operator">|</span> {<span class="token keyword">IGNORE</span><span class="token operator">|</span><span class="token keyword">FORCE</span>} {<span class="token keyword">INDEX</span><span class="token operator">|</span><span class="token keyword">KEY</span>}
<span class="token punctuation">[</span><span class="token keyword">FOR</span> {<span class="token keyword">JOIN</span><span class="token operator">|</span><span class="token keyword">ORDER</span> <span class="token keyword">BY</span><span class="token operator">|</span><span class="token keyword">GROUP</span> <span class="token keyword">BY</span>}<span class="token punctuation">]</span> <span class="token punctuation">(</span><em class="replaceable">index_list</em><span class="token punctuation">)</span>
<em class="replaceable">index_list</em>:
<em class="replaceable">index_name</em> <span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">index_name</em><span class="token punctuation">]</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
</div>
<p>
The
<code class="literal">
USE INDEX
(
<em class="replaceable">
<code>
index_list
</code>
</em>
)
</code>
hint tells
MySQL to use only one of the named indexes to find rows in the
table. The alternative syntax
<code class="literal">
IGNORE INDEX
(
<em class="replaceable">
<code>
index_list
</code>
</em>
)
</code>
tells MySQL to
not use some particular index or indexes. These hints are useful
if
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
shows that MySQL is
using the wrong index from the list of possible indexes.
</p>
<p>
The
<code class="literal">
FORCE INDEX
</code>
hint acts like
<code class="literal">
USE
INDEX (
<em class="replaceable">
<code>
index_list
</code>
</em>
)
</code>
, with
the addition that a table scan is assumed to be
<span class="emphasis">
<em>
very
</em>
</span>
expensive. In other words, a table
scan is used only if there is no way to use one of the named
indexes to find rows in the table.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
MySQL 8.4 supports the index-level optimizer
hints
<a class="link" href="optimizer-hints.html#optimizer-hints-index-level" title="Index-Level Optimizer Hints">
<code class="literal">
JOIN_INDEX
</code>
</a>
,
<a class="link" href="optimizer-hints.html#optimizer-hints-index-level" title="Index-Level Optimizer Hints">
<code class="literal">
GROUP_INDEX
</code>
</a>
,
<a class="link" href="optimizer-hints.html#optimizer-hints-index-level" title="Index-Level Optimizer Hints">
<code class="literal">
ORDER_INDEX
</code>
</a>
, and
<a class="link" href="optimizer-hints.html#optimizer-hints-index-level" title="Index-Level Optimizer Hints">
<code class="literal">
INDEX
</code>
</a>
, which are equivalent
to and intended to supersede
<code class="literal">
FORCE INDEX
</code>
index hints, as well as the
<a class="link" href="optimizer-hints.html#optimizer-hints-index-level" title="Index-Level Optimizer Hints">
<code class="literal">
NO_JOIN_INDEX
</code>
</a>
,
<a class="link" href="optimizer-hints.html#optimizer-hints-index-level" title="Index-Level Optimizer Hints">
<code class="literal">
NO_GROUP_INDEX
</code>
</a>
,
<a class="link" href="optimizer-hints.html#optimizer-hints-index-level" title="Index-Level Optimizer Hints">
<code class="literal">
NO_ORDER_INDEX
</code>
</a>
, and
<a class="link" href="optimizer-hints.html#optimizer-hints-index-level" title="Index-Level Optimizer Hints">
<code class="literal">
NO_INDEX
</code>
</a>
optimizer hints,
which are equivalent to and intended to supersede
<code class="literal">
IGNORE INDEX
</code>
index hints. Thus, you should
expect
<code class="literal">
USE INDEX
</code>
,
<code class="literal">
FORCE
INDEX
</code>
, and
<code class="literal">
IGNORE INDEX
</code>
to be
deprecated in a future release of MySQL, and at some time
thereafter to be removed altogether.
</p>
<p>
These index-level optimizer hints are supported with both
single-table and multi-table
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statements.
</p>
<p>
For more information, see
<a class="xref" href="optimizer-hints.html#optimizer-hints-index-level" title="Index-Level Optimizer Hints">
Index-Level Optimizer Hints
</a>
.
</p>
</div>
<p>
Each hint requires index names, not column names. To refer to a
primary key, use the name
<code class="literal">
PRIMARY
</code>
. To see the
index names for a table, use the
<a class="link" href="show-index.html" title="15.7.7.23 SHOW INDEX Statement">
<code class="literal">
SHOW
INDEX
</code>
</a>
statement or the Information Schema
<a class="link" href="information-schema-statistics-table.html" title="28.3.34 The INFORMATION_SCHEMA STATISTICS Table">
<code class="literal">
STATISTICS
</code>
</a>
table.
</p>
<p>
An
<em class="replaceable">
<code>
index_name
</code>
</em>
value need not be a
full index name. It can be an unambiguous prefix of an index
name. If a prefix is ambiguous, an error occurs.
</p>
<p>
Examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69411628"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> table1 <span class="token keyword">USE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span>col1_index<span class="token punctuation">,</span>col2_index<span class="token punctuation">)</span>
<span class="token keyword">WHERE</span> col1<span class="token operator">=</span><span class="token number">1</span> <span class="token operator">AND</span> col2<span class="token operator">=</span><span class="token number">2</span> <span class="token operator">AND</span> col3<span class="token operator">=</span><span class="token number">3</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> table1 <span class="token keyword">IGNORE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span>col3_index<span class="token punctuation">)</span>
<span class="token keyword">WHERE</span> col1<span class="token operator">=</span><span class="token number">1</span> <span class="token operator">AND</span> col2<span class="token operator">=</span><span class="token number">2</span> <span class="token operator">AND</span> col3<span class="token operator">=</span><span class="token number">3</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The syntax for index hints has the following characteristics:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
It is syntactically valid to omit
<em class="replaceable">
<code>
index_list
</code>
</em>
for
<code class="literal">
USE
INDEX
</code>
, which means
<span class="quote">
“
<span class="quote">
use no indexes.
</span>
”
</span>
Omitting
<em class="replaceable">
<code>
index_list
</code>
</em>
for
<code class="literal">
FORCE INDEX
</code>
or
<code class="literal">
IGNORE
INDEX
</code>
is a syntax error.
</p>
</li>
<li class="listitem">
<p>
You can specify the scope of an index hint by adding a
<code class="literal">
FOR
</code>
clause to the hint. This provides
more fine-grained control over optimizer selection of an
execution plan for various phases of query processing. To
affect only the indexes used when MySQL decides how to find
rows in the table and how to process joins, use
<code class="literal">
FOR
JOIN
</code>
. To influence index usage for sorting or
grouping rows, use
<code class="literal">
FOR ORDER BY
</code>
or
<code class="literal">
FOR GROUP BY
</code>
.
</p>
</li>
<li class="listitem">
<p>
You can specify multiple index hints:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa19663640"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">USE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span>i1<span class="token punctuation">)</span> <span class="token keyword">IGNORE</span> <span class="token keyword">INDEX</span> <span class="token keyword">FOR</span> <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> <span class="token punctuation">(</span>i2<span class="token punctuation">)</span> <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> a<span class="token punctuation">;</span></code></pre>
</div>
<p>
It is not an error to name the same index in several hints
(even within the same hint):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa91448944"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">USE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span>i1<span class="token punctuation">)</span> <span class="token keyword">USE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span>i1<span class="token punctuation">,</span>i1<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
However, it is an error to mix
<code class="literal">
USE INDEX
</code>
and
<code class="literal">
FORCE INDEX
</code>
for the same table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa43267009"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">USE</span> <span class="token keyword">INDEX</span> <span class="token keyword">FOR</span> <span class="token keyword">JOIN</span> <span class="token punctuation">(</span>i1<span class="token punctuation">)</span> <span class="token keyword">FORCE</span> <span class="token keyword">INDEX</span> <span class="token keyword">FOR</span> <span class="token keyword">JOIN</span> <span class="token punctuation">(</span>i2<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
If an index hint includes no
<code class="literal">
FOR
</code>
clause, the
scope of the hint is to apply to all parts of the statement. For
example, this hint:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa22676585"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">IGNORE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span>i1<span class="token punctuation">)</span></code></pre>
</div>
<p>
is equivalent to this combination of hints:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa33641077"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">IGNORE</span> <span class="token keyword">INDEX</span> <span class="token keyword">FOR</span> <span class="token keyword">JOIN</span> <span class="token punctuation">(</span>i1<span class="token punctuation">)</span>
<span class="token keyword">IGNORE</span> <span class="token keyword">INDEX</span> <span class="token keyword">FOR</span> <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> <span class="token punctuation">(</span>i1<span class="token punctuation">)</span>
<span class="token keyword">IGNORE</span> <span class="token keyword">INDEX</span> <span class="token keyword">FOR</span> <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token punctuation">(</span>i1<span class="token punctuation">)</span></code></pre>
</div>
<p>
When index hints are processed, they are collected in a single
list by type (
<code class="literal">
USE
</code>
,
<code class="literal">
FORCE
</code>
,
<code class="literal">
IGNORE
</code>
) and by scope (
<code class="literal">
FOR
JOIN
</code>
,
<code class="literal">
FOR ORDER BY
</code>
,
<code class="literal">
FOR
GROUP BY
</code>
). For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42908943"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1
<span class="token keyword">USE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">IGNORE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span>i2<span class="token punctuation">)</span> <span class="token keyword">USE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span>i1<span class="token punctuation">)</span> <span class="token keyword">USE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span>i2<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
is equivalent to:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa48495606"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1
<span class="token keyword">USE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span>i1<span class="token punctuation">,</span>i2<span class="token punctuation">)</span> <span class="token keyword">IGNORE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span>i2<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The index hints then are applied for each scope in the following
order:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
<code class="literal">
{USE|FORCE} INDEX
</code>
is applied if present.
(If not, the optimizer-determined set of indexes is used.)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
IGNORE INDEX
</code>
is applied over the result
of the previous step. For example, the following two queries
are equivalent:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa88656092"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">USE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span>i1<span class="token punctuation">)</span> <span class="token keyword">IGNORE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span>i2<span class="token punctuation">)</span> <span class="token keyword">USE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span>i2<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">USE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span>i1<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ol>
</div>
<p>
For
<code class="literal">
FULLTEXT
</code>
searches, index hints work as
follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For natural language mode searches, index hints are silently
ignored. For example,
<code class="literal">
IGNORE INDEX(i1)
</code>
is
ignored with no warning and the index is still used.
</p>
</li>
<li class="listitem">
<p>
For boolean mode searches, index hints with
<code class="literal">
FOR
ORDER BY
</code>
or
<code class="literal">
FOR GROUP BY
</code>
are
silently ignored. Index hints with
<code class="literal">
FOR
JOIN
</code>
or no
<code class="literal">
FOR
</code>
modifier are
honored. In contrast to how hints apply for
non-
<code class="literal">
FULLTEXT
</code>
searches, the hint is used
for all phases of query execution (finding rows and
retrieval, grouping, and ordering). This is true even if the
hint is given for a non-
<code class="literal">
FULLTEXT
</code>
index.
</p>
<p>
For example, the following two queries are equivalent:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa57663633"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t
<span class="token keyword">USE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span>index1<span class="token punctuation">)</span>
<span class="token keyword">IGNORE</span> <span class="token keyword">INDEX</span> <span class="token keyword">FOR</span> <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> <span class="token punctuation">(</span>index1<span class="token punctuation">)</span>
<span class="token keyword">IGNORE</span> <span class="token keyword">INDEX</span> <span class="token keyword">FOR</span> <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token punctuation">(</span>index1<span class="token punctuation">)</span>
<span class="token keyword">WHERE</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token keyword">IN</span> <span class="token datatype">BOOLEAN</span> <span class="token keyword">MODE</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t
<span class="token keyword">USE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span>index1<span class="token punctuation">)</span>
<span class="token keyword">WHERE</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token keyword">IN</span> <span class="token datatype">BOOLEAN</span> <span class="token keyword">MODE</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
Index hints work with
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statements, but only if you use multi-table
<code class="literal">
DELETE
</code>
syntax, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63136695"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">EXPLAIN</span> <span class="token keyword">DELETE</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">USE</span> <span class="token keyword">INDEX</span><span class="token punctuation">(</span>col2<span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> col1 <span class="token operator">BETWEEN</span> <span class="token number">1</span> <span class="token operator">AND</span> <span class="token number">100</span> <span class="token operator">AND</span> COL2 <span class="token operator">BETWEEN</span> <span class="token number">1</span> <span class="token operator">AND</span> <span class="token number">100</span>\G
<span class="token output">ERROR 1064 (42000)<span class="token punctuation">:</span> You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'use
index(col2) where col1 between 1 and 100 and col2 between 1 and 100' at line 1
</span>
<span class="token prompt">mysql></span> <span class="token keyword">EXPLAIN</span> <span class="token keyword">DELETE</span> t1<span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">USE</span> <span class="token keyword">INDEX</span><span class="token punctuation">(</span>col2<span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> col1 <span class="token operator">BETWEEN</span> <span class="token number">1</span> <span class="token operator">AND</span> <span class="token number">100</span> <span class="token operator">AND</span> COL2 <span class="token operator">BETWEEN</span> <span class="token number">1</span> <span class="token operator">AND</span> <span class="token number">100</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
id<span class="token punctuation">:</span> 1
select_type<span class="token punctuation">:</span> DELETE
table<span class="token punctuation">:</span> t1
partitions<span class="token punctuation">:</span> NULL
type<span class="token punctuation">:</span> range
possible_keys<span class="token punctuation">:</span> col2
key<span class="token punctuation">:</span> col2
key_len<span class="token punctuation">:</span> 5
ref<span class="token punctuation">:</span> NULL
rows<span class="token punctuation">:</span> 72
filtered<span class="token punctuation">:</span> 11.11
Extra<span class="token punctuation">:</span> Using where
</span><span class="token output">1 row in set, 1 warning (0.00 sec)</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-tips.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-tips">
</a>
6.5.1.6 mysql Client Tips
</h4>
</div>
</div>
</div>
<p>
This section provides information about techniques for more
effective use of
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
and about
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
operational behavior.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="mysql-tips.html#mysql-input-editing" title="Input-Line Editing">
Input-Line Editing
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="mysql-tips.html#mysql-history" title="Disabling Interactive History">
Disabling Interactive History
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="mysql-tips.html#windows-unicode-support" title="Unicode Support on Windows">
Unicode Support on Windows
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="mysql-tips.html#vertical-query-results" title="Displaying Query Results Vertically">
Displaying Query Results Vertically
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="mysql-tips.html#safe-updates" title="Using Safe-Updates Mode (--safe-updates)">
Using Safe-Updates Mode (--safe-updates)
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="mysql-tips.html#mysql-reconnect" title="Disabling mysql Auto-Reconnect">
Disabling mysql Auto-Reconnect
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="mysql-tips.html#mysql-parsers" title="mysql Client Parser Versus Server Parser">
mysql Client Parser Versus Server Parser
</a>
</p>
</li>
</ul>
</div>
<h5>
<a name="mysql-input-editing">
</a>
Input-Line Editing
</h5>
<p>
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
supports input-line editing, which
enables you to modify the current input line in place or recall
previous input lines. For example, the
<span class="keycap">
<strong>
left-arrow
</strong>
</span>
and
<span class="keycap">
<strong>
right-arrow
</strong>
</span>
keys move horizontally within the current input line, and the
<span class="keycap">
<strong>
up-arrow
</strong>
</span>
and
<span class="keycap">
<strong>
down-arrow
</strong>
</span>
keys
move up and down through the set of previously entered lines.
<span class="keycap">
<strong>
Backspace
</strong>
</span>
deletes the character before the
cursor and typing new characters enters them at the cursor
position. To enter the line, press
<span class="keycap">
<strong>
Enter
</strong>
</span>
.
</p>
<p>
On Windows, the editing key sequences are the same as supported
for command editing in console windows. On Unix, the key
sequences depend on the input library used to build
<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, the
<code class="literal">
libedit
</code>
or
<code class="literal">
readline
</code>
library).
</p>
<p>
Documentation for the
<code class="literal">
libedit
</code>
and
<code class="literal">
readline
</code>
libraries is available online. To
change the set of key sequences permitted by a given input
library, define key bindings in the library startup file. This
is a file in your home directory:
<code class="filename">
.editrc
</code>
for
<code class="literal">
libedit
</code>
and
<code class="filename">
.inputrc
</code>
for
<code class="literal">
readline
</code>
.
</p>
<p>
For example, in
<code class="literal">
libedit
</code>
,
<span class="keycap">
<strong>
Control+W
</strong>
</span>
deletes everything before the current
cursor position and
<span class="keycap">
<strong>
Control+U
</strong>
</span>
deletes the
entire line. In
<code class="literal">
readline
</code>
,
<span class="keycap">
<strong>
Control+W
</strong>
</span>
deletes the word before the cursor
and
<span class="keycap">
<strong>
Control+U
</strong>
</span>
deletes everything before the
current cursor position. If
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
was built
using
<code class="literal">
libedit
</code>
, a user who prefers the
<code class="literal">
readline
</code>
behavior for these two keys can put
the following lines in the
<code class="filename">
.editrc
</code>
file
(creating the file if necessary):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa81865867"><div class="copy-help left">Press ⌘+C to 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">bind <span class="token atrule">"^W"</span> ed-delete-prev-word
bind <span class="token atrule">"^U"</span> vi-kill-line-prev</code></pre>
</div>
<p>
To see the current set of key bindings, temporarily put a line
that says only
<code class="literal">
bind
</code>
at the end of
<code class="filename">
.editrc
</code>
.
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
shows the
bindings when it starts.
</p>
<h5>
<a name="mysql-history">
</a>
Disabling Interactive History
</h5>
<a class="indexterm" name="idm46045317268560">
</a>
<p>
The
<span class="keycap">
<strong>
up-arrow
</strong>
</span>
key enables you to recall input
lines from current and previous sessions. In cases where a
console is shared, this behavior may be unsuitable.
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
supports disabling the interactive
history partially or fully, depending on the host platform.
</p>
<p>
On Windows, the history is stored in memory.
<span class="keycap">
<strong>
Alt+F7
</strong>
</span>
deletes all input lines stored in memory
for the current history buffer. It also deletes the list of
sequential numbers in front of the input lines displayed with
<span class="keycap">
<strong>
F7
</strong>
</span>
and recalled (by number) with
<span class="keycap">
<strong>
F9
</strong>
</span>
. New input lines entered after you press
<span class="keycap">
<strong>
Alt+F7
</strong>
</span>
repopulate the current history buffer.
Clearing the buffer does not prevent logging to the Windows
Event Viewer, if the
<a class="link" href="mysql-command-options.html#option_mysql_syslog">
<code class="option">
--syslog
</code>
</a>
option was used to start
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
. Closing the
console window also clears the current history buffer.
</p>
<p>
To disable interactive history on Unix, first delete the
<code class="filename">
.mysql_history
</code>
file, if it exists (previous
entries are recalled otherwise). Then start
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
with the
<code class="literal">
--histignore="*"
</code>
option to ignore all new
input lines. To re-enable the recall (and logging) behavior,
restart
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
without the option.
</p>
<p>
If you prevent the
<code class="filename">
.mysql_history
</code>
file from
being created (see
<a class="xref" href="mysql-logging.html#mysql-logging-history-file" title="Controlling the History File">
Controlling the History File
</a>
)
and use
<code class="literal">
--histignore="*"
</code>
to start the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, the interactive history recall
facility is disabled fully. Alternatively, if you omit the
<a class="link" href="mysql-command-options.html#option_mysql_histignore">
<code class="option">
--histignore
</code>
</a>
option, you can
recall the input lines entered during the current session.
</p>
<h5>
<a name="windows-unicode-support">
</a>
Unicode Support on Windows
</h5>
<p>
Windows provides APIs based on UTF-16LE for reading from and
writing to the console; the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client for
Windows is able to use these APIs. The Windows installer creates
an item in the MySQL menu named
<code class="literal">
MySQL command line
client - Unicode
</code>
. This item invokes the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client with properties set to
communicate through the console to the MySQL server using
Unicode.
</p>
<p>
To take advantage of this support manually, run
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
within a console that uses a compatible
Unicode font and set the default character set to a Unicode
character set that is supported for communication with the
server:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Open a console window.
</p>
</li>
<li class="listitem">
<p>
Go to the console window properties, select the font tab,
and choose Lucida Console or some other compatible Unicode
font. This is necessary because console windows start by
default using a DOS raster font that is inadequate for
Unicode.
</p>
</li>
<li class="listitem">
<p>
Execute
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql.exe
</strong>
</span>
</a>
with the
<a class="link" href="mysql-command-options.html#option_mysql_default-character-set">
<code class="option">
--default-character-set=utf8mb4
</code>
</a>
(or
<code class="literal">
utf8mb3
</code>
) option. This option is
necessary because
<code class="literal">
utf16le
</code>
is one of the
character sets that cannot be used as the client character
set. See
<a class="xref" href="charset-connection.html#charset-connection-impermissible-client-charset" title="Impermissible Client Character Sets">
Impermissible Client Character Sets
</a>
.
</p>
</li>
</ol>
</div>
<p>
With those changes,
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
uses the Windows
APIs to communicate with the console using UTF-16LE, and
communicate with the server using UTF-8. (The menu item
mentioned previously sets the font and character set as just
described.)
</p>
<p>
To avoid those steps each time you run
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
,
you can create a shortcut that invokes
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql.exe
</strong>
</span>
</a>
. The shortcut should set the
console font to Lucida Console or some other compatible Unicode
font, and pass the
<a class="link" href="mysql-command-options.html#option_mysql_default-character-set">
<code class="option">
--default-character-set=utf8mb4
</code>
</a>
(or
<code class="literal">
utf8mb3
</code>
) option to
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql.exe
</strong>
</span>
</a>
.
</p>
<p>
Alternatively, create a shortcut that only sets the console
font, and set the character set in the
<code class="literal">
[mysql]
</code>
group of your
<code class="filename">
my.ini
</code>
file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa10822671"><div class="copy-help left">Press ⌘+C to 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">[mysql]</span>
<span class="token constant">default-character-set</span><span class="token attr-value"><span class="token punctuation">=</span>utf8mb4 </span><span class="token comment" spellcheck="true"># or utf8mb3</span></code></pre>
</div>
<h5>
<a name="vertical-query-results">
</a>
Displaying Query Results Vertically
</h5>
<p>
Some query results are much more readable when displayed
vertically, instead of in the usual horizontal table format.
Queries can be displayed vertically by terminating the query
with \G instead of a semicolon. For example, longer text values
that include newlines often are much easier to read with
vertical output:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa97586432"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> mails <span class="token keyword">WHERE</span> <span class="token function">LENGTH</span><span class="token punctuation">(</span>txt<span class="token punctuation">)</span> <span class="token operator"><</span> <span class="token number">300</span> <span class="token keyword">LIMIT</span> <span class="token number">300</span><span class="token punctuation">,</span><span class="token number">1</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>
msg_nro<span class="token punctuation">:</span> 3068
date<span class="token punctuation">:</span> 2000-03-01 23<span class="token punctuation">:</span>29<span class="token punctuation">:</span>50
time_zone<span class="token punctuation">:</span> +0200
mail_from<span class="token punctuation">:</span> Jones
reply<span class="token punctuation">:</span> [email protected]
mail_to<span class="token punctuation">:</span> "John Smith" <[email protected]>
sbj<span class="token punctuation">:</span> UTF-8
txt<span class="token punctuation">:</span> >>>>> "John" == John Smith writes<span class="token punctuation">:</span>
</span>
John<span class="token operator">></span> Hi<span class="token punctuation">.</span> I think this <span class="token operator">is</span> a good idea<span class="token punctuation">.</span> <span class="token operator">Is</span> anyone familiar
John<span class="token operator">></span> <span class="token keyword">with</span> UTF<span class="token number">-8</span> <span class="token operator">or</span> <span class="token keyword">Unicode</span>? Otherwise<span class="token punctuation">,</span> I'll put this <span class="token keyword">on</span> my
John<span class="token operator">></span> TODO <span class="token keyword">list</span> <span class="token operator">and</span> see what happens<span class="token punctuation">.</span>
Yes<span class="token punctuation">,</span> please <span class="token keyword">do</span> that<span class="token punctuation">.</span>
Regards<span class="token punctuation">,</span>
Jones
<span class="token keyword">file</span>: inbox<span class="token operator">-</span>jani<span class="token number">-1</span>
<span class="token keyword">hash</span>: <span class="token number">190402944</span>
<span class="token output">1 row in set (0.09 sec)</span></code></pre>
</div>
<h5>
<a name="safe-updates">
</a>
Using Safe-Updates Mode (--safe-updates)
</h5>
<a class="indexterm" name="idm46045317217136">
</a>
<a class="indexterm" name="idm46045317216096">
</a>
<a class="indexterm" name="idm46045317214608">
</a>
<a class="indexterm" name="idm46045317213520">
</a>
<a class="indexterm" name="idm46045317212032">
</a>
<a class="indexterm" name="idm46045317210944">
</a>
<a class="indexterm" name="idm46045317209456">
</a>
<a class="indexterm" name="idm46045317208368">
</a>
<p>
For beginners, a useful startup option is
<a class="link" href="mysql-command-options.html#option_mysql_safe-updates">
<code class="option">
--safe-updates
</code>
</a>
(or
<a class="link" href="mysql-command-options.html#option_mysql_safe-updates">
<code class="option">
--i-am-a-dummy
</code>
</a>
,
which has the same effect). Safe-updates mode is helpful for
cases when you might have issued an
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
or
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statement but forgotten
the
<code class="literal">
WHERE
</code>
clause indicating which rows to
modify. Normally, such statements update or delete all rows in
the table. With
<a class="link" href="mysql-command-options.html#option_mysql_safe-updates">
<code class="option">
--safe-updates
</code>
</a>
,
you can modify rows only by specifying the key values that
identify them, or a
<code class="literal">
LIMIT
</code>
clause, or both.
This helps prevent accidents. Safe-updates mode also restricts
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements that produce
(or are estimated to produce) very large result sets.
</p>
<p>
The
<a class="link" href="mysql-command-options.html#option_mysql_safe-updates">
<code class="option">
--safe-updates
</code>
</a>
option causes
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
to execute the following statement when
it connects to the MySQL server, to set the session values of
the
<a class="link" href="server-system-variables.html#sysvar_sql_safe_updates">
<code class="literal">
sql_safe_updates
</code>
</a>
,
<a class="link" href="server-system-variables.html#sysvar_sql_select_limit">
<code class="literal">
sql_select_limit
</code>
</a>
, and
<a class="link" href="server-system-variables.html#sysvar_max_join_size">
<code class="literal">
max_join_size
</code>
</a>
system variables:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa73712258"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> sql_safe_updates<span class="token operator">=</span><span class="token number">1</span><span class="token punctuation">,</span> sql_select_limit<span class="token operator">=</span><span class="token number">1000</span><span class="token punctuation">,</span> max_join_size<span class="token operator">=</span><span class="token number">1000000</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
statement affects statement processing as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Enabling
<a class="link" href="server-system-variables.html#sysvar_sql_safe_updates">
<code class="literal">
sql_safe_updates
</code>
</a>
causes
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
and
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statements to produce
an error if they do not specify a key constraint in the
<code class="literal">
WHERE
</code>
clause, or provide a
<code class="literal">
LIMIT
</code>
clause, or both. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa33978309"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> <em class="replaceable">tbl_name</em> <span class="token keyword">SET</span> <em class="replaceable">not_key_column</em><span class="token operator">=</span><em class="replaceable">val</em> <span class="token keyword">WHERE</span> <em class="replaceable">key_column</em><span class="token operator">=</span><em class="replaceable">val</em><span class="token punctuation">;</span>
<span class="token keyword">UPDATE</span> <em class="replaceable">tbl_name</em> <span class="token keyword">SET</span> <em class="replaceable">not_key_column</em><span class="token operator">=</span><em class="replaceable">val</em> <span class="token keyword">LIMIT</span> <span class="token number">1</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Setting
<a class="link" href="server-system-variables.html#sysvar_sql_select_limit">
<code class="literal">
sql_select_limit
</code>
</a>
to
1,000 causes the server to limit all
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
result sets to 1,000
rows unless the statement includes a
<code class="literal">
LIMIT
</code>
clause.
</p>
</li>
<li class="listitem">
<p>
Setting
<a class="link" href="server-system-variables.html#sysvar_max_join_size">
<code class="literal">
max_join_size
</code>
</a>
to
1,000,000 causes multiple-table
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements to produce
an error if the server estimates it must examine more than
1,000,000 row combinations.
</p>
</li>
</ul>
</div>
<p>
To specify result set limits different from 1,000 and 1,000,000,
you can override the defaults by using the
<a class="link" href="mysql-command-options.html#option_mysql_select-limit">
<code class="option">
--select-limit
</code>
</a>
and
<a class="link" href="mysql-command-options.html#option_mysql_max-join-size">
<code class="option">
--max-join-size
</code>
</a>
options when you
invoke
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa72814004"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysql <span class="token property">--safe-updates</span> <span class="token constant">--select-limit</span><span class="token attr-value"><span class="token punctuation">=</span>500</span> <span class="token constant">--max-join-size</span><span class="token attr-value"><span class="token punctuation">=</span>10000</span></code></pre>
</div>
<p>
It is possible for
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
and
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statements to produce an
error in safe-updates mode even with a key specified in the
<code class="literal">
WHERE
</code>
clause, if the optimizer decides not to
use the index on the key column:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Range access on the index cannot be used if memory usage
exceeds that permitted by the
<a class="link" href="server-system-variables.html#sysvar_range_optimizer_max_mem_size">
<code class="literal">
range_optimizer_max_mem_size
</code>
</a>
system variable. The optimizer then falls back to a table
scan. See
<a class="xref" href="range-optimization.html#range-optimization-memory-use" title="Limiting Memory Use for Range Optimization">
Limiting Memory Use for Range Optimization
</a>
.
</p>
</li>
<li class="listitem">
<p>
If key comparisons require type conversion, the index may
not be used (see
<a class="xref" href="mysql-indexes.html" title="10.3.1 How MySQL Uses Indexes">
Section 10.3.1, “How MySQL Uses Indexes”
</a>
). Suppose
that an indexed string column
<code class="literal">
c1
</code>
is
compared to a numeric value using
<code class="literal">
WHERE c1 =
2222
</code>
. For such comparisons, the string value is
converted to a number and the operands are compared
numerically (see
<a class="xref" href="type-conversion.html" title="14.3 Type Conversion in Expression Evaluation">
Section 14.3, “Type Conversion in Expression Evaluation”
</a>
),
preventing use of the index. If safe-updates mode is
enabled, an error occurs.
</p>
</li>
</ul>
</div>
<p>
These behaviors are included in safe-updates mode:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
with
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
and
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statements does not
produce safe-updates errors. This enables use of
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
plus
<a class="link" href="show-warnings.html" title="15.7.7.42 SHOW WARNINGS Statement">
<code class="literal">
SHOW WARNINGS
</code>
</a>
to see why an
index is not used, which can be helpful in cases such as
when a
<a class="link" href="server-system-variables.html#sysvar_range_optimizer_max_mem_size">
<code class="literal">
range_optimizer_max_mem_size
</code>
</a>
violation or type conversion occurs and the optimizer does
not use an index even though a key column was specified in
the
<code class="literal">
WHERE
</code>
clause.
</p>
</li>
<li class="listitem">
<p>
When a safe-updates error occurs, the error message includes
the first diagnostic that was produced, to provide
information about the reason for failure. For example, the
message may indicate that the
<a class="link" href="server-system-variables.html#sysvar_range_optimizer_max_mem_size">
<code class="literal">
range_optimizer_max_mem_size
</code>
</a>
value was exceeded or type conversion occurred, either of
which can preclude use of an index.
</p>
</li>
<li class="listitem">
<p>
For multiple-table deletes and updates, an error is produced
with safe updates enabled only if any target table uses a
table scan.
</p>
</li>
</ul>
</div>
<h5>
<a name="mysql-reconnect">
</a>
Disabling mysql Auto-Reconnect
</h5>
<p>
If the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client loses its connection to
the server while sending a statement, it immediately and
automatically tries to reconnect once to the server and send the
statement again. However, even if
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
succeeds in reconnecting, your first connection has ended and
all your previous session objects and settings are lost:
temporary tables, the autocommit mode, and user-defined and
session variables. Also, any current transaction rolls back.
This behavior may be dangerous for you, as in the following
example where the server was shut down and restarted between the
first and second statements without you knowing it:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa55854111"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">@a</span><span class="token operator">=</span><span class="token number">1</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.05 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token variable">@a</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 2006<span class="token punctuation">:</span> MySQL server has gone away
No connection. Trying to reconnect...
Connection id<span class="token punctuation">:</span> 1
Current database<span class="token punctuation">:</span> test
</span><span class="token output">Query OK, 1 row affected (1.30 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> t<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> a <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.05 sec)</span></code></pre>
</div>
<p>
The
<code class="literal">
@a
</code>
user variable has been lost with the
connection, and after the reconnection it is undefined. If it is
important to have
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
terminate with an
error if the connection has been lost, you can start the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client with the
<a class="link" href="mysql-command-options.html#option_mysql_reconnect">
<code class="option">
--skip-reconnect
</code>
</a>
option.
</p>
<p>
For more information about auto-reconnect and its effect on
state information when a reconnection occurs, see
<a class="ulink" href="/doc/c-api/8.4/en/c-api-auto-reconnect.html" target="_top">
Automatic Reconnection Control
</a>
.
</p>
<h5>
<a name="mysql-parsers">
</a>
mysql Client Parser Versus Server Parser
</h5>
<a class="indexterm" name="idm46045317124640">
</a>
<a class="indexterm" name="idm46045317123184">
</a>
<p>
The
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client uses a parser on the client
side that is not a duplicate of the complete parser used by the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server on the server side. This can
lead to differences in treatment of certain constructs.
Examples:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The server parser treats strings delimited by
<code class="literal">
"
</code>
characters as identifiers rather than
as plain strings if the
<a class="link" href="sql-mode.html#sqlmode_ansi_quotes">
<code class="literal">
ANSI_QUOTES
</code>
</a>
SQL mode is
enabled.
</p>
<p>
The
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client parser does not take the
<code class="literal">
ANSI_QUOTES
</code>
SQL mode into account. It
treats strings delimited by
<code class="literal">
"
</code>
,
<code class="literal">
'
</code>
, and
<code class="literal">
`
</code>
characters
the same, regardless of whether
<a class="link" href="sql-mode.html#sqlmode_ansi_quotes">
<code class="literal">
ANSI_QUOTES
</code>
</a>
is enabled.
</p>
</li>
<li class="listitem">
<p>
Within
<code class="literal">
/*! ... */
</code>
and
<code class="literal">
/*+ ...
*/
</code>
comments, the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client
parser interprets short-form
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
commands. The server parser does not interpret them because
these commands have no meaning on the server side.
</p>
<p>
If it is desirable for
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
not to
interpret short-form commands within comments, a partial
workaround is to use the
<a class="link" href="mysql-command-options.html#option_mysql_binary-mode">
<code class="option">
--binary-mode
</code>
</a>
option, which
causes all
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
commands to be disabled
except
<code class="literal">
\C
</code>
and
<code class="literal">
\d
</code>
in
noninteractive mode (for input piped to
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
or loaded using the
<code class="literal">
source
</code>
command).
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/can-not-connect-to-server.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="can-not-connect-to-server">
</a>
B.3.2.2 Can't connect to [local] MySQL server
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045054581712">
</a>
<a class="indexterm" name="idm46045054580640">
</a>
<p>
A MySQL client on Unix can connect to the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server in two different ways: By
using a Unix socket file to connect through a file in the file
system (default
<code class="filename">
/tmp/mysql.sock
</code>
), or by
using TCP/IP, which connects through a port number. A Unix
socket file connection is faster than TCP/IP, but can be used
only when connecting to a server on the same computer. A Unix
socket file is used if you do not specify a host name or if
you specify the special host name
<code class="literal">
localhost
</code>
.
</p>
<p>
If the MySQL server is running on Windows, you can connect
using TCP/IP. If the server is started with the
<a class="link" href="server-system-variables.html#sysvar_named_pipe">
<code class="literal">
named_pipe
</code>
</a>
system variable
enabled, you can also connect with named pipes if you run the
client on the host where the server is running. The name of
the named pipe is
<code class="literal">
MySQL
</code>
by default. If you
do not give a host name when connecting to
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
, a MySQL client first tries to
connect to the named pipe. If that does not work, it connects
to the TCP/IP port. You can force the use of named pipes on
Windows by using
<code class="literal">
.
</code>
as the host name.
</p>
<p>
The error (2002)
<code class="literal">
Can't connect to ...
</code>
normally means that there is no MySQL server running on the
system or that you are using an incorrect Unix socket file
name or TCP/IP port number when trying to connect to the
server. You should also check that the TCP/IP port you are
using has not been blocked by a firewall or port blocking
service.
</p>
<p>
The error (2003)
<code class="literal">
Can't connect to MySQL server on
'
<em class="replaceable">
<code>
server
</code>
</em>
' (10061)
</code>
indicates that the network connection has been refused. You
should check that there is a MySQL server running, that it has
network connections enabled, and that the network port you
specified is the one configured on the server.
</p>
<p>
Start by checking whether there is a process named
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
running on your server host. (Use
<span class="command">
<strong>
ps xa | grep mysqld
</strong>
</span>
on Unix or the Task
Manager on Windows.) If there is no such process, you should
start the server. See
<a class="xref" href="starting-server.html" title="2.9.2 Starting the Server">
Section 2.9.2, “Starting the Server”
</a>
.
</p>
<p>
If a
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
process is running, you can
check it by trying the following commands. The port number or
Unix socket file name might be different in your setup.
<code class="literal">
host_ip
</code>
represents the IP address of the
machine where the server is running.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa39100841"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysqladmin</span> version
<span class="token prompt">$> </span><span class="token command">mysqladmin</span> variables
<span class="token prompt">$> </span><span class="token command">mysqladmin</span> <span class="token property">-h</span> `hostname` version variables
<span class="token prompt">$> </span><span class="token command">mysqladmin</span> <span class="token property">-h</span> `hostname` <span class="token constant">--port</span><span class="token attr-value"><span class="token punctuation">=</span>3306</span> version
<span class="token prompt">$> </span><span class="token command">mysqladmin</span> <span class="token property">-h</span> host_ip version
<span class="token prompt">$> </span><span class="token command">mysqladmin</span> <span class="token constant">--protocol</span><span class="token attr-value"><span class="token punctuation">=</span>SOCKET</span> <span class="token constant">--socket</span><span class="token attr-value"><span class="token punctuation">=</span>/tmp/mysql.sock</span> version</code></pre>
</div>
<p>
Note the use of backticks rather than forward quotation marks
with the
<span class="command">
<strong>
hostname
</strong>
</span>
command; these cause the
output of
<span class="command">
<strong>
hostname
</strong>
</span>
(that is, the current
host name) to be substituted into the
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
</strong>
</span>
</a>
command. If you have no
<span class="command">
<strong>
hostname
</strong>
</span>
command or are running on Windows,
you can manually type the host name of your machine (without
backticks) following the
<code class="literal">
-h
</code>
option. You can
also try
<code class="literal">
-h 127.0.0.1
</code>
to connect with
TCP/IP to the local host.
</p>
<p>
Make sure that the server has not been configured to ignore
network connections or (if you are attempting to connect
remotely) that it has not been configured to listen only
locally on its network interfaces. If the server 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, it cannot accept TCP/IP connections
at all. If the server 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 to
<code class="literal">
127.0.0.1
</code>
, it listens for TCP/IP
connections only locally on the loopback interface and does
not accept remote connections.
</p>
<p>
Check to make sure that there is no firewall blocking access
to MySQL. Your firewall may be configured on the basis of the
application being executed, or the port number used by MySQL
for communication (3306 by default). Under Linux or Unix,
check your IP tables (or similar) configuration to ensure that
the port has not been blocked. Under Windows, applications
such as ZoneAlarm or Windows Firewall may need to be
configured not to block the MySQL port.
</p>
<p>
Here are some reasons the
<code class="literal">
Can't connect to local
MySQL server
</code>
error might occur:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<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>
is not running on the local
host. Check your operating system's process list to ensure
the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
process is present.
</p>
</li>
<li class="listitem">
<p>
You're running a MySQL server on Windows with many TCP/IP
connections to it. If you're experiencing that quite often
your clients get that error, you can find a workaround
here:
<a class="xref" href="can-not-connect-to-server.html#can-not-connect-to-server-on-windows" title="B.3.2.2.1 Connection to MySQL Server Failing on Windows">
Section B.3.2.2.1, “Connection to MySQL Server Failing on Windows”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Someone has removed the Unix socket file that
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
uses
(
<code class="filename">
/tmp/mysql.sock
</code>
by default). For
example, you might have a
<span class="command">
<strong>
cron
</strong>
</span>
job that
removes old files from the
<code class="filename">
/tmp
</code>
directory. You can always run
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
version
</strong>
</span>
</a>
to check whether the Unix socket file
that
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
</strong>
</span>
</a>
is trying to use really
exists. The fix in this case is to change the
<span class="command">
<strong>
cron
</strong>
</span>
job to not remove
<code class="filename">
mysql.sock
</code>
or to place the socket
file somewhere else. See
<a class="xref" href="problems-with-mysql-sock.html" title="B.3.3.6 How to Protect or Change the MySQL Unix Socket File">
Section B.3.3.6, “How to Protect or Change the MySQL Unix Socket File”
</a>
.
</p>
</li>
<li class="listitem">
<p>
You have started the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server with
the
<a class="link" href="server-options.html#option_mysqld_socket">
<code class="option">
--socket=/path/to/socket
</code>
</a>
option, but forgotten to tell client programs the new name
of the socket file. If you change the socket path name for
the server, you must also notify the MySQL clients. You
can do this by providing the same
<a class="link" href="connection-options.html#option_general_socket">
<code class="option">
--socket
</code>
</a>
option when you
run client programs. You also need to ensure that clients
have permission to access the
<code class="filename">
mysql.sock
</code>
file. To find out where
the socket file is, you can do:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa49975740"><div class="copy-help left">Press ⌘+C to 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">netstat</span> <span class="token property">-ln</span> | grep mysql</code></pre>
</div>
<p>
See
<a class="xref" href="problems-with-mysql-sock.html" title="B.3.3.6 How to Protect or Change the MySQL Unix Socket File">
Section B.3.3.6, “How to Protect or Change the MySQL Unix Socket File”
</a>
.
</p>
</li>
<li class="listitem">
<p>
You are using Linux and one server thread has died (dumped
core). In this case, you must kill the other
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
threads (for example, with
<a class="link" href="kill.html" title="15.7.8.4 KILL Statement">
<span class="command">
<strong>
kill
</strong>
</span>
</a>
) before you can restart the MySQL
server. See
<a class="xref" href="crashing.html" title="B.3.3.3 What to Do If MySQL Keeps Crashing">
Section B.3.3.3, “What to Do If MySQL Keeps Crashing”
</a>
.
</p>
</li>
<li class="listitem">
<p>
The server or client program might not have the proper
access privileges for the directory that holds the Unix
socket file or the socket file itself. In this case, you
must either change the access privileges for the directory
or socket file so that the server and clients can access
them, or restart
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
with a
<a class="link" href="server-options.html#option_mysqld_socket">
<code class="option">
--socket
</code>
</a>
option that
specifies a socket file name in a directory where the
server can create it and where client programs can access
it.
</p>
</li>
</ul>
</div>
<p>
If you get the error message
<code class="literal">
Can't connect to MySQL
server on some_host
</code>
, you can try the following
things to find out what the problem is:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Check whether the server is running on that host by
executing
<code class="literal">
telnet some_host 3306
</code>
and
pressing the Enter key a couple of times. (3306 is the
default MySQL port number. Change the value if your server
is listening to a different port.) If there is a MySQL
server running and listening to the port, you should get a
response that includes the server's version number. If you
get an error such as
<code class="literal">
telnet: Unable to connect to
remote host: Connection refused
</code>
, then there is
no server running on the given port.
</p>
</li>
<li class="listitem">
<p>
If the server is running on the local host, try using
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin -h localhost variables
</strong>
</span>
</a>
to
connect using the Unix socket file. Verify the TCP/IP port
number that the server is configured to listen to (it is
the value of the
<a class="link" href="server-system-variables.html#sysvar_port">
<code class="literal">
port
</code>
</a>
variable.)
</p>
</li>
<li class="listitem">
<p>
If you are running under Linux and Security-Enhanced Linux
(SELinux) is enabled, see
<a class="xref" href="selinux.html" title="8.7 SELinux">
Section 8.7, “SELinux”
</a>
.
</p>
</li>
</ul>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="can-not-connect-to-server-on-windows">
</a>
B.3.2.2.1 Connection to MySQL Server Failing on Windows
</h5>
</div>
</div>
</div>
<p>
When you're running a MySQL server on Windows with many
TCP/IP connections to it, and you're experiencing that quite
often your clients get a
<code class="literal">
Can't connect to MySQL
server
</code>
error, the reason might be that Windows
does not allow for enough ephemeral (short-lived) ports to
serve those connections.
</p>
<p>
The purpose of
<code class="literal">
TIME_WAIT
</code>
is to keep a
connection accepting packets even after the connection has
been closed. This is because Internet routing can cause a
packet to take a slow route to its destination and it may
arrive after both sides have agreed to close. If the port is
in use for a new connection, that packet from the old
connection could break the protocol or compromise personal
information from the original connection. The
<code class="literal">
TIME_WAIT
</code>
delay prevents this by ensuring
that the port cannot be reused until after some time has
been permitted for those delayed packets to arrive.
</p>
<p>
It is safe to reduce
<code class="literal">
TIME_WAIT
</code>
greatly on
LAN connections because there is little chance of packets
arriving at very long delays, as they could through the
Internet with its comparatively large distances and
latencies.
</p>
<p>
Windows permits ephemeral (short-lived) TCP ports to the
user. After any port is closed, it remains in a
<code class="literal">
TIME_WAIT
</code>
status for 120 seconds. The
port is not available again until this time expires. The
default range of port numbers depends on the version of
Windows, with a more limited number of ports in older
versions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Windows through Server 2003: Ports in range
1025–5000
</p>
</li>
<li class="listitem">
<p>
Windows Vista, Server 2008, and newer: Ports in range
49152–65535
</p>
</li>
</ul>
</div>
<p>
With a small stack of available TCP ports (5000) and a high
number of TCP ports being open and closed over a short
period of time along with the
<code class="literal">
TIME_WAIT
</code>
status you have a good chance for running out of ports.
There are two ways to address this problem:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Reduce the number of TCP ports consumed quickly by
investigating connection pooling or persistent
connections where possible
</p>
</li>
<li class="listitem">
<p>
Tune some settings in the Windows registry (see below)
</p>
</li>
</ul>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
The following procedure involves modifying the Windows
registry. Before you modify the registry, make sure to
back it up and make sure that you understand how to
restore it if a problem occurs. For information about how
to back up, restore, and edit the registry, view the
following article in the Microsoft Knowledge Base:
<a class="ulink" href="http://support.microsoft.com/kb/256986/EN-US/" target="_blank">
http://support.microsoft.com/kb/256986/EN-US/
</a>
.
</p>
</div>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Start Registry Editor
(
<code class="filename">
Regedt32.exe
</code>
).
</p>
</li>
<li class="listitem">
<p>
Locate the following key in the registry:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa66918406"><div class="copy-help left">Press ⌘+C to 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">HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters</code></pre>
</div>
</li>
<li class="listitem">
<p>
On the
<code class="literal">
Edit
</code>
menu, click
<code class="literal">
Add
Value
</code>
, and then add the following registry
value:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa15797377"><div class="copy-help left">Press ⌘+C to 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">Value Name: MaxUserPort
Data Type: REG_DWORD
Value: 65534</code></pre>
</div>
<p>
This sets the number of ephemeral ports available to any
user. The valid range is between 5000 and 65534
(decimal). The default value is 0x1388 (5000 decimal).
</p>
</li>
<li class="listitem">
<p>
On the
<code class="literal">
Edit
</code>
menu, click
<code class="literal">
Add
Value
</code>
, and then add the following registry
value:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa82816689"><div class="copy-help left">Press ⌘+C to 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">Value Name: TcpTimedWaitDelay
Data Type: REG_DWORD
Value: 30</code></pre>
</div>
<p>
This sets the number of seconds to hold a TCP port
connection in
<code class="literal">
TIME_WAIT
</code>
state before
closing. The valid range is between 30 and 300 decimal,
although you may wish to check with Microsoft for the
latest permitted values. The default value is 0x78 (120
decimal).
</p>
</li>
<li class="listitem">
<p>
Quit Registry Editor.
</p>
</li>
<li class="listitem">
<p>
Reboot the machine.
</p>
</li>
</ol>
</div>
<p>
Note: Undoing the above should be as simple as deleting the
registry entries you've created.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/help.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="help">
</a>
15.8.3 HELP Statement
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045167898720">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa95251764"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">HELP</span> <span class="token string">'<em class="replaceable">search_string</em>'</span></code></pre>
</div>
<p>
The
<a class="link" href="help.html" title="15.8.3 HELP Statement">
<code class="literal">
HELP
</code>
</a>
statement returns online
information from the MySQL Reference Manual. Its proper operation
requires that the help tables in the
<code class="literal">
mysql
</code>
database be initialized with help topic information (see
<a class="xref" href="server-side-help-support.html" title="7.1.17 Server-Side Help Support">
Section 7.1.17, “Server-Side Help Support”
</a>
).
</p>
<p>
The
<a class="link" href="help.html" title="15.8.3 HELP Statement">
<code class="literal">
HELP
</code>
</a>
statement searches the
help tables for the given search string and displays the result of
the search. The search string is not case-sensitive.
</p>
<p>
The search string can contain the wildcard characters
<code class="literal">
%
</code>
and
<code class="literal">
_
</code>
. These have the same
meaning as for pattern-matching operations performed with the
<a class="link" href="string-comparison-functions.html#operator_like">
<code class="literal">
LIKE
</code>
</a>
operator. For example,
<code class="literal">
HELP 'rep%'
</code>
returns a list of topics that begin
with
<code class="literal">
rep
</code>
.
</p>
<p>
The
<code class="literal">
HELP
</code>
statement does not require a
terminator such as
<code class="literal">
;
</code>
or
<code class="literal">
\G
</code>
.
</p>
<p>
The
<code class="literal">
HELP
</code>
statement understands several types of
search strings:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
At the most general level, use
<code class="literal">
contents
</code>
to
retrieve a list of the top-level help categories:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa27478055"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">HELP</span> <span class="token string">'contents'</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
For a list of topics in a given help category, such as
<code class="literal">
Data Types
</code>
, use the category name:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa60464504"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">HELP</span> <span class="token string">'data types'</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
For help on a specific help topic, such as the
<a class="link" href="string-functions.html#function_ascii">
<code class="literal">
ASCII()
</code>
</a>
function or the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement, use the
associated keyword or keywords:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa95205477"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">HELP</span> <span class="token string">'ascii'</span>
<span class="token keyword">HELP</span> <span class="token string">'create table'</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
In other words, the search string matches a category, many topics,
or a single topic. The following descriptions indicate the forms
that the result set can take.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Empty result
</p>
<p>
No match could be found for the search string.
</p>
<p>
Example:
<code class="literal">
HELP 'fake'
</code>
</p>
<p>
Yields:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa17793921"><div class="copy-help left">Press ⌘+C to 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">Nothing found
Please try to run 'help contents' for a list of all accessible topics</code></pre>
</div>
</li>
<li class="listitem">
<p>
Result set containing a single row
</p>
<p>
This means that the search string yielded a hit for the help
topic. The result includes the following items:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
name
</code>
: The topic name.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
description
</code>
: Descriptive help text for
the topic.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
example
</code>
: One or more usage examples.
(May be empty.)
</p>
</li>
</ul>
</div>
<p>
Example:
<code class="literal">
HELP 'log'
</code>
</p>
<p>
Yields:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa34214694"><div class="copy-help left">Press ⌘+C to 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">Name: 'LOG'
Description:
Syntax:
LOG(X), LOG(B,X)
If called with one parameter, this function returns the natural
logarithm of X. If X is less than or equal to 0.0E0, the function
returns NULL and a warning "Invalid argument for logarithm" is
reported. Returns NULL if X or B is NULL.
The inverse of this function (when called with a single argument) is
the EXP() function.
URL: https://dev.mysql.com/doc/refman/8.4/en/mathematical-functions.html
Examples:
mysql> SELECT LOG(2);
-> 0.69314718055995
mysql> SELECT LOG(-2);
-> NULL</code></pre>
</div>
</li>
<li class="listitem">
<p>
List of topics.
</p>
<p>
This means that the search string matched multiple help
topics.
</p>
<p>
Example:
<code class="literal">
HELP 'status'
</code>
</p>
<p>
Yields:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa9032732"><div class="copy-help left">Press ⌘+C to 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">Many help items for your request exist.
To make a more specific request, please type 'help <item>',
where <item> is one of the following topics:
FLUSH
SHOW
SHOW BINARY LOG STATUS
SHOW ENGINE
SHOW FUNCTION STATUS
SHOW PROCEDURE STATUS
SHOW REPLICA STATUS
SHOW STATUS
SHOW TABLE STATUS</code></pre>
</div>
</li>
<li class="listitem">
<p>
List of topics.
</p>
<p>
A list is also displayed if the search string matches a
category.
</p>
<p>
Example:
<code class="literal">
HELP 'functions'
</code>
</p>
<p>
Yields:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa78487844"><div class="copy-help left">Press ⌘+C to 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">You asked for help about help category: "Functions"
For more information, type 'help <item>', where <item> is one of the following
categories:
Aggregate Functions and Modifiers
Bit Functions
Cast Functions and Operators
Comparison Operators
Date and Time Functions
Encryption Functions
Enterprise Encryption Functions
Flow Control Functions
GROUP BY Functions and Modifiers
GTID
Information Functions
Internal Functions
Locking Functions
Logical Operators
Miscellaneous Functions
Numeric Functions
Performance Schema Functions
Spatial Functions
String Functions
Window Functions
XML</code></pre>
</div>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/adding-collation-unicode-uca.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="adding-collation-unicode-uca">
</a>
12.14.4 Adding a UCA Collation to a Unicode Character Set
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="ldml-collation-example.html">
12.14.4.1 Defining a UCA Collation Using LDML Syntax
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ldml-rules.html">
12.14.4.2 LDML Syntax Supported in MySQL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="collation-diagnostics.html">
12.14.4.3 Diagnostics During Index.xml Parsing
</a>
</span>
</dt>
</dl>
</div>
<p>
This section describes how to add a UCA collation for a Unicode
character set by writing the
<code class="literal">
<collation>
</code>
element within a
<code class="literal">
<charset>
</code>
character set description in
the MySQL
<code class="filename">
Index.xml
</code>
file. The procedure
described here does not require recompiling MySQL. It uses a
subset of the Locale Data Markup Language (LDML) specification,
which is available at
<a class="ulink" href="http://www.unicode.org/reports/tr35/" target="_blank">
http://www.unicode.org/reports/tr35/
</a>
. With this
method, you need not define the entire collation. Instead, you
begin with an existing
<span class="quote">
“
<span class="quote">
base
</span>
”
</span>
collation and
describe the new collation in terms of how it differs from the
base collation. The following table lists the base collations of
the Unicode character sets for which UCA collations can be
defined. It is not possible to create user-defined UCA
collations for
<code class="literal">
utf16le
</code>
; there is no
<code class="literal">
utf16le_unicode_ci
</code>
collation that would serve
as the basis for such collations.
</p>
<div class="table">
<a name="idm46045215121936">
</a>
<p class="title">
<b>
Table 12.4 MySQL Character Sets Available for User-Defined UCA Collations
</b>
</p>
<div class="table-contents">
<table summary="Unicode character sets for which user-defined UCA collations can be defined and their base collations.">
<colgroup>
<col style="width: 30%"/>
<col style="width: 60%"/>
</colgroup>
<thead>
<tr>
<th>
Character Set
</th>
<th>
Base Collation
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code class="literal">
utf8mb4
</code>
</td>
<td>
<code class="literal">
utf8mb4_unicode_ci
</code>
</td>
</tr>
<tr>
<td>
<code class="literal">
ucs2
</code>
</td>
<td>
<code class="literal">
ucs2_unicode_ci
</code>
</td>
</tr>
<tr>
<td>
<code class="literal">
utf16
</code>
</td>
<td>
<code class="literal">
utf16_unicode_ci
</code>
</td>
</tr>
<tr>
<td>
<code class="literal">
utf32
</code>
</td>
<td>
<code class="literal">
utf32_unicode_ci
</code>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
The following sections show how to add a collation that is
defined using LDML syntax, and provide a summary of LDML rules
supported in MySQL.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-online-ddl-operations.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-online-ddl-operations">
</a>
17.12.1 Online DDL Operations
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045160541392">
</a>
<p>
Online support details, syntax examples, and usage notes for DDL
operations are provided 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-online-ddl-operations.html#online-ddl-index-operations" title="Index Operations">
Index Operations
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-online-ddl-operations.html#online-ddl-primary-key-operations" title="Primary Key Operations">
Primary Key Operations
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-online-ddl-operations.html#online-ddl-column-operations" title="Column Operations">
Column Operations
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-online-ddl-operations.html#online-ddl-generated-column-operations" title="Generated Column Operations">
Generated Column Operations
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-online-ddl-operations.html#online-ddl-foreign-key-operations" title="Foreign Key Operations">
Foreign Key Operations
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-online-ddl-operations.html#online-ddl-table-operations" title="Table Operations">
Table Operations
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-online-ddl-operations.html#online-ddl-tablespace-operations" title="Tablespace Operations">
Tablespace Operations
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-online-ddl-operations.html#online-ddl-partitioning" title="Partitioning Operations">
Partitioning Operations
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="online-ddl-index-operations">
</a>
Index Operations
</h4>
</div>
</div>
</div>
<p>
The following table provides an overview of online DDL support
for index operations. An asterisk indicates additional
information, an exception, or a dependency. For details, see
<a class="xref" href="innodb-online-ddl-operations.html#online-ddl-index-syntax-notes" title="Syntax and Usage Notes">
Syntax and Usage Notes
</a>
.
</p>
<div class="table">
<a name="online-ddl-index-operations-table">
</a>
<p class="title">
<b>
Table 17.15 Online DDL Support for Index Operations
</b>
</p>
<div class="table-contents">
<table summary="Online DDL support for index operations indicating whether the operation is performed in place, rebuilds the table, permits concurrent DML, or only modifies metadata.">
<colgroup>
<col align="left" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Operation
</th>
<th scope="col">
Instant
</th>
<th scope="col">
In Place
</th>
<th scope="col">
Rebuilds Table
</th>
<th scope="col">
Permits Concurrent DML
</th>
<th scope="col">
Only Modifies Metadata
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
Creating or adding a secondary index
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Dropping an index
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
Renaming an index
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
Adding a
<code class="literal">
FULLTEXT
</code>
index
</th>
<td>
No
</td>
<td>
Yes*
</td>
<td>
No*
</td>
<td>
No
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Adding a
<code class="literal">
SPATIAL
</code>
index
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
No
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Changing the index type
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<h5>
<a name="online-ddl-index-syntax-notes">
</a>
Syntax and Usage Notes
</h5>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Creating or adding a secondary index
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa60186569"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">INDEX</span> <span class="token keyword"><em class="replaceable">name</em></span> <span class="token keyword">ON</span> <span class="token keyword"><em class="replaceable">table</em></span> <span class="token punctuation">(</span><em class="replaceable">col_list</em><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa34216669"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">INDEX</span> <span class="token keyword"><em class="replaceable">name</em></span> <span class="token punctuation">(</span><em class="replaceable">col_list</em><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The table remains available for read and write operations
while the index is being created. The
<a class="link" href="create-index.html" title="15.1.15 CREATE INDEX Statement">
<code class="literal">
CREATE INDEX
</code>
</a>
statement only
finishes after all transactions that are accessing the table
are completed, so that the initial state of the index
reflects the most recent contents of the table.
</p>
<p>
Online DDL support for adding secondary indexes means that
you can generally speed the overall process of creating and
loading a table and associated indexes by creating the table
without secondary indexes, then adding secondary indexes
after the data is loaded.
</p>
<p>
A newly created secondary index contains only the committed
data in the table at the time the
<a class="link" href="create-index.html" title="15.1.15 CREATE INDEX Statement">
<code class="literal">
CREATE INDEX
</code>
</a>
or
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statement
finishes executing. It does not contain any uncommitted
values, old versions of values, or values marked for
deletion but not yet removed from the old index.
</p>
<p>
Some factors affect the performance, space usage, and
semantics of this operation. For details, see
<a class="xref" href="innodb-online-ddl-limitations.html" title="17.12.8 Online DDL Limitations">
Section 17.12.8, “Online DDL Limitations”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Dropping an index
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa56285744"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">DROP</span> <span class="token keyword">INDEX</span> <span class="token keyword"><em class="replaceable">name</em></span> <span class="token keyword">ON</span> <span class="token keyword"><em class="replaceable">table</em></span><span class="token punctuation">;</span></code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa53369002"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">DROP</span> <span class="token keyword">INDEX</span> <span class="token keyword"><em class="replaceable">name</em></span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The table remains available for read and write operations
while the index is being dropped. The
<a class="link" href="drop-index.html" title="15.1.27 DROP INDEX Statement">
<code class="literal">
DROP INDEX
</code>
</a>
statement only
finishes after all transactions that are accessing the table
are completed, so that the initial state of the index
reflects the most recent contents of the table.
</p>
</li>
<li class="listitem">
<p>
Renaming an index
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa30493681"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">RENAME</span> <span class="token keyword">INDEX</span> <em class="replaceable">old_index_name</em> <span class="token keyword">TO</span> <em class="replaceable">new_index_name</em><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">INPLACE</span><span class="token punctuation">,</span> <span class="token keyword">LOCK</span><span class="token operator">=</span><span class="token keyword">NONE</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Adding a
<code class="literal">
FULLTEXT
</code>
index
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa28577871"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">FULLTEXT</span> <span class="token keyword">INDEX</span> <span class="token keyword"><em class="replaceable">name</em></span> <span class="token keyword">ON</span> <span class="token keyword">table</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></code></pre>
</div>
<p>
Adding the first
<code class="literal">
FULLTEXT
</code>
index rebuilds
the table if there is no user-defined
<code class="literal">
FTS_DOC_ID
</code>
column. Additional
<code class="literal">
FULLTEXT
</code>
indexes may be added without
rebuilding the table.
</p>
</li>
<li class="listitem">
<p>
Adding a
<code class="literal">
SPATIAL
</code>
index
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42422109"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> geom <span class="token punctuation">(</span>g <span class="token keyword">GEOMETRY</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> geom <span class="token keyword">ADD</span> <span class="token keyword">SPATIAL</span> <span class="token keyword">INDEX</span><span class="token punctuation">(</span>g<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> <span class="token keyword">LOCK</span><span class="token operator">=</span><span class="token keyword">SHARED</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Changing the index type (
<code class="literal">
USING {BTREE |
HASH}
</code>
)
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa56391785"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">DROP</span> <span class="token keyword">INDEX</span> i1<span class="token punctuation">,</span> <span class="token keyword">ADD</span> <span class="token keyword">INDEX</span> i1<span class="token punctuation">(</span><em class="replaceable">key_part<span class="token punctuation">,</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></em><span class="token punctuation"></span><span class="token punctuation">)</span> <span class="token keyword">USING</span> <span class="token keyword">BTREE</span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span>INSTANT<span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="online-ddl-primary-key-operations">
</a>
Primary Key Operations
</h4>
</div>
</div>
</div>
<p>
The following table provides an overview of online DDL support
for primary key operations. An asterisk indicates additional
information, an exception, or a dependency. See
<a class="xref" href="innodb-online-ddl-operations.html#online-ddl-primary-key-syntax-notes" title="Syntax and Usage Notes">
Syntax and Usage Notes
</a>
.
</p>
<div class="table">
<a name="online-ddl-primary-key-operations-table">
</a>
<p class="title">
<b>
Table 17.16 Online DDL Support for Primary Key Operations
</b>
</p>
<div class="table-contents">
<table summary="Online DDL support for primary key operations indicating whether the operation is performed in place, rebuilds the table, permits concurrent DML, or only modifies metadata.">
<colgroup>
<col align="left" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Operation
</th>
<th scope="col">
Instant
</th>
<th scope="col">
In Place
</th>
<th scope="col">
Rebuilds Table
</th>
<th scope="col">
Permits Concurrent DML
</th>
<th scope="col">
Only Modifies Metadata
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
Adding a primary key
</th>
<td>
No
</td>
<td>
Yes*
</td>
<td>
Yes*
</td>
<td>
Yes
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Dropping a primary key
</th>
<td>
No
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Dropping a primary key and adding another
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
No
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<h5>
<a name="online-ddl-primary-key-syntax-notes">
</a>
Syntax and Usage Notes
</h5>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Adding a primary key
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa71233527"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> <span class="token keyword">LOCK</span><span class="token operator">=</span><span class="token keyword">NONE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Rebuilds the table in place. Data is reorganized
substantially, making it an expensive operation.
<code class="literal">
ALGORITHM=INPLACE
</code>
is not permitted under
certain conditions if columns have to be converted to
<code class="literal">
NOT NULL
</code>
.
</p>
<p>
Restructuring the
<a class="link" href="glossary.html#glos_clustered_index" title="clustered index">
clustered index
</a>
always requires copying of table data. Thus, it is best to
define the
<a class="link" href="glossary.html#glos_primary_key" title="primary key">
primary
key
</a>
when you create a table, rather than issuing
<code class="literal">
ALTER TABLE ... ADD PRIMARY KEY
</code>
later.
</p>
<p>
When you create a
<code class="literal">
UNIQUE
</code>
or
<code class="literal">
PRIMARY KEY
</code>
index, MySQL must do some
extra work. For
<code class="literal">
UNIQUE
</code>
indexes, MySQL
checks that the table contains no duplicate values for the
key. For a
<code class="literal">
PRIMARY KEY
</code>
index, MySQL also
checks that none of the
<code class="literal">
PRIMARY KEY
</code>
columns contains a
<code class="literal">
NULL
</code>
.
</p>
<p>
When you add a primary key using the
<code class="literal">
ALGORITHM=COPY
</code>
clause, MySQL converts
<code class="literal">
NULL
</code>
values in the associated columns to
default values: 0 for numbers, an empty string for
character-based columns and BLOBs, and 0000-00-00 00:00:00
for
<code class="literal">
DATETIME
</code>
. This is a non-standard
behavior that Oracle recommends you not rely on. Adding a
primary key using
<code class="literal">
ALGORITHM=INPLACE
</code>
is
only permitted when the
<a class="link" href="server-system-variables.html#sysvar_sql_mode">
<code class="literal">
SQL_MODE
</code>
</a>
setting includes
the
<code class="literal">
strict_trans_tables
</code>
or
<code class="literal">
strict_all_tables
</code>
flags; when the
<code class="literal">
SQL_MODE
</code>
setting is strict,
<code class="literal">
ALGORITHM=INPLACE
</code>
is permitted, but the
statement can still fail if the requested primary key
columns contain
<code class="literal">
NULL
</code>
values. The
<code class="literal">
ALGORITHM=INPLACE
</code>
behavior is more
standard-compliant.
</p>
<p>
If you create a table without a primary key,
<code class="literal">
InnoDB
</code>
chooses one for you, which can be
the first
<code class="literal">
UNIQUE
</code>
key defined on
<code class="literal">
NOT NULL
</code>
columns, or a system-generated
key. To avoid uncertainty and the potential space
requirement for an extra hidden column, specify the
<code class="literal">
PRIMARY KEY
</code>
clause as part of the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement.
</p>
<p>
MySQL creates a new clustered index by copying the existing
data from the original table to a temporary table that has
the desired index structure. Once the data is completely
copied to the temporary table, the original table is renamed
with a different temporary table name. The temporary table
comprising the new clustered index is renamed with the name
of the original table, and the original table is dropped
from the database.
</p>
<p>
The online performance enhancements that apply to operations
on secondary indexes do not apply to the primary key index.
The rows of an InnoDB table are stored in a
<a class="link" href="glossary.html#glos_clustered_index" title="clustered index">
clustered index
</a>
organized based on the
<a class="link" href="glossary.html#glos_primary_key" title="primary key">
primary key
</a>
, forming
what some database systems call an
<span class="quote">
“
<span class="quote">
index-organized
table
</span>
”
</span>
. Because the table structure is closely tied
to the primary key, redefining the primary key still
requires copying the data.
</p>
<p>
When an operation on the primary key uses
<code class="literal">
ALGORITHM=INPLACE
</code>
, even though the data
is still copied, it is more efficient than using
<code class="literal">
ALGORITHM=COPY
</code>
because:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
No undo logging or associated redo logging is required
for
<code class="literal">
ALGORITHM=INPLACE
</code>
. These
operations add overhead to DDL statements that use
<code class="literal">
ALGORITHM=COPY
</code>
.
</p>
</li>
<li class="listitem">
<p>
The secondary index entries are pre-sorted, and so can
be loaded in order.
</p>
</li>
<li class="listitem">
<p>
The change buffer is not used, because there are no
random-access inserts into the secondary indexes.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Dropping a primary key
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa47156673"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">DROP</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">COPY</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Only
<code class="literal">
ALGORITHM=COPY
</code>
supports dropping a
primary key without adding a new one in the same
<code class="literal">
ALTER TABLE
</code>
statement.
</p>
</li>
<li class="listitem">
<p>
Dropping a primary key and adding another
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa61068074"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">DROP</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">,</span> <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> <span class="token keyword">LOCK</span><span class="token operator">=</span><span class="token keyword">NONE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Data is reorganized substantially, making it an expensive
operation.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="online-ddl-column-operations">
</a>
Column Operations
</h4>
</div>
</div>
</div>
<p>
The following table provides an overview of online DDL support
for column operations. An asterisk indicates additional
information, an exception, or a dependency. For details, see
<a class="xref" href="innodb-online-ddl-operations.html#online-ddl-column-syntax-notes" title="Syntax and Usage Notes">
Syntax and Usage Notes
</a>
.
</p>
<div class="table">
<a name="online-ddl-column-operations-table">
</a>
<p class="title">
<b>
Table 17.17 Online DDL Support for Column Operations
</b>
</p>
<div class="table-contents">
<table summary="Online DDL support for column operations indicating whether the operation is performed in place, rebuilds the table, permits concurrent DML, or only modifies metadata.">
<colgroup>
<col align="left" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Operation
</th>
<th scope="col">
Instant
</th>
<th scope="col">
In Place
</th>
<th scope="col">
Rebuilds Table
</th>
<th scope="col">
Permits Concurrent DML
</th>
<th scope="col">
Only Modifies Metadata
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
Adding a column
</th>
<td>
Yes*
</td>
<td>
Yes
</td>
<td>
No*
</td>
<td>
Yes*
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
Dropping a column
</th>
<td>
Yes*
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
Renaming a column
</th>
<td>
Yes*
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
Yes*
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
Reordering columns
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Setting a column default value
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
Changing the column data type
</th>
<td>
No
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Extending
<code class="literal">
VARCHAR
</code>
column size
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
Dropping the column default value
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
Changing the auto-increment value
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
No*
</td>
</tr>
<tr>
<th scope="row">
Making a column
<code class="literal">
NULL
</code>
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes*
</td>
<td>
Yes
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Making a column
<code class="literal">
NOT NULL
</code>
</th>
<td>
No
</td>
<td>
Yes*
</td>
<td>
Yes*
</td>
<td>
Yes
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Modifying the definition of an
<code class="literal">
ENUM
</code>
or
<code class="literal">
SET
</code>
column
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 739px;">
<thead>
<tr>
<th scope="col" style="width: 123px;">
Operation
</th>
<th scope="col" style="width: 123px;">
Instant
</th>
<th scope="col" style="width: 123px;">
In Place
</th>
<th scope="col" style="width: 123px;">
Rebuilds Table
</th>
<th scope="col" style="width: 123px;">
Permits Concurrent DML
</th>
<th scope="col" style="width: 123px;">
Only Modifies Metadata
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<h5>
<a name="online-ddl-column-syntax-notes">
</a>
Syntax and Usage Notes
</h5>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Adding a column
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa10369623"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">COLUMN</span> <span class="token keyword"><em class="replaceable">column_name</em></span> <em class="replaceable">column_definition</em><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span>INSTANT<span class="token punctuation">;</span></code></pre>
</div>
<p>
<code class="literal">
INSTANT
</code>
is the default algorithm in MySQL
8.4.
</p>
<p>
The following limitations apply when the
<code class="literal">
INSTANT
</code>
algorithm adds a column:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
A statement cannot combine the addition of a column with
other
<code class="literal">
ALTER TABLE
</code>
actions that do not
support the
<code class="literal">
INSTANT
</code>
algorithm.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
INSTANT
</code>
algorithm can add a
column at any position in the table.
</p>
</li>
<li class="listitem">
<p>
Columns cannot be added to tables that use
<code class="literal">
ROW_FORMAT=COMPRESSED
</code>
, tables with a
<code class="literal">
FULLTEXT
</code>
index, tables that reside in
the data dictionary tablespace, or temporary tables.
Temporary tables only support
<code class="literal">
ALGORITHM=COPY
</code>
.
</p>
</li>
<li class="listitem">
<p>
MySQL checks the row size when the
<code class="literal">
INSTANT
</code>
algorithm adds a column, and
throws the following error if the addition exceeds the
limit.
</p>
<p>
<span class="errortext">
ERROR 4092 (HY000): Column can't be added
with ALGORITHM=INSTANT as after this max possible row
size crosses max permissible row size. Try
ALGORITHM=INPLACE/COPY.
</span>
</p>
</li>
<li class="listitem">
<p>
The maximum number of columns in the internal
representation of the table cannot exceed 1022 after
column addition with the
<code class="literal">
INSTANT
</code>
algorithm. The error message is:
</p>
<p>
<span class="errortext">
ERROR 4158 (HY000): Column can't be added to
<em class="replaceable">
<code>
tbl_name
</code>
</em>
with
ALGORITHM=INSTANT anymore. Please try
ALGORITHM=INPLACE/COPY
</span>
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
INSTANT
</code>
algorithm can not add or
drop columns to system schema tables, such as the
internal
<code class="literal">
mysql
</code>
table.
</p>
</li>
<li class="listitem">
<p>
A column with a functional index cannot be dropped using
the
<code class="literal">
INSTANT
</code>
algorithm.
</p>
</li>
</ul>
</div>
<p>
Multiple columns may be added in the same
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statement. For
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa91789871"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> t1 <span class="token keyword">ADD</span> <span class="token keyword">COLUMN</span> c2 <span class="token datatype">INT</span><span class="token punctuation">,</span> <span class="token keyword">ADD</span> <span class="token keyword">COLUMN</span> c3 <span class="token datatype">INT</span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span>INSTANT<span class="token punctuation">;</span></code></pre>
</div>
<p>
A new row version is created after each
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE ...
ALGORITHM=INSTANT
</code>
</a>
operation that adds one or more
columns, drops one or more columns, or adds and drops one or
more columns in the same operation. The
<code class="literal">
INFORMATION_SCHEMA.INNODB_TABLES.TOTAL_ROW_VERSIONS
</code>
column tracks the number of row versions for a table. The
value is incremented each time a column is instantly added
or dropped. The initial value is 0.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa54392439"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> TOTAL_ROW_VERSIONS <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_TABLES
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'test/t1'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> NAME <span class="token punctuation">|</span> TOTAL_ROW_VERSIONS <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> test/t1 <span class="token punctuation">|</span> 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></code></pre>
</div>
<p>
When a table with instantly added or dropped columns is
rebuilt by table-rebuilding
<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="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
operation, the
<code class="literal">
TOTAL_ROW_VERSIONS
</code>
value
is reset to 0. The maximum number of row versions permitted
is 64 (255 as of MySQL 9.1.0), as each row version requires
additional space for table metadata. When the row version
limit is reached,
<code class="literal">
ADD COLUMN
</code>
and
<code class="literal">
DROP COLUMN
</code>
operations using
<code class="literal">
ALGORITHM=INSTANT
</code>
are rejected with an
error message that recommends rebuilding the table using the
<code class="literal">
COPY
</code>
or
<code class="literal">
INPLACE
</code>
algorithm.
</p>
<p>
<span class="errortext">
ERROR 4080 (HY000): Maximum row versions reached
for table test/t1. No more columns can be added or dropped
instantly. Please use COPY/INPLACE.
</span>
</p>
<p>
The following
<a class="link" href="information-schema.html" title="Chapter 28 INFORMATION_SCHEMA Tables">
<code class="literal">
INFORMATION_SCHEMA
</code>
</a>
columns
provide additional metadata for instantly added columns.
Refer to the descriptions of those columns for more
information. See
<a class="xref" href="information-schema-innodb-columns-table.html" title="28.4.9 The INFORMATION_SCHEMA INNODB_COLUMNS Table">
Section 28.4.9, “The INFORMATION_SCHEMA INNODB_COLUMNS Table”
</a>
,
and
<a class="xref" href="information-schema-innodb-tables-table.html" title="28.4.23 The INFORMATION_SCHEMA INNODB_TABLES Table">
Section 28.4.23, “The INFORMATION_SCHEMA INNODB_TABLES Table”
</a>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
INNODB_COLUMNS.DEFAULT_VALUE
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
INNODB_COLUMNS.HAS_DEFAULT
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
INNODB_TABLES.INSTANT_COLS
</code>
</p>
</li>
</ul>
</div>
<p>
Concurrent DML is not permitted when adding an
<a class="link" href="glossary.html#glos_auto_increment" title="auto-increment">
auto-increment
</a>
column. Data is reorganized substantially, making it an
expensive operation. At a minimum,
<code class="literal">
ALGORITHM=INPLACE, LOCK=SHARED
</code>
is
required.
</p>
<p>
The table is rebuilt if
<code class="literal">
ALGORITHM=INPLACE
</code>
is used to add a column.
</p>
</li>
<li class="listitem">
<p>
Dropping a column
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa34816924"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">DROP</span> <span class="token keyword">COLUMN</span> <span class="token keyword"><em class="replaceable">column_name</em></span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span>INSTANT<span class="token punctuation">;</span></code></pre>
</div>
<p>
<code class="literal">
INSTANT
</code>
is the default algorithm in MySQL
8.4.
</p>
<p>
The following limitations apply when the
<code class="literal">
INSTANT
</code>
algorithm is used to drop a
column:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Dropping a column cannot be combined in the same
statement with other
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
actions that do not support
<code class="literal">
ALGORITHM=INSTANT
</code>
.
</p>
</li>
<li class="listitem">
<p>
Columns cannot be dropped from tables that use
<code class="literal">
ROW_FORMAT=COMPRESSED
</code>
, tables with a
<code class="literal">
FULLTEXT
</code>
index, tables that reside in
the data dictionary tablespace, or temporary tables.
Temporary tables only support
<code class="literal">
ALGORITHM=COPY
</code>
.
</p>
</li>
</ul>
</div>
<p>
Multiple columns may be dropped in the same
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statement; for
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa54432301"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> t1 <span class="token keyword">DROP</span> <span class="token keyword">COLUMN</span> c4<span class="token punctuation">,</span> <span class="token keyword">DROP</span> <span class="token keyword">COLUMN</span> c5<span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span>INSTANT<span class="token punctuation">;</span></code></pre>
</div>
<p>
Each time a column is added or dropped using
<code class="literal">
ALGORITHM=INSTANT
</code>
, a new row version is
created. The
<code class="literal">
INFORMATION_SCHEMA.INNODB_TABLES.TOTAL_ROW_VERSIONS
</code>
column tracks the number of row versions for a table. The
value is incremented each time a column is instantly added
or dropped. The initial value is 0.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa30898531"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> TOTAL_ROW_VERSIONS <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_TABLES
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'test/t1'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> NAME <span class="token punctuation">|</span> TOTAL_ROW_VERSIONS <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> test/t1 <span class="token punctuation">|</span> 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></code></pre>
</div>
<p>
When a table with instantly added or dropped columns is
rebuilt by table-rebuilding
<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="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
operation, the
<code class="literal">
TOTAL_ROW_VERSIONS
</code>
value
is reset to 0. The maximum number of row versions permitted
is 64 (255 as of MySQL 9.1.0), as each row version requires
additional space for table metadata. When the row version
limit is reached,
<code class="literal">
ADD COLUMN
</code>
and
<code class="literal">
DROP COLUMN
</code>
operations using
<code class="literal">
ALGORITHM=INSTANT
</code>
are rejected with an
error message that recommends rebuilding the table using the
<code class="literal">
COPY
</code>
or
<code class="literal">
INPLACE
</code>
algorithm.
</p>
<p>
<span class="errortext">
ERROR 4080 (HY000): Maximum row versions reached
for table test/t1. No more columns can be added or dropped
instantly. Please use COPY/INPLACE.
</span>
</p>
<p>
If an algorithm other than
<code class="literal">
ALGORITHM=INSTANT
</code>
is used, data is
reorganized substantially, making it an expensive operation.
</p>
</li>
<li class="listitem">
<p>
Renaming a column
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa5527649"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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</em> <span class="token keyword">CHANGE</span> <em class="replaceable">old_col_name</em> <em class="replaceable">new_col_name</em> <em class="replaceable">data_type</em><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span>INSTANT<span class="token punctuation">;</span></code></pre>
</div>
<p>
To permit concurrent DML, keep the same data type and only
change the column name.
</p>
<p>
When you keep the same data type and
<code class="literal">
[NOT]
NULL
</code>
attribute, only changing the column name, the
operation can always be performed online.
</p>
<p>
Renaming a column referenced from another table is only
permitted with
<code class="literal">
ALGORITHM=INPLACE
</code>
. If you
use
<code class="literal">
ALGORITHM=INSTANT
</code>
,
<code class="literal">
ALGORITHM=COPY
</code>
, or some other condition
that causes the operation to use those algorithms, the
<code class="literal">
ALTER TABLE
</code>
statement fails.
</p>
<p>
<code class="literal">
ALGORITHM=INSTANT
</code>
supports renaming a
virtual column;
<code class="literal">
ALGORITHM=INPLACE
</code>
does
not.
</p>
<p>
<code class="literal">
ALGORITHM=INSTANT
</code>
and
<code class="literal">
ALGORITHM=INPLACE
</code>
do not support renaming
a column when adding or dropping a virtual column in the
same statement. In this case, only
<code class="literal">
ALGORITHM=COPY
</code>
is supported.
</p>
</li>
<li class="listitem">
<p>
Reordering columns
</p>
<p>
To reorder columns, use
<code class="literal">
FIRST
</code>
or
<code class="literal">
AFTER
</code>
in
<code class="literal">
CHANGE
</code>
or
<code class="literal">
MODIFY
</code>
operations.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa89263936"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">MODIFY</span> <span class="token keyword">COLUMN</span> <em class="replaceable">col_name</em> <em class="replaceable">column_definition</em> <span class="token keyword">FIRST</span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">INPLACE</span><span class="token punctuation">,</span> <span class="token keyword">LOCK</span><span class="token operator">=</span><span class="token keyword">NONE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Data is reorganized substantially, making it an expensive
operation.
</p>
</li>
<li class="listitem">
<p>
Changing the column data type
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa32526800"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CHANGE</span> c1 c1 <span class="token datatype">BIGINT</span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">COPY</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Changing the column data type is only supported with
<code class="literal">
ALGORITHM=COPY
</code>
.
</p>
</li>
<li class="listitem">
<p>
Extending
<code class="literal">
VARCHAR
</code>
column size
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa23667998"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CHANGE</span> <span class="token keyword">COLUMN</span> c1 c1 <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">INPLACE</span><span class="token punctuation">,</span> <span class="token keyword">LOCK</span><span class="token operator">=</span><span class="token keyword">NONE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The number of length bytes required by a
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
column must remain
the same. For
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
columns
of 0 to 255 bytes in size, one length byte is required to
encode the value. For
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
columns of 256 bytes in size or more, two length bytes are
required. As a result, in-place
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
only supports increasing
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
column size from 0 to
255 bytes, or from 256 bytes to a greater size. In-place
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
does not support
increasing the size of a
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
column from less than
256 bytes to a size equal to or greater than 256 bytes. In
this case, the number of required length bytes changes from
1 to 2, which is only supported by a table copy
(
<code class="literal">
ALGORITHM=COPY
</code>
). For example, attempting
to change
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
column size
for a single byte character set from VARCHAR(255) to
VARCHAR(256) using in-place
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
returns this error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa79198572"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">INPLACE</span><span class="token punctuation">,</span> <span class="token keyword">CHANGE</span> <span class="token keyword">COLUMN</span> c1 c1 <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">256</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 0A000<span class="token punctuation">:</span> ALGORITHM=INPLACE is not supported. Reason<span class="token punctuation">:</span> Cannot change
column type INPLACE. Try ALGORITHM=COPY.</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The byte length of a
<code class="literal">
VARCHAR
</code>
column is
dependant on the byte length of the character set.
</p>
</div>
<p>
Decreasing
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
size using
in-place
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
is not
supported. Decreasing
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
size requires a table copy
(
<code class="literal">
ALGORITHM=COPY
</code>
).
</p>
</li>
<li class="listitem">
<p>
Setting a column default value
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa13401106"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">ALTER</span> <span class="token keyword">COLUMN</span> <em class="replaceable">col</em> <span class="token keyword">SET</span> <span class="token keyword">DEFAULT</span> <em class="replaceable">literal</em><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span>INSTANT<span class="token punctuation">;</span></code></pre>
</div>
<p>
Only modifies table metadata. Default column values are
stored in the
<a class="link" href="glossary.html#glos_data_dictionary" title="data dictionary">
data
dictionary
</a>
.
</p>
</li>
<li class="listitem">
<p>
Dropping a column default value
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa67883281"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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</em> <span class="token keyword">ALTER</span> <span class="token keyword">COLUMN</span> <em class="replaceable">col</em> <span class="token keyword">DROP</span> <span class="token keyword">DEFAULT</span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span>INSTANT<span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Changing the auto-increment value
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa61027218"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> <span class="token keyword"><em class="replaceable">table</em></span> <span class="token keyword">AUTO_INCREMENT</span><span class="token operator">=</span><em class="replaceable">next_value</em><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">INPLACE</span><span class="token punctuation">,</span> <span class="token keyword">LOCK</span><span class="token operator">=</span><span class="token keyword">NONE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Modifies a value stored in memory, not the data file.
</p>
<p>
In a distributed system using replication or sharding, you
sometimes reset the auto-increment counter for a table to a
specific value. The next row inserted into the table uses
the specified value for its auto-increment column. You might
also use this technique in a data warehousing environment
where you periodically empty all the tables and reload them,
and restart the auto-increment sequence from 1.
</p>
</li>
<li class="listitem">
<p>
Making a column
<code class="literal">
NULL
</code>
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa16475298"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> tbl_name <span class="token keyword">MODIFY</span> <span class="token keyword">COLUMN</span> <span class="token keyword"><em class="replaceable">column_name</em></span> <em class="replaceable">data_type</em> <span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">INPLACE</span><span class="token punctuation">,</span> <span class="token keyword">LOCK</span><span class="token operator">=</span><span class="token keyword">NONE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Rebuilds the table in place. Data is reorganized
substantially, making it an expensive operation.
</p>
</li>
<li class="listitem">
<p>
Making a column
<code class="literal">
NOT NULL
</code>
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa64091350"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">MODIFY</span> <span class="token keyword">COLUMN</span> <span class="token keyword"><em class="replaceable">column_name</em></span> <em class="replaceable">data_type</em> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">INPLACE</span><span class="token punctuation">,</span> <span class="token keyword">LOCK</span><span class="token operator">=</span><span class="token keyword">NONE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Rebuilds the table in place.
<code class="literal">
STRICT_ALL_TABLES
</code>
or
<code class="literal">
STRICT_TRANS_TABLES
</code>
<a class="link" href="server-system-variables.html#sysvar_sql_mode">
<code class="literal">
SQL_MODE
</code>
</a>
is required for
the operation to succeed. The operation fails if the column
contains NULL values. The server prohibits changes to
foreign key columns that have the potential to cause loss of
referential integrity. See
<a class="xref" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
Section 15.1.9, “ALTER TABLE Statement”
</a>
.
Data is reorganized substantially, making it an expensive
operation.
</p>
</li>
<li class="listitem">
<p>
Modifying the definition of an
<code class="literal">
ENUM
</code>
or
<code class="literal">
SET
</code>
column
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa55734134"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>c1 <span class="token datatype">ENUM</span><span class="token punctuation">(</span><span class="token string">'a'</span><span class="token punctuation">,</span> <span class="token string">'b'</span><span class="token punctuation">,</span> <span class="token string">'c'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">MODIFY</span> <span class="token keyword">COLUMN</span> c1 <span class="token datatype">ENUM</span><span class="token punctuation">(</span><span class="token string">'a'</span><span class="token punctuation">,</span> <span class="token string">'b'</span><span class="token punctuation">,</span> <span class="token string">'c'</span><span class="token punctuation">,</span> <span class="token string">'d'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span>INSTANT<span class="token punctuation">;</span></code></pre>
</div>
<p>
Modifying the definition of an
<a class="link" href="enum.html" title="13.3.5 The ENUM Type">
<code class="literal">
ENUM
</code>
</a>
or
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
column by adding new
enumeration or set members to the
<span class="emphasis">
<em>
end
</em>
</span>
of the list of valid member values may be performed
instantly or in place, as long as the storage size of the
data type does not change. For example, adding a member to a
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
column that has 8 members
changes the required storage per value from 1 byte to 2
bytes; this requires a table copy. Adding members in the
middle of the list causes renumbering of existing members,
which requires a table copy.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="online-ddl-generated-column-operations">
</a>
Generated Column Operations
</h4>
</div>
</div>
</div>
<p>
The following table provides an overview of online DDL support
for generated column operations. For details, see
<a class="xref" href="innodb-online-ddl-operations.html#online-ddl-generated-column-syntax-notes" title="Syntax and Usage Notes">
Syntax and Usage Notes
</a>
.
</p>
<div class="table">
<a name="online-ddl-generated-column-operations-table">
</a>
<p class="title">
<b>
Table 17.18 Online DDL Support for Generated Column Operations
</b>
</p>
<div class="table-contents">
<table summary="Online DDL support for generated column operations indicating whether the operation is performed in place, rebuilds the table, permits concurrent DML, or only modifies metadata.">
<colgroup>
<col align="left" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Operation
</th>
<th scope="col">
Instant
</th>
<th scope="col">
In Place
</th>
<th scope="col">
Rebuilds Table
</th>
<th scope="col">
Permits Concurrent DML
</th>
<th scope="col">
Only Modifies Metadata
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
Adding a
<code class="literal">
STORED
</code>
column
</th>
<td>
No
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Modifying
<code class="literal">
STORED
</code>
column order
</th>
<td>
No
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Dropping a
<code class="literal">
STORED
</code>
column
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Adding a
<code class="literal">
VIRTUAL
</code>
column
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
Modifying
<code class="literal">
VIRTUAL
</code>
column order
</th>
<td>
No
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Dropping a
<code class="literal">
VIRTUAL
</code>
column
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<h5>
<a name="online-ddl-generated-column-syntax-notes">
</a>
Syntax and Usage Notes
</h5>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Adding a
<code class="literal">
STORED
</code>
column
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa43539850"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> t1 <span class="token keyword">ADD</span> <span class="token keyword">COLUMN</span> <span class="token punctuation">(</span>c2 <span class="token datatype">INT</span> <span class="token keyword">GENERATED</span> <span class="token keyword">ALWAYS</span> <span class="token keyword">AS</span> <span class="token punctuation">(</span>c1 <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">)</span> <span class="token keyword">STORED</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">COPY</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<code class="literal">
ADD COLUMN
</code>
is not an in-place operation
for stored columns (done without using a temporary table)
because the expression must be evaluated by the server.
</p>
</li>
<li class="listitem">
<p>
Modifying
<code class="literal">
STORED
</code>
column order
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa36157760"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> t1 <span class="token keyword">MODIFY</span> <span class="token keyword">COLUMN</span> c2 <span class="token datatype">INT</span> <span class="token keyword">GENERATED</span> <span class="token keyword">ALWAYS</span> <span class="token keyword">AS</span> <span class="token punctuation">(</span>c1 <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">)</span> <span class="token keyword">STORED</span> <span class="token keyword">FIRST</span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">COPY</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Rebuilds the table in place.
</p>
</li>
<li class="listitem">
<p>
Dropping a
<code class="literal">
STORED
</code>
column
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa37816791"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> t1 <span class="token keyword">DROP</span> <span class="token keyword">COLUMN</span> c2<span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">INPLACE</span><span class="token punctuation">,</span> <span class="token keyword">LOCK</span><span class="token operator">=</span><span class="token keyword">NONE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Rebuilds the table in place.
</p>
</li>
<li class="listitem">
<p>
Adding a
<code class="literal">
VIRTUAL
</code>
column
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa72759313"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> t1 <span class="token keyword">ADD</span> <span class="token keyword">COLUMN</span> <span class="token punctuation">(</span>c2 <span class="token datatype">INT</span> <span class="token keyword">GENERATED</span> <span class="token keyword">ALWAYS</span> <span class="token keyword">AS</span> <span class="token punctuation">(</span>c1 <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">)</span> <span class="token keyword">VIRTUAL</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span>INSTANT<span class="token punctuation">;</span></code></pre>
</div>
<p>
Adding a virtual column can be performed instantly or in
place for non-partitioned tables.
</p>
<p>
Adding a
<code class="literal">
VIRTUAL
</code>
is not an in-place
operation for partitioned tables.
</p>
</li>
<li class="listitem">
<p>
Modifying
<code class="literal">
VIRTUAL
</code>
column order
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa47570332"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> t1 <span class="token keyword">MODIFY</span> <span class="token keyword">COLUMN</span> c2 <span class="token datatype">INT</span> <span class="token keyword">GENERATED</span> <span class="token keyword">ALWAYS</span> <span class="token keyword">AS</span> <span class="token punctuation">(</span>c1 <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">)</span> <span class="token keyword">VIRTUAL</span> <span class="token keyword">FIRST</span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">COPY</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Dropping a
<code class="literal">
VIRTUAL
</code>
column
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa45042535"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> t1 <span class="token keyword">DROP</span> <span class="token keyword">COLUMN</span> c2<span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span>INSTANT<span class="token punctuation">;</span></code></pre>
</div>
<p>
Dropping a
<code class="literal">
VIRTUAL
</code>
column can be
performed instantly or in place for non-partitioned tables.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="online-ddl-foreign-key-operations">
</a>
Foreign Key Operations
</h4>
</div>
</div>
</div>
<p>
The following table provides an overview of online DDL support
for foreign key operations. An asterisk indicates additional
information, an exception, or a dependency. For details, see
<a class="xref" href="innodb-online-ddl-operations.html#online-ddl-foreign-key-syntax-notes" title="Syntax and Usage Notes">
Syntax and Usage Notes
</a>
.
</p>
<div class="table">
<a name="online-ddl-foreign-key-operations-table">
</a>
<p class="title">
<b>
Table 17.19 Online DDL Support for Foreign Key Operations
</b>
</p>
<div class="table-contents">
<table summary="Online DDL support for foreign key operations indicating whether the operation is performed in place, rebuilds the table, permits concurrent DML, or only modifies metadata.">
<colgroup>
<col align="left" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Operation
</th>
<th scope="col">
Instant
</th>
<th scope="col">
In Place
</th>
<th scope="col">
Rebuilds Table
</th>
<th scope="col">
Permits Concurrent DML
</th>
<th scope="col">
Only Modifies Metadata
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
Adding a foreign key constraint
</th>
<td>
No
</td>
<td>
Yes*
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
Dropping a foreign key constraint
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<h5>
<a name="online-ddl-foreign-key-syntax-notes">
</a>
Syntax and Usage Notes
</h5>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Adding a foreign key constraint
</p>
<p>
The
<code class="literal">
INPLACE
</code>
algorithm is supported when
<a class="link" href="server-system-variables.html#sysvar_foreign_key_checks">
<code class="literal">
foreign_key_checks
</code>
</a>
is
disabled. Otherwise, only the
<code class="literal">
COPY
</code>
algorithm is supported.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa79255447"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">tbl1</em> <span class="token keyword">ADD</span> <span class="token keyword">CONSTRAINT</span> <em class="replaceable">fk_name</em> <span class="token keyword">FOREIGN</span> <span class="token keyword">KEY</span> <span class="token keyword"><em class="replaceable">index</em></span> <span class="token punctuation">(</span><em class="replaceable">col1</em><span class="token punctuation">)</span>
<span class="token keyword">REFERENCES</span> <em class="replaceable">tbl2</em><span class="token punctuation">(</span><em class="replaceable">col2</em><span class="token punctuation">)</span> <em class="replaceable">referential_actions</em><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Dropping a foreign key constraint
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa87959640"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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</em> <span class="token keyword">DROP</span> <span class="token keyword">FOREIGN</span> <span class="token keyword">KEY</span> <em class="replaceable">fk_name</em><span class="token punctuation">;</span></code></pre>
</div>
<p>
Dropping a foreign key can be performed online with the
<a class="link" href="server-system-variables.html#sysvar_foreign_key_checks">
<code class="literal">
foreign_key_checks
</code>
</a>
option
enabled or disabled.
</p>
<p>
If you do not know the names of the foreign key constraints
on a particular table, issue the following statement and
find the constraint name in the
<code class="literal">
CONSTRAINT
</code>
clause for each foreign key:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa49579196"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CREATE</span> <span class="token keyword">TABLE</span> <span class="token keyword"><em class="replaceable">table</em></span>\G</code></pre>
</div>
<p>
Or, query the Information Schema
<a class="link" href="information-schema-table-constraints-table.html" title="28.3.41 The INFORMATION_SCHEMA TABLE_CONSTRAINTS Table">
<code class="literal">
TABLE_CONSTRAINTS
</code>
</a>
table and use
the
<code class="literal">
CONSTRAINT_NAME
</code>
and
<code class="literal">
CONSTRAINT_TYPE
</code>
columns to identify the
foreign key names.
</p>
<p>
You can also drop a foreign key and its associated index in
a single statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa7862575"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> <span class="token keyword"><em class="replaceable">table</em></span> <span class="token keyword">DROP</span> <span class="token keyword">FOREIGN</span> <span class="token keyword">KEY</span> <span class="token keyword"><em class="replaceable">constraint</em></span><span class="token punctuation">,</span> <span class="token keyword">DROP</span> <span class="token keyword">INDEX</span> <span class="token keyword"><em class="replaceable">index</em></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>
If
<a class="link" href="glossary.html#glos_foreign_key" title="foreign key">
foreign keys
</a>
are
already present in the table being altered (that is, it is a
<a class="link" href="glossary.html#glos_child_table" title="child table">
child table
</a>
containing
a
<code class="literal">
FOREIGN KEY ... REFERENCE
</code>
clause),
additional restrictions apply to online DDL operations, even
those not directly involving the foreign key columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
An
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
on the child
table could wait for another transaction to commit, if a
change to the parent table causes associated changes in
the child table through an
<code class="literal">
ON UPDATE
</code>
or
<code class="literal">
ON DELETE
</code>
clause using the
<code class="literal">
CASCADE
</code>
or
<code class="literal">
SET NULL
</code>
parameters.
</p>
</li>
<li class="listitem">
<p>
In the same way, if a table is the
<a class="link" href="glossary.html#glos_parent_table" title="parent table">
parent table
</a>
in a
foreign key relationship, even though it does not contain
any
<code class="literal">
FOREIGN KEY
</code>
clauses, it could wait
for the
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
to
complete if an
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
,
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
, or
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statement causes an
<code class="literal">
ON UPDATE
</code>
or
<code class="literal">
ON
DELETE
</code>
action in the child table.
</p>
</li>
</ul>
</div>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="online-ddl-table-operations">
</a>
Table Operations
</h4>
</div>
</div>
</div>
<p>
The following table provides an overview of online DDL support
for table operations. An asterisk indicates additional
information, an exception, or a dependency. For details, see
<a class="xref" href="innodb-online-ddl-operations.html#online-ddl-table-syntax-notes" title="Syntax and Usage Notes">
Syntax and Usage Notes
</a>
.
</p>
<div class="table">
<a name="online-ddl-table-operations-table">
</a>
<p class="title">
<b>
Table 17.20 Online DDL Support for Table Operations
</b>
</p>
<div class="table-contents">
<table summary="Online DDL support for table operations indicating whether the operation is performed in place, rebuilds the table, permits concurrent DML, or only modifies metadata.">
<colgroup>
<col align="left" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Operation
</th>
<th scope="col">
Instant
</th>
<th scope="col">
In Place
</th>
<th scope="col">
Rebuilds Table
</th>
<th scope="col">
Permits Concurrent DML
</th>
<th scope="col">
Only Modifies Metadata
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
Changing the
<code class="literal">
ROW_FORMAT
</code>
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Changing the
<code class="literal">
KEY_BLOCK_SIZE
</code>
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Setting persistent table statistics
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
Specifying a character set
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes*
</td>
<td>
Yes
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Converting a character set
</th>
<td>
No
</td>
<td>
No
</td>
<td>
Yes*
</td>
<td>
No
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Optimizing a table
</th>
<td>
No
</td>
<td>
Yes*
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Rebuilding with the
<code class="literal">
FORCE
</code>
option
</th>
<td>
No
</td>
<td>
Yes*
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Performing a null rebuild
</th>
<td>
No
</td>
<td>
Yes*
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Renaming a table
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<h5>
<a name="online-ddl-table-syntax-notes">
</a>
Syntax and Usage Notes
</h5>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Changing the
<code class="literal">
ROW_FORMAT
</code>
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa57524705"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">ROW_FORMAT</span> <span class="token operator">=</span> <span class="token keyword"><em class="replaceable">row_format</em></span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">INPLACE</span><span class="token punctuation">,</span> <span class="token keyword">LOCK</span><span class="token operator">=</span><span class="token keyword">NONE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Data is reorganized substantially, making it an expensive
operation.
</p>
<p>
For additional information about the
<code class="literal">
ROW_FORMAT
</code>
option, see
<a class="xref" href="create-table.html#create-table-options" title="Table Options">
Table Options
</a>
.
</p>
</li>
<li class="listitem">
<p>
Changing the
<code class="literal">
KEY_BLOCK_SIZE
</code>
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa81677453"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">KEY_BLOCK_SIZE</span> <span class="token operator">=</span> <span class="token keyword"><em class="replaceable">value</em></span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">INPLACE</span><span class="token punctuation">,</span> <span class="token keyword">LOCK</span><span class="token operator">=</span><span class="token keyword">NONE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Data is reorganized substantially, making it an expensive
operation.
</p>
<p>
For additional information about the
<code class="literal">
KEY_BLOCK_SIZE
</code>
option, see
<a class="xref" href="create-table.html#create-table-options" title="Table Options">
Table Options
</a>
.
</p>
</li>
<li class="listitem">
<p>
Setting persistent table statistics options
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa93841705"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">STATS_PERSISTENT</span><span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token keyword">STATS_SAMPLE_PAGES</span><span class="token operator">=</span><span class="token number">20</span><span class="token punctuation">,</span> <span class="token keyword">STATS_AUTO_RECALC</span><span class="token operator">=</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">INPLACE</span><span class="token punctuation">,</span> <span class="token keyword">LOCK</span><span class="token operator">=</span><span class="token keyword">NONE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Only modifies table metadata.
</p>
<p>
Persistent statistics include
<code class="literal">
STATS_PERSISTENT
</code>
,
<code class="literal">
STATS_AUTO_RECALC
</code>
, and
<code class="literal">
STATS_SAMPLE_PAGES
</code>
. For more information,
see
<a class="xref" href="innodb-persistent-stats.html" title="17.8.10.1 Configuring Persistent Optimizer Statistics Parameters">
Section 17.8.10.1, “Configuring Persistent Optimizer Statistics Parameters”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Specifying a character set
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa74970790"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CHARACTER</span> <span class="token keyword">SET</span> <span class="token operator">=</span> <em class="replaceable">charset_name</em><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">INPLACE</span><span class="token punctuation">,</span> <span class="token keyword">LOCK</span><span class="token operator">=</span><span class="token keyword">NONE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Rebuilds the table if the new character encoding is
different.
</p>
</li>
<li class="listitem">
<p>
Converting a character set
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa33225729"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> CONVERT <span class="token keyword">TO</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> <em class="replaceable">charset_name</em><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">COPY</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Rebuilds the table if the new character encoding is
different.
</p>
</li>
<li class="listitem">
<p>
Optimizing a table
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa67914549"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">OPTIMIZE</span> <span class="token keyword">TABLE</span> <em class="replaceable">tbl_name</em><span class="token punctuation">;</span></code></pre>
</div>
<p>
In-place operation is not supported for tables with
<code class="literal">
FULLTEXT
</code>
indexes. The operation uses the
<code class="literal">
INPLACE
</code>
algorithm, but
<code class="literal">
ALGORITHM
</code>
and
<code class="literal">
LOCK
</code>
syntax is not permitted.
</p>
</li>
<li class="listitem">
<p>
Rebuilding a table with the
<code class="literal">
FORCE
</code>
option
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa70301573"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">FORCE</span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">INPLACE</span><span class="token punctuation">,</span> <span class="token keyword">LOCK</span><span class="token operator">=</span><span class="token keyword">NONE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Uses
<code class="literal">
ALGORITHM=INPLACE
</code>
as of MySQL
5.6.17
<code class="literal">
</code>
.
<code class="literal">
ALGORITHM=INPLACE
</code>
is
not supported for tables with
<code class="literal">
FULLTEXT
</code>
indexes.
</p>
</li>
<li class="listitem">
<p>
Performing a "null" rebuild
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa44588404"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">ENGINE</span><span class="token operator">=</span>InnoDB<span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">INPLACE</span><span class="token punctuation">,</span> <span class="token keyword">LOCK</span><span class="token operator">=</span><span class="token keyword">NONE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Uses
<code class="literal">
ALGORITHM=INPLACE
</code>
as of MySQL
5.6.17.
<code class="literal">
ALGORITHM=INPLACE
</code>
is not
supported for tables with
<code class="literal">
FULLTEXT
</code>
indexes.
</p>
</li>
<li class="listitem">
<p>
Renaming a table
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa61403780"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">old_tbl_name</em> <span class="token keyword">RENAME</span> <span class="token keyword">TO</span> <em class="replaceable">new_tbl_name</em><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span>INSTANT<span class="token punctuation">;</span></code></pre>
</div>
<p>
Renaming a table can be performed instantly or in place.
MySQL renames files that correspond to the table
<em class="replaceable">
<code>
tbl_name
</code>
</em>
without making a copy.
(You can also use the
<a class="link" href="rename-table.html" title="15.1.36 RENAME TABLE Statement">
<code class="literal">
RENAME
TABLE
</code>
</a>
statement to rename tables. See
<a class="xref" href="rename-table.html" title="15.1.36 RENAME TABLE Statement">
Section 15.1.36, “RENAME TABLE Statement”
</a>
.) Privileges granted
specifically for the renamed table are not migrated to the
new name. They must be changed manually.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="online-ddl-tablespace-operations">
</a>
Tablespace Operations
</h4>
</div>
</div>
</div>
<p>
The following table provides an overview of online DDL support
for tablespace operations. For details, see
<a class="xref" href="innodb-online-ddl-operations.html#online-ddl-tablespace-syntax-notes" title="Syntax and Usage Notes">
Syntax and Usage Notes
</a>
.
</p>
<div class="table">
<a name="online-ddl-tablespace-operations-table">
</a>
<p class="title">
<b>
Table 17.21 Online DDL Support for Tablespace Operations
</b>
</p>
<div class="table-contents">
<table summary="Online DDL support for tablespace operations indicating whether the operation is performed in place, rebuilds tables within the tablespace, permits concurrent DML, or only modifies metadata.">
<colgroup>
<col align="left" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Operation
</th>
<th scope="col">
Instant
</th>
<th scope="col">
In Place
</th>
<th scope="col">
Rebuilds Table
</th>
<th scope="col">
Permits Concurrent DML
</th>
<th scope="col">
Only Modifies Metadata
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
Renaming a general tablespace
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
Enabling or disabling general tablespace encryption
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
No
</td>
</tr>
<tr>
<th scope="row">
Enabling or disabling file-per-table tablespace encryption
</th>
<td>
No
</td>
<td>
No
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
No
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<h5>
<a name="online-ddl-tablespace-syntax-notes">
</a>
Syntax and Usage Notes
</h5>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Renaming a general tablespace
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa14365910"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">TABLESPACE</span> <em class="replaceable">tablespace_name</em> <span class="token keyword">RENAME</span> <span class="token keyword">TO</span> <em class="replaceable">new_tablespace_name</em><span class="token punctuation">;</span></code></pre>
</div>
<p>
<a class="link" href="alter-tablespace.html" title="15.1.10 ALTER TABLESPACE Statement">
<code class="literal">
ALTER
TABLESPACE ... RENAME TO
</code>
</a>
uses the
<code class="literal">
INPLACE
</code>
algorithm but does not support
the
<code class="literal">
ALGORITHM
</code>
clause.
</p>
</li>
<li class="listitem">
<p>
Enabling or disabling general tablespace encryption
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa60127475"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">TABLESPACE</span> <em class="replaceable">tablespace_name</em> <span class="token keyword">ENCRYPTION</span><span class="token operator">=</span><span class="token string">'Y'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<a class="link" href="alter-tablespace.html" title="15.1.10 ALTER TABLESPACE Statement">
<code class="literal">
ALTER
TABLESPACE ... ENCRYPTION
</code>
</a>
uses the
<code class="literal">
INPLACE
</code>
algorithm but does not support
the
<code class="literal">
ALGORITHM
</code>
clause.
</p>
<p>
For related information, see
<a class="xref" href="innodb-data-encryption.html" title="17.13 InnoDB Data-at-Rest Encryption">
Section 17.13, “InnoDB Data-at-Rest Encryption”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Enabling or disabling file-per-table tablespace encryption
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa18482847"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">ENCRYPTION</span><span class="token operator">=</span><span class="token string">'Y'</span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">COPY</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For related information, see
<a class="xref" href="innodb-data-encryption.html" title="17.13 InnoDB Data-at-Rest Encryption">
Section 17.13, “InnoDB Data-at-Rest Encryption”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="online-ddl-partitioning">
</a>
Partitioning Operations
</h4>
</div>
</div>
</div>
<p>
With the exception of some
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
partitioning clauses, online DDL operations for
partitioned
<code class="literal">
InnoDB
</code>
tables follow the same
rules that apply to regular
<code class="literal">
InnoDB
</code>
tables.
</p>
<p>
Some
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
partitioning
clauses do not go through the same internal online DDL API as
regular non-partitioned
<code class="literal">
InnoDB
</code>
tables. As a
result, online support for
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
partitioning clauses varies.
</p>
<p>
The following table shows the online status for each
<code class="literal">
ALTER TABLE
</code>
partitioning statement.
Regardless of the online DDL API that is used, MySQL attempts to
minimize data copying and locking where possible.
</p>
<p>
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
partitioning options
that use
<code class="literal">
ALGORITHM=COPY
</code>
or that only permit
<span class="quote">
“
<span class="quote">
<code class="literal">
ALGORITHM=DEFAULT,
LOCK=DEFAULT
</code>
</span>
”
</span>
, repartition the table using the
<code class="literal">
COPY
</code>
algorithm. In other words, a new
partitioned table is created with the new partitioning scheme.
The newly created table includes any changes applied by the
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statement, and table
data is copied into the new table structure.
</p>
<div class="table">
<a name="innodb-online-ddl-partitioning-clauses">
</a>
<p class="title">
<b>
Table 17.22 Online DDL Support for Partitioning Operations
</b>
</p>
<div class="table-contents">
<table summary="Online DDL support for partitioning operations indicating whether the operation is performed in place and permits concurrent DML.">
<colgroup>
<col align="left" style="width: 24%"/>
<col align="center" style="width: 8%"/>
<col align="center" style="width: 8%"/>
<col align="center" style="width: 12%"/>
<col align="left" style="width: 32%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Partitioning Clause
</th>
<th scope="col">
Instant
</th>
<th scope="col">
In Place
</th>
<th scope="col">
Permits DML
</th>
<th scope="col">
Notes
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
PARTITION BY
</code>
</a>
</th>
<td>
No
</td>
<td>
No
</td>
<td>
No
</td>
<td>
Permits
<code class="literal">
ALGORITHM=COPY
</code>
,
<code class="literal">
LOCK={DEFAULT|SHARED|EXCLUSIVE}
</code>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ADD PARTITION
</code>
</a>
</th>
<td>
No
</td>
<td>
Yes*
</td>
<td>
Yes*
</td>
<td>
<code class="literal">
ALGORITHM=INPLACE,
LOCK={DEFAULT|NONE|SHARED|EXCLUSISVE}
</code>
is
supported for
<code class="literal">
RANGE
</code>
and
<code class="literal">
LIST
</code>
partitions,
<code class="literal">
ALGORITHM=INPLACE,
LOCK={DEFAULT|SHARED|EXCLUSISVE}
</code>
for
<code class="literal">
HASH
</code>
and
<code class="literal">
KEY
</code>
partitions, and
<code class="literal">
ALGORITHM=COPY,
LOCK={SHARED|EXCLUSIVE}
</code>
for all partition types.
Does not copy existing data for tables partitioned by
<code class="literal">
RANGE
</code>
or
<code class="literal">
LIST
</code>
.
Concurrent queries are permitted with
<code class="literal">
ALGORITHM=COPY
</code>
for tables partitioned
by
<code class="literal">
HASH
</code>
or
<code class="literal">
LIST
</code>
, as
MySQL copies the data while holding a shared lock.
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
DROP PARTITION
</code>
</a>
</th>
<td>
No
</td>
<td>
Yes*
</td>
<td>
Yes*
</td>
<td>
<p>
<code class="literal">
ALGORITHM=INPLACE,
LOCK={DEFAULT|NONE|SHARED|EXCLUSIVE}
</code>
is
supported. Does not copy data for tables partitioned by
<code class="literal">
RANGE
</code>
or
<code class="literal">
LIST
</code>
.
</p>
<p>
<code class="literal">
DROP PARTITION
</code>
with
<code class="literal">
ALGORITHM=INPLACE
</code>
deletes data stored
in the partition and drops the partition. However,
<code class="literal">
DROP PARTITION
</code>
with
<code class="literal">
ALGORITHM=COPY
</code>
or
<a class="link" href="server-system-variables.html#sysvar_old_alter_table">
<code class="literal">
old_alter_table=ON
</code>
</a>
rebuilds the partitioned table and attempts to move data
from the dropped partition to another partition with a
compatible
<code class="literal">
PARTITION ... VALUES
</code>
definition. Data that cannot be moved to another
partition is deleted.
</p>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
DISCARD PARTITION
</code>
</a>
</th>
<td>
No
</td>
<td>
No
</td>
<td>
No
</td>
<td>
Only permits
<code class="literal">
ALGORITHM=DEFAULT
</code>
,
<code class="literal">
LOCK=DEFAULT
</code>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
IMPORT PARTITION
</code>
</a>
</th>
<td>
No
</td>
<td>
No
</td>
<td>
No
</td>
<td>
Only permits
<code class="literal">
ALGORITHM=DEFAULT
</code>
,
<code class="literal">
LOCK=DEFAULT
</code>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
TRUNCATE
PARTITION
</code>
</a>
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Does not copy existing data. It merely deletes rows; it does not alter
the definition of the table itself, or of any of its
partitions.
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
COALESCE
PARTITION
</code>
</a>
</th>
<td>
No
</td>
<td>
Yes*
</td>
<td>
No
</td>
<td>
<code class="literal">
ALGORITHM=INPLACE, LOCK={DEFAULT|SHARED|EXCLUSIVE}
</code>
is
supported.
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
REORGANIZE
PARTITION
</code>
</a>
</th>
<td>
No
</td>
<td>
Yes*
</td>
<td>
No
</td>
<td>
<code class="literal">
ALGORITHM=INPLACE, LOCK={DEFAULT|SHARED|EXCLUSIVE}
</code>
is
supported.
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
EXCHANGE
PARTITION
</code>
</a>
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ANALYZE PARTITION
</code>
</a>
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
CHECK PARTITION
</code>
</a>
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
OPTIMIZE
PARTITION
</code>
</a>
</th>
<td>
No
</td>
<td>
No
</td>
<td>
No
</td>
<td>
<code class="literal">
ALGORITHM
</code>
and
<code class="literal">
LOCK
</code>
clauses are
ignored. Rebuilds the entire table. See
<a class="xref" href="partitioning-maintenance.html" title="26.3.4 Maintenance of Partitions">
Section 26.3.4, “Maintenance of Partitions”
</a>
.
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
REBUILD PARTITION
</code>
</a>
</th>
<td>
No
</td>
<td>
Yes*
</td>
<td>
No
</td>
<td>
<code class="literal">
ALGORITHM=INPLACE, LOCK={DEFAULT|SHARED|EXCLUSIVE}
</code>
is
supported.
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
REPAIR PARTITION
</code>
</a>
</th>
<td>
No
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
REMOVE
PARTITIONING
</code>
</a>
</th>
<td>
No
</td>
<td>
No
</td>
<td>
No
</td>
<td>
Permits
<code class="literal">
ALGORITHM=COPY
</code>
,
<code class="literal">
LOCK={DEFAULT|SHARED|EXCLUSIVE}
</code>
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 739px;">
<thead>
<tr>
<th scope="col" style="width: 202.031px;">
Partitioning Clause
</th>
<th scope="col" style="width: 67.3281px;">
Instant
</th>
<th scope="col" style="width: 67.3281px;">
In Place
</th>
<th scope="col" style="width: 101px;">
Permits DML
</th>
<th scope="col" style="width: 300.312px;">
Notes
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<p>
Non-partitioning online
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
operations on partitioned tables follow the same
rules that apply to regular tables. However,
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
performs online
operations on each table partition, which causes increased
demand on system resources due to operations being performed on
multiple partitions.
</p>
<p>
For additional information about
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
partitioning clauses, see
<a class="xref" href="alter-table.html#alter-table-partition-options" title="Partitioning Options">
Partitioning Options
</a>
, and
<a class="xref" href="alter-table-partition-operations.html" title="15.1.9.1 ALTER TABLE Partition Operations">
Section 15.1.9.1, “ALTER TABLE Partition Operations”
</a>
. For
information about partitioning in general, see
<a class="xref" href="partitioning.html" title="Chapter 26 Partitioning">
Chapter 26,
<i>
Partitioning
</i>
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/keyring-plugin-installation.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="keyring-plugin-installation">
</a>
8.4.4.3 Keyring Plugin Installation
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045240888256">
</a>
<a class="indexterm" name="idm46045240886768">
</a>
<a class="indexterm" name="idm46045240885280">
</a>
<a class="indexterm" name="idm46045240883792">
</a>
<a class="indexterm" name="idm46045240882304">
</a>
<a class="indexterm" name="idm46045240880800">
</a>
<p>
Keyring service consumers require that a keyring component or
plugin be installed:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
To use a keyring plugin, begin with the instructions here.
(Also, for general information about installing plugins, see
<a class="xref" href="plugin-loading.html" title="7.6.1 Installing and Uninstalling Plugins">
Section 7.6.1, “Installing and Uninstalling Plugins”
</a>
.)
</p>
</li>
<li class="listitem">
<p>
To use a keyring component instead, begin with
<a class="xref" href="keyring-component-installation.html" title="8.4.4.2 Keyring Component Installation">
Section 8.4.4.2, “Keyring Component Installation”
</a>
.
</p>
</li>
<li class="listitem">
<p>
If you intend to use keyring functions in conjunction with
the chosen keyring component or plugin, install the
functions after installing that component or plugin, using
the instructions in
<a class="xref" href="keyring-functions-general-purpose.html" title="8.4.4.12 General-Purpose Keyring Key-Management Functions">
Section 8.4.4.12, “General-Purpose Keyring Key-Management Functions”
</a>
.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Only one keyring component or plugin should be enabled at a
time. Enabling multiple keyring components or plugins is
unsupported and results may not be as anticipated.
</p>
<p>
A keyring component must be enabled on the MySQL Server
instance if you need to support secure storage for persisted
system variable values, rather than a keyring plugin, which do
not support the function. See
<a class="xref" href="persisted-system-variables.html#persisted-system-variables-sensitive" title="Persisting Sensitive System Variables">
Persisting Sensitive System Variables
</a>
.
</p>
</div>
<p>
MySQL provides these keyring plugin choices:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
keyring_okv
</code>
: A KMIP 1.1 plugin for use
with KMIP-compatible back end keyring storage products such
as Oracle Key Vault and Gemalto SafeNet KeySecure Appliance.
Available in MySQL Enterprise Edition distributions.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
keyring_aws
</code>
: Communicates with the Amazon
Web Services Key Management Service as a back end for key
generation and uses a local file for key storage. Available
in MySQL Enterprise Edition distributions.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
keyring_hashicorp
</code>
: Communicates with
HashiCorp Vault for back end storage. Available in MySQL Enterprise Edition
distributions.
</p>
</li>
</ul>
</div>
<p>
To be usable by the server, the plugin library file must be
located in the MySQL plugin directory (the directory named by
the
<a class="link" href="server-system-variables.html#sysvar_plugin_dir">
<code class="literal">
plugin_dir
</code>
</a>
system
variable). If necessary, configure the plugin directory location
by setting the value of
<a class="link" href="server-system-variables.html#sysvar_plugin_dir">
<code class="literal">
plugin_dir
</code>
</a>
at server startup.
</p>
<p>
A keyring component or plugin must be loaded early during the
server startup sequence so that other components can access it
as necessary during their own initialization. For example, the
<code class="literal">
InnoDB
</code>
storage engine uses the keyring for
tablespace encryption, so a keyring component or plugin must be
loaded and available prior to
<code class="literal">
InnoDB
</code>
initialization.
</p>
<p>
Installation for each keyring plugin is similar. The following
instructions describe how to install
<code class="literal">
keyring_okv
</code>
. To use a different keyring
plugin, substitute its name for
<code class="literal">
keyring_okv
</code>
.
</p>
<p>
The
<code class="literal">
keyring_okv
</code>
plugin library file base name
is
<code class="literal">
keyring_okv
</code>
. The file name suffix differs
per platform (for example,
<code class="filename">
.so
</code>
for Unix and
Unix-like systems,
<code class="filename">
.dll
</code>
for Windows).
</p>
<p>
To load the plugin, use the
<a class="link" href="server-options.html#option_mysqld_early-plugin-load">
<code class="option">
--early-plugin-load
</code>
</a>
option to
name the plugin library file that contains it. For example, on
platforms where the plugin library file suffix is
<code class="filename">
.so
</code>
, use these lines in the server
<code class="filename">
my.cnf
</code>
file, adjusting the
<code class="filename">
.so
</code>
suffix for your platform as necessary:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa56215350"><div class="copy-help left">Press ⌘+C to 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">early-plugin-load</span><span class="token attr-value"><span class="token punctuation">=</span>keyring_okv.so</span></code></pre>
</div>
<p>
Before starting the server, check the notes for your chosen
keyring plugin for configuration instructions specific to that
plugin:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
keyring_okv
</code>
:
<a class="xref" href="keyring-okv-plugin.html" title="8.4.4.6 Using the keyring_okv KMIP Plugin">
Section 8.4.4.6, “Using the keyring_okv KMIP Plugin”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
keyring_aws
</code>
:
<a class="xref" href="keyring-aws-plugin.html" title="8.4.4.7 Using the keyring_aws Amazon Web Services Keyring Plugin">
Section 8.4.4.7, “Using the keyring_aws Amazon Web Services Keyring Plugin”
</a>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
keyring_hashicorp
</code>
:
<a class="xref" href="keyring-hashicorp-plugin.html" title="8.4.4.8 Using the HashiCorp Vault Keyring Plugin">
Section 8.4.4.8, “Using the HashiCorp Vault Keyring Plugin”
</a>
</p>
</li>
</ul>
</div>
<p>
After performing any plugin-specific configuration, start the
server. Verify plugin installation by examining the Information
Schema
<a class="link" href="information-schema-plugins-table.html" title="28.3.22 The INFORMATION_SCHEMA PLUGINS Table">
<code class="literal">
PLUGINS
</code>
</a>
table or use the
<a class="link" href="show-plugins.html" title="15.7.7.27 SHOW PLUGINS Statement">
<code class="literal">
SHOW PLUGINS
</code>
</a>
statement (see
<a class="xref" href="obtaining-plugin-information.html" title="7.6.2 Obtaining Server Plugin Information">
Section 7.6.2, “Obtaining Server Plugin Information”
</a>
). For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa36101961"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> PLUGIN_NAME<span class="token punctuation">,</span> PLUGIN_STATUS
<span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">PLUGINS</span>
<span class="token keyword">WHERE</span> PLUGIN_NAME <span class="token operator">LIKE</span> <span class="token string">'keyring%'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> PLUGIN_NAME <span class="token punctuation">|</span> PLUGIN_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>
<span class="token output"><span class="token punctuation">|</span> keyring_okv <span class="token punctuation">|</span> ACTIVE <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 plugin fails to initialize, check the server error log
for diagnostic messages.
</p>
<p>
Plugins can be loaded by methods other than
<a class="link" href="server-options.html#option_mysqld_early-plugin-load">
<code class="option">
--early-plugin-load
</code>
</a>
, such as the
<a class="link" href="server-options.html#option_mysqld_plugin-load">
<code class="option">
--plugin-load
</code>
</a>
or
<a class="link" href="server-options.html#option_mysqld_plugin-load-add">
<code class="option">
--plugin-load-add
</code>
</a>
option or the
<a class="link" href="install-plugin.html" title="15.7.4.4 INSTALL PLUGIN Statement">
<code class="literal">
INSTALL PLUGIN
</code>
</a>
statement.
However, keyring plugins loaded using those methods may be
available too late in the server startup sequence for certain
components that use the keyring, such as
<code class="literal">
InnoDB
</code>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Plugin loading using
<a class="link" href="server-options.html#option_mysqld_plugin-load">
<code class="option">
--plugin-load
</code>
</a>
or
<a class="link" href="server-options.html#option_mysqld_plugin-load-add">
<code class="option">
--plugin-load-add
</code>
</a>
occurs
after
<code class="literal">
InnoDB
</code>
initialization.
</p>
</li>
<li class="listitem">
<p>
Plugins installed using
<a class="link" href="install-plugin.html" title="15.7.4.4 INSTALL PLUGIN Statement">
<code class="literal">
INSTALL
PLUGIN
</code>
</a>
are registered in the
<code class="literal">
mysql.plugin
</code>
system table and loaded
automatically for subsequent server restarts. However,
because
<code class="literal">
mysql.plugin
</code>
is an
<code class="literal">
InnoDB
</code>
table, any plugins named in it can
be loaded during startup only after
<code class="literal">
InnoDB
</code>
initialization.
</p>
</li>
</ul>
</div>
<p>
If no keyring component or plugin is available when a component
tries to access the keyring service, the service cannot be used
by that component. As a result, the component may fail to
initialize or may initialize with limited functionality. For
example, if
<code class="literal">
InnoDB
</code>
finds that there are
encrypted tablespaces when it initializes, it attempts to access
the keyring. If the keyring is unavailable,
<code class="literal">
InnoDB
</code>
can access only unencrypted
tablespaces. To ensure that
<code class="literal">
InnoDB
</code>
can access
encrypted tablespaces as well, use
<a class="link" href="server-options.html#option_mysqld_early-plugin-load">
<code class="option">
--early-plugin-load
</code>
</a>
to load the
keyring plugin.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-performance-schema.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="innodb-performance-schema">
</a>
17.16 InnoDB Integration with MySQL Performance Schema
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="monitor-alter-table-performance-schema.html">
17.16.1 Monitoring ALTER TABLE Progress for InnoDB Tables Using Performance
Schema
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="monitor-innodb-mutex-waits-performance-schema.html">
17.16.2 Monitoring InnoDB Mutex Waits Using Performance Schema
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045149688432">
</a>
<p>
This section provides a brief introduction to
<code class="literal">
InnoDB
</code>
integration with Performance Schema. For
comprehensive Performance Schema documentation, see
<a class="xref" href="performance-schema.html" title="Chapter 29 MySQL Performance Schema">
Chapter 29,
<i>
MySQL Performance Schema
</i>
</a>
.
</p>
<p>
You can profile certain internal
<code class="literal">
InnoDB
</code>
operations using the MySQL
<a class="link" href="performance-schema.html" title="Chapter 29 MySQL Performance Schema">
Performance Schema
feature
</a>
. This type of tuning is primarily for expert users
who evaluate optimization strategies to overcome performance
bottlenecks. DBAs can also use this feature for capacity planning,
to see whether their typical workload encounters any performance
bottlenecks with a particular combination of CPU, RAM, and disk
storage; and if so, to judge whether performance can be improved by
increasing the capacity of some part of the system.
</p>
<p>
To use this feature to examine
<code class="literal">
InnoDB
</code>
performance:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
You must be generally familiar with how to use the
<a class="link" href="performance-schema.html" title="Chapter 29 MySQL Performance Schema">
Performance Schema
feature
</a>
. For example, you should know how enable
instruments and consumers, and how to query
<code class="literal">
performance_schema
</code>
tables to retrieve data.
For an introductory overview, see
<a class="xref" href="performance-schema-quick-start.html" title="29.1 Performance Schema Quick Start">
Section 29.1, “Performance Schema Quick Start”
</a>
.
</p>
</li>
<li class="listitem">
<p>
You should be familiar with Performance Schema instruments that
are available for
<code class="literal">
InnoDB
</code>
. To view
<code class="literal">
InnoDB
</code>
-related instruments, you can query 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 for
instrument names that contain '
<code class="literal">
innodb
</code>
'.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20629794"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span>
<span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>setup_instruments
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'%innodb%'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> NAME <span class="token punctuation">|</span> ENABLED <span class="token punctuation">|</span> TIMED <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/commit_cond_mutex <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/innobase_share_mutex <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/autoinc_mutex <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/buf_pool_mutex <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/buf_pool_zip_mutex <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/cache_last_read_mutex <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/dict_foreign_err_mutex <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/dict_sys_mutex <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/synch/mutex/innodb/recalc_pool_mutex <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></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> wait/io/file/innodb/innodb_data_file <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/io/file/innodb/innodb_log_file <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> wait/io/file/innodb/innodb_temp_file <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/innodb/alter table (end) <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/innodb/alter table (flush) <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/innodb/alter table (insert) <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/innodb/alter table (log apply index) <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/innodb/alter table (log apply table) <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/innodb/alter table (merge sort) <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/innodb/alter table (read PK and internal sort) <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/innodb/buffer pool load <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/buf_buf_pool <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/dict_stats_bg_recalc_pool_t <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/dict_stats_index_map_t <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/dict_stats_n_diff_on_level <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/other <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/row_log_buf <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/row_merge_sort <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/std <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/sync_debug_latches <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/trx_sys_t::rw_trx_ids <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></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 class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">155 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
For additional information about the instrumented
<code class="literal">
InnoDB
</code>
objects, you can query Performance
Schema
<a class="link" href="performance-schema-instance-tables.html" title="29.12.3 Performance Schema Instance Tables">
instances
tables
</a>
, which provide additional information about
instrumented objects. Instance tables relevant to
<code class="literal">
InnoDB
</code>
include:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The
<a class="link" href="performance-schema-mutex-instances-table.html" title="29.12.3.3 The mutex_instances Table">
<code class="literal">
mutex_instances
</code>
</a>
table
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="performance-schema-rwlock-instances-table.html" title="29.12.3.4 The rwlock_instances Table">
<code class="literal">
rwlock_instances
</code>
</a>
table
</p>
</li>
<li class="listitem">
<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
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="performance-schema-file-instances-table.html" title="29.12.3.2 The file_instances Table">
<code class="literal">
file_instances
</code>
</a>
table
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Mutexes and RW-locks related to the
<code class="literal">
InnoDB
</code>
buffer pool are not included in this coverage; the same
applies to the output of the
<code class="literal">
SHOW ENGINE INNODB
MUTEX
</code>
statement.
</p>
</div>
<p>
For example, to view information about instrumented
<code class="literal">
InnoDB
</code>
file objects seen by the Performance
Schema when executing file I/O instrumentation, you might issue
the following query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24502290"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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>file_instances
<span class="token keyword">WHERE</span> EVENT_NAME <span class="token operator">LIKE</span> <span class="token string">'%innodb%'</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
FILE_NAME<span class="token punctuation">:</span> /home/dtprice/mysql-8.4/data/ibdata1
EVENT_NAME<span class="token punctuation">:</span> wait/io/file/innodb/innodb_data_file
OPEN_COUNT<span class="token punctuation">:</span> 3
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span 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>
FILE_NAME<span class="token punctuation">:</span> /home/dtprice/mysql-8.4/data/#ib_16384_0.dblwr
EVENT_NAME<span class="token punctuation">:</span> wait/io/file/innodb/innodb_dblwr_file
OPEN_COUNT<span class="token punctuation">:</span> 2
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 3. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
FILE_NAME<span class="token punctuation">:</span> /home/dtprice/mysql-8.4/data/#ib_16384_1.dblwr
EVENT_NAME<span class="token punctuation">:</span> wait/io/file/mysql-8.4/innodb_dblwr_file
OPEN_COUNT<span class="token punctuation">:</span> 2
...</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
You should be familiar with
<code class="literal">
performance_schema
</code>
tables that store
<code class="literal">
InnoDB
</code>
event data. Tables relevant to
<code class="literal">
InnoDB
</code>
-related events include:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The
<a class="link" href="performance-schema-wait-tables.html" title="29.12.4 Performance Schema Wait Event Tables">
Wait
Event
</a>
tables, which store wait events.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="performance-schema-summary-tables.html" title="29.12.20 Performance Schema Summary Tables">
Summary
</a>
tables, which provide aggregated information for terminated
events over time. Summary tables include
<a class="link" href="performance-schema-file-summary-tables.html" title="29.12.20.7 File I/O Summary Tables">
file
I/O summary tables
</a>
, which aggregate information about
I/O operations.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-stage-tables.html" title="29.12.5 Performance Schema Stage Event Tables">
Stage
Event
</a>
tables, which store event data for
<code class="literal">
InnoDB
</code>
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
and buffer pool load operations. For more
information, see
<a class="xref" href="monitor-alter-table-performance-schema.html" title="17.16.1 Monitoring ALTER TABLE Progress for InnoDB Tables Using Performance Schema">
Section 17.16.1, “Monitoring ALTER TABLE Progress for InnoDB Tables Using Performance
Schema”
</a>
,
and
<a class="xref" href="innodb-preload-buffer-pool.html#monitor-buffer-pool-load-performance-schema" title="Monitoring Buffer Pool Load Progress Using Performance Schema">
Monitoring Buffer Pool Load Progress Using Performance Schema
</a>
.
</p>
</li>
</ul>
</div>
<p>
If you are only interested in
<code class="literal">
InnoDB
</code>
-related
objects, use the clause
<code class="literal">
WHERE EVENT_NAME LIKE
'%innodb%'
</code>
or
<code class="literal">
WHERE NAME LIKE
'%innodb%'
</code>
(as required) when querying these tables.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-memory-model.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="performance-schema-memory-model">
</a>
29.17 The Performance Schema Memory-Allocation Model
</h2>
</div>
</div>
</div>
<p>
The Performance Schema uses this memory allocation model:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
May allocate memory at server startup
</p>
</li>
<li class="listitem">
<p>
May allocate additional memory during server operation
</p>
</li>
<li class="listitem">
<p>
Never free memory during server operation (although it might
be recycled)
</p>
</li>
<li class="listitem">
<p>
Free all memory used at shutdown
</p>
</li>
</ul>
</div>
<p>
The result is to relax memory constraints so that the Performance
Schema can be used with less configuration, and to decrease the
memory footprint so that consumption scales with server load.
Memory used depends on the load actually seen, not the load
estimated or explicitly configured for.
</p>
<p>
Several Performance Schema sizing parameters are autoscaled and
need not be configured explicitly unless you want to establish an
explicit limit on memory allocation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa43847526"><div class="copy-help left">Press ⌘+C to 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">performance_schema_accounts_size
performance_schema_hosts_size
performance_schema_max_cond_instances
performance_schema_max_file_instances
performance_schema_max_index_stat
performance_schema_max_metadata_locks
performance_schema_max_mutex_instances
performance_schema_max_prepared_statements_instances
performance_schema_max_program_instances
performance_schema_max_rwlock_instances
performance_schema_max_socket_instances
performance_schema_max_table_handles
performance_schema_max_table_instances
performance_schema_max_table_lock_stat
performance_schema_max_thread_instances
performance_schema_users_size</code></pre>
</div>
<p>
For an autoscaled parameter, configuration works like this:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
With the value set to -1 (the default), the parameter is
autoscaled:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The corresponding internal buffer is empty initially and
no memory is allocated.
</p>
</li>
<li class="listitem">
<p>
As the Performance Schema collects data, memory is
allocated in the corresponding buffer. The buffer size is
unbounded, and may grow with the load.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
With the value set to 0:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The corresponding internal buffer is empty initially and
no memory is allocated.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
With the value set to
<em class="replaceable">
<code>
N
</code>
</em>
> 0:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The corresponding internal buffer is empty initially and
no memory is allocated.
</p>
</li>
<li class="listitem">
<p>
As the Performance Schema collects data, memory is
allocated in the corresponding buffer, until the buffer
size reaches
<em class="replaceable">
<code>
N
</code>
</em>
.
</p>
</li>
<li class="listitem">
<p>
Once the buffer size reaches
<em class="replaceable">
<code>
N
</code>
</em>
,
no more memory is allocated. Data collected by the
Performance Schema for this buffer is lost, and any
corresponding
<span class="quote">
“
<span class="quote">
lost instance
</span>
”
</span>
counters are
incremented.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
To see how much memory the Performance Schema is using, check the
instruments designed for that purpose. The Performance Schema
allocates memory internally and associates each buffer with a
dedicated instrument so that memory consumption can be traced to
individual buffers. Instruments named with the prefix
<code class="literal">
memory/performance_schema/
</code>
expose how much
memory is allocated for these internal buffers. The buffers are
global to the server, so the instruments are displayed only in the
<a class="link" href="performance-schema-memory-summary-tables.html" title="29.12.20.10 Memory Summary Tables">
<code class="literal">
memory_summary_global_by_event_name
</code>
</a>
table, and not in other
<code class="literal">
memory_summary_by_
<em class="replaceable">
<code>
xxx
</code>
</em>
_by_event_name
</code>
tables.
</p>
<p>
This query shows the information associated with the memory
instruments:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa19424362"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>memory_summary_global_by_event_name
<span class="token keyword">WHERE</span> EVENT_NAME <span class="token operator">LIKE</span> <span class="token string">'memory/performance_schema/%'</span><span class="token punctuation">;</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/json-validation-functions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="json-validation-functions">
</a>
14.17.7 JSON Schema Validation Functions
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045194480000">
</a>
<p>
MySQL supports validation of JSON documents against JSON schemas
conforming to
<a class="ulink" href="https://json-schema.org/specification-links.html#draft-4" target="_blank">
Draft
4 of the JSON Schema specification
</a>
. This can be done using
either of the functions detailed in this section, both of which
take two arguments, a JSON schema, and a JSON document which is
validated against the schema.
<a class="link" href="json-validation-functions.html#function_json-schema-valid">
<code class="literal">
JSON_SCHEMA_VALID()
</code>
</a>
returns true if
the document validates against the schema, and false if it does
not;
<a class="link" href="json-validation-functions.html#function_json-schema-validation-report">
<code class="literal">
JSON_SCHEMA_VALIDATION_REPORT()
</code>
</a>
provides a report in JSON format on the validation.
</p>
<p>
Both functions handle null or invalid input as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If at least one of the arguments is
<code class="literal">
NULL
</code>
,
the function returns
<code class="literal">
NULL
</code>
.
</p>
</li>
<li class="listitem">
<p>
If at least one of the arguments is not valid JSON, the
function raises an error
(
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_type_for_json" target="_top">
<code class="literal">
ER_INVALID_TYPE_FOR_JSON
</code>
</a>
)
</p>
</li>
<li class="listitem">
<p>
In addition, if the schema is not a valid JSON object, the
function returns
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_json_type" target="_top">
<code class="literal">
ER_INVALID_JSON_TYPE
</code>
</a>
.
</p>
</li>
</ul>
</div>
<p>
MySQL supports the
<code class="literal">
required
</code>
attribute in JSON
schemas to enforce the inclusion of required properties (see the
examples in the function descriptions).
</p>
<p>
MySQL supports the
<code class="literal">
id
</code>
,
<code class="literal">
$schema
</code>
,
<code class="literal">
description
</code>
, and
<code class="literal">
type
</code>
attributes in JSON schemas but does not
require any of these.
</p>
<p>
MySQL does not support external resources in JSON schemas; using
the
<code class="literal">
$ref
</code>
keyword causes
<code class="literal">
JSON_SCHEMA_VALID()
</code>
to fail with
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_not_supported_yet" target="_top">
<code class="literal">
ER_NOT_SUPPORTED_YET
</code>
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
MySQL supports regular expression patterns in JSON schema, which
supports but silently ignores invalid patterns (see the
description of
<code class="literal">
JSON_SCHEMA_VALID()
</code>
for an
example).
</p>
</div>
<p>
These functions are described in detail in the following list:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a name="function_json-schema-valid">
</a>
<p>
<a class="link" href="json-validation-functions.html#function_json-schema-valid">
<code class="literal">
JSON_SCHEMA_VALID(
<em class="replaceable">
<code>
schema
</code>
</em>
,
<em class="replaceable">
<code>
document
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045194452080">
</a>
<p>
Validates a JSON
<em class="replaceable">
<code>
document
</code>
</em>
against a
JSON
<em class="replaceable">
<code>
schema
</code>
</em>
. Both
<em class="replaceable">
<code>
schema
</code>
</em>
and
<em class="replaceable">
<code>
document
</code>
</em>
are required. The schema
must be a valid JSON object; the document must be a valid JSON
document. Provided that these conditions are met: If the
document validates against the schema, the function returns
true (1); otherwise, it returns false (0).
</p>
<p>
In this example, we set a user variable
<code class="literal">
@schema
</code>
to the value of a JSON schema for
geographical coordinates, and another one
<code class="literal">
@document
</code>
to the value of a JSON document
containing one such coordinate. We then verify that
<code class="literal">
@document
</code>
validates according to
<code class="literal">
@schema
</code>
by using them as the arguments to
<code class="literal">
JSON_SCHEMA_VALID()
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa57905850"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">@schema</span> <span class="token operator">=</span> <span class="token string">'{
'</span><span class="token operator">></span> <span class="token string">"id"</span>: <span class="token string">"http://json-schema.org/geo"</span><span class="token punctuation">,</span>
'<span class="token operator">></span> <span class="token string">"$schema"</span>: <span class="token string">"http://json-schema.org/draft-04/schema#"</span><span class="token punctuation">,</span>
<span class="token string">'> "description": "A geographical coordinate",
'</span><span class="token operator">></span> <span class="token string">"type"</span>: <span class="token string">"object"</span><span class="token punctuation">,</span>
<span class="token string">'> "properties": {
'</span><span class="token operator">></span> <span class="token string">"latitude"</span>: {
<span class="token string">'> "type": "number",
'</span><span class="token operator">></span> <span class="token string">"minimum"</span>: <span class="token operator">-</span><span class="token number">90</span><span class="token punctuation">,</span>
<span class="token string">'> "maximum": 90
'</span><span class="token operator">></span> }<span class="token punctuation">,</span>
<span class="token string">'> "longitude": {
'</span><span class="token operator">></span> <span class="token string">"type"</span>: <span class="token string">"number"</span><span class="token punctuation">,</span>
<span class="token string">'> "minimum": -180,
'</span><span class="token operator">></span> <span class="token string">"maximum"</span>: <span class="token number">180</span>
<span class="token string">'> }
'</span><span class="token operator">></span> }<span class="token punctuation">,</span>
<span class="token string">'> "required": ["latitude", "longitude"]
'</span><span class="token operator">></span>}<span class="token string">';
Query OK, 0 rows affected (0.01 sec)
mysql> SET @document = '</span>{
<span class="token string">'> "latitude": 63.444697,
'</span><span class="token operator">></span> <span class="token string">"longitude"</span>: <span class="token number">10.445118</span>
<span class="token string">'>}'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> JSON_SCHEMA_VALID<span class="token punctuation">(</span><span class="token variable">@schema</span><span class="token punctuation">,</span> <span class="token variable">@document</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> JSON_SCHEMA_VALID(@schema, @document) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
Since
<code class="literal">
@schema
</code>
contains the
<code class="literal">
required
</code>
attribute, we can set
<code class="literal">
@document
</code>
to a value that is otherwise
valid but does not contain the required properties, then test
it against
<code class="literal">
@schema
</code>
, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa40546127"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">@document</span> <span class="token operator">=</span> <span class="token string">'{}'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> JSON_SCHEMA_VALID<span class="token punctuation">(</span><span class="token variable">@schema</span><span class="token punctuation">,</span> <span class="token variable">@document</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> JSON_SCHEMA_VALID(@schema, @document) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
If we now set the value of
<code class="literal">
@schema
</code>
to the
same JSON schema but without the
<code class="literal">
required
</code>
attribute,
<code class="literal">
@document
</code>
validates because it
is a valid JSON object, even though it contains no properties,
as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa7505595"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">@schema</span> <span class="token operator">=</span> <span class="token string">'{
'</span><span class="token operator">></span> <span class="token string">"id"</span>: <span class="token string">"http://json-schema.org/geo"</span><span class="token punctuation">,</span>
'<span class="token operator">></span> <span class="token string">"$schema"</span>: <span class="token string">"http://json-schema.org/draft-04/schema#"</span><span class="token punctuation">,</span>
<span class="token string">'> "description": "A geographical coordinate",
'</span><span class="token operator">></span> <span class="token string">"type"</span>: <span class="token string">"object"</span><span class="token punctuation">,</span>
<span class="token string">'> "properties": {
'</span><span class="token operator">></span> <span class="token string">"latitude"</span>: {
<span class="token string">'> "type": "number",
'</span><span class="token operator">></span> <span class="token string">"minimum"</span>: <span class="token operator">-</span><span class="token number">90</span><span class="token punctuation">,</span>
<span class="token string">'> "maximum": 90
'</span><span class="token operator">></span> }<span class="token punctuation">,</span>
<span class="token string">'> "longitude": {
'</span><span class="token operator">></span> <span class="token string">"type"</span>: <span class="token string">"number"</span><span class="token punctuation">,</span>
<span class="token string">'> "minimum": -180,
'</span><span class="token operator">></span> <span class="token string">"maximum"</span>: <span class="token number">180</span>
<span class="token string">'> }
'</span><span class="token operator">></span> }
<span class="token string">'>}'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> JSON_SCHEMA_VALID<span class="token punctuation">(</span><span class="token variable">@schema</span><span class="token punctuation">,</span> <span class="token variable">@document</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> JSON_SCHEMA_VALID(@schema, @document) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<a class="indexterm" name="idm46045194400752">
</a>
<a class="indexterm" name="idm46045194399248">
</a>
<p>
<a name="json-validation-functions-constraints">
</a>
<b>
JSON_SCHEMA_VALID() and CHECK constraints.
</b>
<code class="literal">
JSON_SCHEMA_VALID()
</code>
can also be used to
enforce
<code class="literal">
CHECK
</code>
constraints.
</p>
<p>
Consider the table
<code class="literal">
geo
</code>
created as shown
here, with a JSON column
<code class="literal">
coordinate
</code>
representing a point of latitude and longitude on a map,
governed by the JSON schema used as an argument in a
<code class="literal">
JSON_SCHEMA_VALID()
</code>
call which is passed as
the expression for a
<code class="literal">
CHECK
</code>
constraint on
this table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69760201"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> geo <span class="token punctuation">(</span>
<span class="token prompt"> -></span> coordinate <span class="token datatype">JSON</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token keyword">CHECK</span><span class="token punctuation">(</span>
<span class="token prompt"> -></span> JSON_SCHEMA_VALID<span class="token punctuation">(</span>
<span class="token prompt"> -></span> <span class="token string">'{
'</span><span class="token operator">></span> <span class="token string">"type"</span>:<span class="token string">"object"</span><span class="token punctuation">,</span>
<span class="token string">'> "properties":{
'</span><span class="token operator">></span> <span class="token string">"latitude"</span>:{<span class="token string">"type"</span>:<span class="token string">"number"</span><span class="token punctuation">,</span> <span class="token string">"minimum"</span>:<span class="token operator">-</span><span class="token number">90</span><span class="token punctuation">,</span> <span class="token string">"maximum"</span>:<span class="token number">90</span>}<span class="token punctuation">,</span>
<span class="token string">'> "longitude":{"type":"number", "minimum":-180, "maximum":180}
'</span><span class="token operator">></span> }<span class="token punctuation">,</span>
<span class="token string">'> "required": ["latitude", "longitude"]
'</span><span class="token operator">></span> }'<span class="token punctuation">,</span>
<span class="token prompt"> -></span> coordinate
<span class="token prompt"> -></span> <span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.45 sec)</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Because a MySQL
<code class="literal">
CHECK
</code>
constraint cannot
contain references to variables, you must pass the JSON
schema to
<code class="literal">
JSON_SCHEMA_VALID()
</code>
inline when
using it to specify such a constraint for a table.
</p>
</div>
<p>
We assign JSON values representing coordinates to three
variables, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa75393002"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">@point1</span> <span class="token operator">=</span> <span class="token string">'{"latitude":59, "longitude":18}'</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">@point2</span> <span class="token operator">=</span> <span class="token string">'{"latitude":91, "longitude":0}'</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">@point3</span> <span class="token operator">=</span> <span class="token string">'{"longitude":120}'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span></code></pre>
</div>
<p>
The first of these values is valid, as can be seen in the
following
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa72800134"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> geo <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token variable">@point1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected (0.05 sec)</span></code></pre>
</div>
<p>
The second JSON value is invalid and so fails the constraint,
as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa46205486"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> geo <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token variable">@point2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 3819 (HY000)<span class="token punctuation">:</span> Check constraint 'geo_chk_1' is violated.</span></code></pre>
</div>
<p>
You can obtain precise information about the nature of the
failure—in this case, that the
<code class="literal">
latitude
</code>
value exceeds the maximum defined
in the schema—by issuing a
<a class="link" href="show-warnings.html" title="15.7.7.42 SHOW WARNINGS Statement">
<code class="literal">
SHOW
WARNINGS
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa62737864"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">WARNINGS</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Level<span class="token punctuation">:</span> Error
Code<span class="token punctuation">:</span> 3934
Message<span class="token punctuation">:</span> The JSON document location '#/latitude' failed requirement 'maximum' at
JSON Schema location '#/properties/latitude'.
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 2. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Level<span class="token punctuation">:</span> Error
Code<span class="token punctuation">:</span> 3819
Message<span class="token punctuation">:</span> Check constraint 'geo_chk_1' is violated.
</span><span class="token output">2 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
The third coordinate value defined above is also invalid,
since it is missing the required
<code class="literal">
latitude
</code>
property. As before, you can see this by attempting to insert
the value into the
<code class="literal">
geo
</code>
table, then issuing
<code class="literal">
SHOW WARNINGS
</code>
afterwards:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa70545345"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> geo <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token variable">@point3</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 3819 (HY000)<span class="token punctuation">:</span> Check constraint 'geo_chk_1' is violated.</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Level<span class="token punctuation">:</span> Error
Code<span class="token punctuation">:</span> 3934
Message<span class="token punctuation">:</span> The JSON document location '#' failed requirement 'required' at JSON
Schema location '#'.
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 2. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Level<span class="token punctuation">:</span> Error
Code<span class="token punctuation">:</span> 3819
Message<span class="token punctuation">:</span> Check constraint 'geo_chk_1' is violated.
</span><span class="token output">2 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
See
<a class="xref" href="create-table-check-constraints.html" title="15.1.20.6 CHECK Constraints">
Section 15.1.20.6, “CHECK Constraints”
</a>
, for more
information.
</p>
<a class="indexterm" name="idm46045194355824">
</a>
<p>
JSON Schema has support for specifying regular expression
patterns for strings, but the implementation used by MySQL
silently ignores invalid patterns. This means that
<code class="literal">
JSON_SCHEMA_VALID()
</code>
can return true even
when a regular expression pattern is invalid, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63481435"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> JSON_SCHEMA_VALID<span class="token punctuation">(</span><span class="token string">'{"type":"string","pattern":"("}'</span><span class="token punctuation">,</span> <span class="token string">'"abc"'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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_SCHEMA_VALID('{"type":"string","pattern":"("}', '"abc"') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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.04 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_json-schema-validation-report">
</a>
<p>
<a class="link" href="json-validation-functions.html#function_json-schema-validation-report">
<code class="literal">
JSON_SCHEMA_VALIDATION_REPORT(
<em class="replaceable">
<code>
schema
</code>
</em>
,
<em class="replaceable">
<code>
document
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045194345040">
</a>
<p>
Validates a JSON
<em class="replaceable">
<code>
document
</code>
</em>
against a
JSON
<em class="replaceable">
<code>
schema
</code>
</em>
. Both
<em class="replaceable">
<code>
schema
</code>
</em>
and
<em class="replaceable">
<code>
document
</code>
</em>
are required. As with
JSON_VALID_SCHEMA(), the schema must be a valid JSON object,
and the document must be a valid JSON document. Provided that
these conditions are met, the function returns a report, as a
JSON document, on the outcome of the validation. If the JSON
document is considered valid according to the JSON Schema, the
function returns a JSON object with one property
<code class="literal">
valid
</code>
having the value "true". If the JSON
document fails validation, the function returns a JSON object
which includes the properties listed here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
valid
</code>
: Always "false" for a failed
schema validation
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
reason
</code>
: A human-readable string
containing the reason for the failure
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
schema-location
</code>
: A JSON pointer URI
fragment identifier indicating where in the JSON schema
the validation failed (see Note following this list)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
document-location
</code>
: A JSON pointer URI
fragment identifier indicating where in the JSON document
the validation failed (see Note following this list)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
schema-failed-keyword
</code>
: A string
containing the name of the keyword or property in the JSON
schema that was violated
</p>
</li>
</ul>
</div>
<a class="indexterm" name="idm46045194332000">
</a>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
JSON pointer URI fragment identifiers are defined in
<a class="ulink" href="https://tools.ietf.org/html/rfc6901#page-5" target="_blank">
RFC
6901 - JavaScript Object Notation (JSON) Pointer
</a>
.
(These are
<span class="emphasis">
<em>
not
</em>
</span>
the same as the JSON
path notation used by
<a class="link" href="json-search-functions.html#function_json-extract">
<code class="literal">
JSON_EXTRACT()
</code>
</a>
and other
MySQL JSON functions.) In this notation,
<code class="literal">
#
</code>
represents the entire document, and
<code class="literal">
#/myprop
</code>
represents the portion of the
document included in the top-level property named
<code class="literal">
myprop
</code>
. See the specification just cited
and the examples shown later in this section for more
information.
</p>
</div>
<p>
In this example, we set a user variable
<code class="literal">
@schema
</code>
to the value of a JSON schema for
geographical coordinates, and another one
<code class="literal">
@document
</code>
to the value of a JSON document
containing one such coordinate. We then verify that
<code class="literal">
@document
</code>
validates according to
<code class="literal">
@schema
</code>
by using them as the arguments to
<code class="literal">
JSON_SCHEMA_VALIDATION_REORT()
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa84162602"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">@schema</span> <span class="token operator">=</span> <span class="token string">'{
'</span><span class="token operator">></span> <span class="token string">"id"</span>: <span class="token string">"http://json-schema.org/geo"</span><span class="token punctuation">,</span>
'<span class="token operator">></span> <span class="token string">"$schema"</span>: <span class="token string">"http://json-schema.org/draft-04/schema#"</span><span class="token punctuation">,</span>
<span class="token string">'> "description": "A geographical coordinate",
'</span><span class="token operator">></span> <span class="token string">"type"</span>: <span class="token string">"object"</span><span class="token punctuation">,</span>
<span class="token string">'> "properties": {
'</span><span class="token operator">></span> <span class="token string">"latitude"</span>: {
<span class="token string">'> "type": "number",
'</span><span class="token operator">></span> <span class="token string">"minimum"</span>: <span class="token operator">-</span><span class="token number">90</span><span class="token punctuation">,</span>
<span class="token string">'> "maximum": 90
'</span><span class="token operator">></span> }<span class="token punctuation">,</span>
<span class="token string">'> "longitude": {
'</span><span class="token operator">></span> <span class="token string">"type"</span>: <span class="token string">"number"</span><span class="token punctuation">,</span>
<span class="token string">'> "minimum": -180,
'</span><span class="token operator">></span> <span class="token string">"maximum"</span>: <span class="token number">180</span>
<span class="token string">'> }
'</span><span class="token operator">></span> }<span class="token punctuation">,</span>
<span class="token string">'> "required": ["latitude", "longitude"]
'</span><span class="token operator">></span>}<span class="token string">';
Query OK, 0 rows affected (0.01 sec)
mysql> SET @document = '</span>{
<span class="token string">'> "latitude": 63.444697,
'</span><span class="token operator">></span> <span class="token string">"longitude"</span>: <span class="token number">10.445118</span>
<span class="token string">'>}'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> JSON_SCHEMA_VALIDATION_REPORT<span class="token punctuation">(</span><span class="token variable">@schema</span><span class="token punctuation">,</span> <span class="token variable">@document</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> JSON_SCHEMA_VALIDATION_REPORT(@schema, @document) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> {"valid": true} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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 set
<code class="literal">
@document
</code>
such that it specifies
an illegal value for one of its properties, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa65700876"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">@document</span> <span class="token operator">=</span> <span class="token string">'{
'</span><span class="token operator">></span> <span class="token string">"latitude"</span>: <span class="token number">63.444697</span><span class="token punctuation">,</span>
<span class="token string">'> "longitude": 310.445118
'</span><span class="token operator">></span> }'<span class="token punctuation">;</span></code></pre>
</div>
<p>
Validation of
<code class="literal">
@document
</code>
now fails when
tested with
<code class="literal">
JSON_SCHEMA_VALIDATION_REPORT()
</code>
. The output
from the function call contains detailed information about the
failure (with the function wrapped by
<a class="link" href="json-utility-functions.html#function_json-pretty">
<code class="literal">
JSON_PRETTY()
</code>
</a>
to provide better
formatting), as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa28651431"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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>JSON_SCHEMA_VALIDATION_REPORT<span class="token punctuation">(</span><span class="token variable">@schema</span><span class="token punctuation">,</span> <span class="token variable">@document</span><span class="token punctuation">)</span><span class="token punctuation">)</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
JSON_PRETTY(JSON_SCHEMA_VALIDATION_REPORT(@schema, @document))<span class="token punctuation">:</span> {
"valid"<span class="token punctuation">:</span> false,
"reason"<span class="token punctuation">:</span> "The JSON document location '#/longitude' failed requirement 'maximum' at JSON Schema location '#/properties/longitude'",
"schema-location"<span class="token punctuation">:</span> "#/properties/longitude",
"document-location"<span class="token punctuation">:</span> "#/longitude",
"schema-failed-keyword"<span class="token punctuation">:</span> "maximum"
}
</span><span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
Since
<code class="literal">
@schema
</code>
contains the
<code class="literal">
required
</code>
attribute, we can set
<code class="literal">
@document
</code>
to a value that is otherwise
valid but does not contain the required properties, then test
it against
<code class="literal">
@schema
</code>
. The output of
<code class="literal">
JSON_SCHEMA_VALIDATION_REPORT()
</code>
shows that
validation fails due to lack of a required element, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa29854974"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">@document</span> <span class="token operator">=</span> <span class="token string">'{}'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">JSON_PRETTY</span><span class="token punctuation">(</span>JSON_SCHEMA_VALIDATION_REPORT<span class="token punctuation">(</span><span class="token variable">@schema</span><span class="token punctuation">,</span> <span class="token variable">@document</span><span class="token punctuation">)</span><span class="token punctuation">)</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
JSON_PRETTY(JSON_SCHEMA_VALIDATION_REPORT(@schema, @document))<span class="token punctuation">:</span> {
"valid"<span class="token punctuation">:</span> false,
"reason"<span class="token punctuation">:</span> "The JSON document location '#' failed requirement 'required' at JSON Schema location '#'",
"schema-location"<span class="token punctuation">:</span> "#",
"document-location"<span class="token punctuation">:</span> "#",
"schema-failed-keyword"<span class="token punctuation">:</span> "required"
}
</span><span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
If we now set the value of
<code class="literal">
@schema
</code>
to the
same JSON schema but without the
<code class="literal">
required
</code>
attribute,
<code class="literal">
@document
</code>
validates because it
is a valid JSON object, even though it contains no properties,
as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa86356495"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">@schema</span> <span class="token operator">=</span> <span class="token string">'{
'</span><span class="token operator">></span> <span class="token string">"id"</span>: <span class="token string">"http://json-schema.org/geo"</span><span class="token punctuation">,</span>
'<span class="token operator">></span> <span class="token string">"$schema"</span>: <span class="token string">"http://json-schema.org/draft-04/schema#"</span><span class="token punctuation">,</span>
<span class="token string">'> "description": "A geographical coordinate",
'</span><span class="token operator">></span> <span class="token string">"type"</span>: <span class="token string">"object"</span><span class="token punctuation">,</span>
<span class="token string">'> "properties": {
'</span><span class="token operator">></span> <span class="token string">"latitude"</span>: {
<span class="token string">'> "type": "number",
'</span><span class="token operator">></span> <span class="token string">"minimum"</span>: <span class="token operator">-</span><span class="token number">90</span><span class="token punctuation">,</span>
<span class="token string">'> "maximum": 90
'</span><span class="token operator">></span> }<span class="token punctuation">,</span>
<span class="token string">'> "longitude": {
'</span><span class="token operator">></span> <span class="token string">"type"</span>: <span class="token string">"number"</span><span class="token punctuation">,</span>
<span class="token string">'> "minimum": -180,
'</span><span class="token operator">></span> <span class="token string">"maximum"</span>: <span class="token number">180</span>
<span class="token string">'> }
'</span><span class="token operator">></span> }
<span class="token string">'>}'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> JSON_SCHEMA_VALIDATION_REPORT<span class="token punctuation">(</span><span class="token variable">@schema</span><span class="token punctuation">,</span> <span class="token variable">@document</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> JSON_SCHEMA_VALIDATION_REPORT(@schema, @document) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> {"valid": true} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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/unix-signal-response.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="unix-signal-response">
</a>
6.10 Unix Signal Handling in MySQL
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045302561808">
</a>
<a class="indexterm" name="idm46045302560768">
</a>
<p>
On Unix and Unix-like systems, a process can be the recipient of
signals sent to it by the
<code class="literal">
root
</code>
system account
or the system account that owns the process. Signals can be sent
using the
<a class="link" href="kill.html" title="15.7.8.4 KILL Statement">
<span class="command">
<strong>
kill
</strong>
</span>
</a>
command. Some command
interpreters associate certain key sequences with signals, such as
<span class="keycap">
<strong>
Control+C
</strong>
</span>
to send a
<code class="literal">
SIGINT
</code>
signal. This section describes how the MySQL server and client
programs respond to signals.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="unix-signal-response.html#server-signal-response" title="Server Response to Signals">
Server Response to Signals
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="unix-signal-response.html#client-signal-response" title="Client Response to Signals">
Client Response to Signals
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="server-signal-response">
</a>
Server Response to Signals
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045302552032">
</a>
<a class="indexterm" name="idm46045302550576">
</a>
<a class="indexterm" name="idm46045302549088">
</a>
<a class="indexterm" name="idm46045302547600">
</a>
<a class="indexterm" name="idm46045302546112">
</a>
<a class="indexterm" name="idm46045302544624">
</a>
<p>
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
responds to signals as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
SIGTERM
</code>
causes the server to shut down.
This is like executing a
<a class="link" href="shutdown.html" title="15.7.8.9 SHUTDOWN Statement">
<code class="literal">
SHUTDOWN
</code>
</a>
statement without
having to connect to the server (which for shutdown requires
an account that has the
<a class="link" href="privileges-provided.html#priv_shutdown">
<code class="literal">
SHUTDOWN
</code>
</a>
privilege).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SIGHUP
</code>
causes the server to reload the
grant tables and to flush tables, logs, the thread cache,
and the host cache. These actions are like various forms of
the
<a class="link" href="flush.html" title="15.7.8.3 FLUSH Statement">
<code class="literal">
FLUSH
</code>
</a>
statement. Sending
the signal enables the flush operations to be performed
without having to connect to the server, which requires a
MySQL account that has privileges sufficient for those
operations.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SIGUSR1
</code>
causes the server to flush the
error log, general query log, and slow query log. One use
for
<code class="literal">
SIGUSR1
</code>
is to implement log rotation
without having to connect to the server, which requires a
MySQL account that has privileges sufficient for those
operations. For information about log rotation, see
<a class="xref" href="log-file-maintenance.html" title="7.4.6 Server Log Maintenance">
Section 7.4.6, “Server Log Maintenance”
</a>
.
</p>
<p>
The server response to
<code class="literal">
SIGUSR1
</code>
is a
subset of the response to
<code class="literal">
SIGHUP
</code>
,
enabling
<code class="literal">
SIGUSR1
</code>
to be used as a more
<span class="quote">
“
<span class="quote">
lightweight
</span>
”
</span>
signal that flushes certain logs
without the other
<code class="literal">
SIGHUP
</code>
effects such as
flushing the thread and host caches and writing a status
report to the error log.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SIGINT
</code>
normally is ignored by the server.
Starting the server with the
<a class="link" href="server-options.html#option_mysqld_gdb">
<code class="option">
--gdb
</code>
</a>
option installs an
interrupt handler for
<code class="literal">
SIGINT
</code>
for
debugging purposes. See
<a class="xref" href="using-gdb-on-mysqld.html" title="7.9.1.4 Debugging mysqld under gdb">
Section 7.9.1.4, “Debugging mysqld under gdb”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="client-signal-response">
</a>
Client Response to Signals
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045302520832">
</a>
<a class="indexterm" name="idm46045302519376">
</a>
<a class="indexterm" name="idm46045302517888">
</a>
<a class="indexterm" name="idm46045302516400">
</a>
<p>
MySQL client programs respond to signals as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client interprets
<code class="literal">
SIGINT
</code>
(typically the result of typing
<span class="keycap">
<strong>
Control+C
</strong>
</span>
) as instruction to interrupt the
current statement if there is one, or to cancel any partial
input line otherwise. This behavior can be disabled using
the
<a class="link" href="mysql-command-options.html#option_mysql_sigint-ignore">
<code class="option">
--sigint-ignore
</code>
</a>
option to
ignore
<code class="literal">
SIGINT
</code>
signals.
</p>
</li>
<li class="listitem">
<p>
Client programs that use the MySQL client library block
<code class="literal">
SIGPIPE
</code>
signals by default. These
variations are possible:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Client can install their own
<code class="literal">
SIGPIPE
</code>
handler to override the default behavior. See
<a class="ulink" href="/doc/c-api/8.4/en/c-api-threaded-clients.html" target="_top">
Writing C API Threaded Client Programs
</a>
.
</p>
</li>
<li class="listitem">
<p>
Clients can prevent installation of
<code class="literal">
SIGPIPE
</code>
handlers by specifying the
<code class="literal">
CLIENT_IGNORE_SIGPIPE
</code>
option to
<a class="ulink" href="/doc/c-api/8.4/en/mysql-real-connect.html" target="_top">
<code class="literal">
mysql_real_connect()
</code>
</a>
at
connect time. See
<a class="ulink" href="/doc/c-api/8.4/en/mysql-real-connect.html" target="_top">
mysql_real_connect()
</a>
.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-mode-change-online-verify-transactions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-mode-change-online-verify-transactions">
</a>
19.1.4.4 Verifying Replication of Anonymous Transactions
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045145348640">
</a>
<p>
This section explains how to monitor a replication topology and
verify that all anonymous transactions have been replicated. This
is helpful when changing the replication mode online as you can
verify that it is safe to change to GTID transactions.
</p>
<p>
There are several possible ways to wait for transactions to
replicate:
</p>
<p>
The simplest method, which works regardless of your topology but
relies on timing is as follows: If you are sure that the replica
never lags more than
<em class="replaceable">
<code>
N
</code>
</em>
seconds, wait
any period of time that is longer than
<em class="replaceable">
<code>
N
</code>
</em>
seconds, which you consider safe for
your deployment.
</p>
<p>
A safer method, in the sense that it does not depend on timing, if
you only have a source with one or more replicas, is to perform
the following two steps:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
On the source, execute this statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa35020352"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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 datatype">BINARY</span> LOG <span class="token keyword">STATUS</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Make a note of the values displayed in the
<code class="literal">
File
</code>
and
<code class="literal">
Position
</code>
columns of the output.
</p>
</li>
<li class="listitem">
<p>
On each replica, use the file and position information from
the source to perform the statement shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa4546577"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> SOURCE_POS_WAIT<span class="token punctuation">(</span><span class="token keyword"><em class="replaceable">file</em></span><span class="token punctuation">,</span> <em class="replaceable">position</em><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ol>
</div>
<p>
If you have a source and multiple levels of replicas (that is,
replicas of replicas), repeat the second step on each level,
starting from the source, then on all of its replicas, then on all
of the replicas of these replicas, and so on.
</p>
<p>
If you emply a circular replication topology where multiple
servers may have write clients, perform the second step for each
source-replica connection, until you have completed the full
circle. Repeat this process so that you complete the full circle
twice.
</p>
<p>
For example, if there are three servers A, B, and C, replicating
in a circle, so that A replicates to B, B replicates to C, and C
replicates to A, do as follows, in the order shown:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Perform Step 1 on A, and Step 2 on B.
</p>
</li>
<li class="listitem">
<p>
Perform Step 1 on B, and Step 2 on C.
</p>
</li>
<li class="listitem">
<p>
Perform Step 1 on C, and Step 2 on A.
</p>
</li>
<li class="listitem">
<p>
Perform Step 1 on A, and Step 2 on B.
</p>
</li>
<li class="listitem">
<p>
Perform Step 1 on B, and Step 2 on C.
</p>
</li>
<li class="listitem">
<p>
Perform Step 1 on C, and Step 2 on A.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/create-table-ndb-comment-options.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="create-table-ndb-comment-options">
</a>
15.1.20.12 Setting NDB Comment Options
</h4>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="create-table-ndb-comment-options.html#create-table-ndb-comment-column-options" title="NDB_COLUMN Options">
NDB_COLUMN Options
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="create-table-ndb-comment-options.html#create-table-ndb-comment-table-options" title="NDB_TABLE Options">
NDB_TABLE Options
</a>
</p>
</li>
</ul>
</div>
<p>
<a class="indexterm" name="idm46045184382576">
</a>
<a class="indexterm" name="idm46045184381504">
</a>
<a class="indexterm" name="idm46045184380464">
</a>
It is possible to set a number of options specific to NDB
Cluster in the table comment or column comments of an
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table. Table-level options for
controlling read from any replica and partition balance can be
embedded in a table comment using
<code class="literal">
NDB_TABLE
</code>
.
</p>
<p>
<code class="literal">
NDB_COLUMN
</code>
can be used in a column comment to
set the size of the blob parts table column used for storing
parts of blob values by
<code class="literal">
NDB
</code>
to its maximum.
This works for
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
,
<code class="literal">
MEDIUMBLOB
</code>
,
<code class="literal">
LONGBLOB
</code>
,
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
,
<code class="literal">
MEDIUMTEXT
</code>
,
<code class="literal">
LONGTEXT
</code>
, and
<a class="link" href="json.html" title="13.5 The JSON Data Type">
<code class="literal">
JSON
</code>
</a>
columns. A column comment
can also be used to control the inline size of a blob column.
<code class="literal">
NDB_COLUMN
</code>
comments do not support
<code class="literal">
TINYBLOB
</code>
or
<code class="literal">
TINYTEXT
</code>
columns, since these have an inline part (only) of fixed size,
and no separate parts to store elsewhere.
</p>
<p>
<code class="literal">
NDB_TABLE
</code>
can be used in a table comment to
set options relating to partition balance and whether the table
is fully replicated, among others.
</p>
<p>
The remainder of this section describes these options and their
use.
</p>
<h5>
<a name="create-table-ndb-comment-column-options">
</a>
NDB_COLUMN Options
</h5>
<p>
<a class="indexterm" name="idm46045184362992">
</a>
<a class="indexterm" name="idm46045184361920">
</a>
<a class="indexterm" name="idm46045184360432">
</a>
<a class="indexterm" name="idm46045184359360">
</a>
In NDB Cluster, a column comment in a
<code class="literal">
CREATE
TABLE
</code>
or
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statement can also be used to specify an
<code class="literal">
NDB_COLUMN
</code>
option.
<code class="literal">
NDB
</code>
supports two column comment options
<code class="literal">
BLOB_INLINE_SIZE
</code>
and
<code class="literal">
MAX_BLOB_PART_SIZE
</code>
. Syntax for these options
is shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa62101242"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">COMMENT</span> <span class="token string">'NDB_COLUMN=<em class="replaceable">speclist</em>'</span>
<em class="replaceable">speclist</em> <span class="token operator">:=</span> <em class="replaceable">spec</em><span class="token punctuation">[</span><span class="token punctuation">,</span><em class="replaceable">spec</em><span class="token punctuation">]</span>
spec <span class="token operator">:=</span>
BLOB_INLINE_SIZE<span class="token operator">=</span><span class="token keyword"><em class="replaceable">value</em></span>
<span class="token operator">|</span> MAX_BLOB_PART_SIZE<span class="token punctuation">[</span><span class="token operator">=</span>{<span class="token number">0</span><span class="token operator">|</span><span class="token number">1</span>}<span class="token punctuation">]</span></code></pre>
</div>
<p>
<code class="literal">
BLOB_INLINE_SIZE
</code>
specifies the number of
bytes to be stored inline by the column; its expected value is
an integer in the range 1 - 29980, inclusive. Setting a value
greater than 29980 raises an error; setting a value less than 1
is allowed, but causes the default inline size for the column
type to be used.
</p>
<p>
You should be aware that the maximum value for this option is
actually the maximum number of bytes that can be stored in one
row of an
<code class="literal">
NDB
</code>
table; every column in the row
contributes to this total.
</p>
<p>
You should also keep in mind, especially when working with
<code class="literal">
TEXT
</code>
columns, that the value set by
<code class="literal">
MAX_BLOB_PART_SIZE
</code>
or
<code class="literal">
BLOB_INLINE_SIZE
</code>
represents column size in
bytes. It does not indicate the number of characters, which
varies according to the character set and collation used by the
column.
</p>
<p>
To see the effects of this option, first create a table with two
<code class="literal">
BLOB
</code>
columns, one (
<code class="literal">
b1
</code>
)
with no extra options, and another (
<code class="literal">
b2
</code>
) with
a setting for
<code class="literal">
BLOB_INLINE_SIZE
</code>
, as shown
here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34522635"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>
<span class="token prompt"> -></span> a <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> b1 <span class="token datatype">BLOB</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> b2 <span class="token datatype">BLOB</span> <span class="token keyword">COMMENT</span> <span class="token string">'NDB_COLUMN=BLOB_INLINE_SIZE=8000'</span>
<span class="token prompt"> -></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 output">Query OK, 0 rows affected (0.32 sec)</span></code></pre>
</div>
<p>
You can see the
<code class="literal">
BLOB_INLINE_SIZE
</code>
settings for
the
<code class="literal">
BLOB
</code>
columns by querying the
<a class="link" href="mysql-cluster-ndbinfo-blobs.html" title="25.6.17.4 The ndbinfo blobs Table">
<code class="literal">
ndbinfo.blobs
</code>
</a>
table, like
this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20661795"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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 keyword">column_name</span> <span class="token keyword">AS</span> <span class="token string">'Column Name'</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> inline_size <span class="token keyword">AS</span> <span class="token string">'Inline Size'</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> part_size <span class="token keyword">AS</span> <span class="token string">'Blob Part Size'</span>
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> ndbinfo<span class="token punctuation">.</span>blobs
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> <span class="token keyword">table_name</span> <span class="token operator">=</span> <span class="token string">'t1'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Column Name <span class="token punctuation">|</span> Inline Size <span class="token punctuation">|</span> Blob Part 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>
<span class="token output"><span class="token punctuation">|</span> b1 <span class="token punctuation">|</span> 256 <span class="token punctuation">|</span> 2000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> b2 <span class="token punctuation">|</span> 8000 <span class="token punctuation">|</span> 2000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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.01 sec)</span></code></pre>
</div>
<p>
You can also check the output from the
<a class="link" href="mysql-cluster-programs-ndb-desc.html" title="25.5.9 ndb_desc — Describe NDB Tables">
<span class="command">
<strong>
ndb_desc
</strong>
</span>
</a>
utility, as shown here, with the
relevant lines displayed using emphasized text:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa43120492"><div class="copy-help left">Press ⌘+C to 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_desc</span> <span class="token property">-d</span> test t1
<span class="token property">--</span> t <span class="token property">--</span>
Version<span class="token punctuation">:</span> 1
Fragment type<span class="token punctuation">:</span> HashMapPartition
K Value<span class="token punctuation">:</span> 6
Min load factor<span class="token punctuation">:</span> 78
Max load factor<span class="token punctuation">:</span> 80
Temporary table<span class="token punctuation">:</span> no
Number of attributes<span class="token punctuation">:</span> 3
Number of primary keys<span class="token punctuation">:</span> 1
Length of frm data<span class="token punctuation">:</span> 945
Max Rows<span class="token punctuation">:</span> 0
Row Checksum<span class="token punctuation">:</span> 1
Row GCI<span class="token punctuation">:</span> 1
SingleUserMode<span class="token punctuation">:</span> 0
ForceVarPart<span class="token punctuation">:</span> 1
PartitionCount<span class="token punctuation">:</span> 2
FragmentCount<span class="token punctuation">:</span> 2
PartitionBalance<span class="token punctuation">:</span> FOR_RP_BY_LDM
ExtraRowGciBits<span class="token punctuation">:</span> 0
ExtraRowAuthorBits<span class="token punctuation">:</span> 0
TableStatus<span class="token punctuation">:</span> Retrieved
Table options<span class="token punctuation">:</span> readbackup
HashMap<span class="token punctuation">:</span> DEFAULT-HASHMAP-3840-2
<span class="token property">--</span> Attributes <span class="token property">--</span>
a Int PRIMARY KEY DISTRIBUTION KEY AT<span class="token attr-value"><span class="token punctuation">=</span>FIXED</span> ST<span class="token attr-value"><span class="token punctuation">=</span>MEMORY</span>
<em>b1 Blob<span class="token punctuation">(</span>256<span class="token punctuation">,</span>2000<span class="token punctuation">,</span>0<span class="token punctuation">)</span> NULL AT<span class="token attr-value"><span class="token punctuation">=</span>MEDIUM_VAR</span> ST<span class="token attr-value"><span class="token punctuation">=</span>MEMORY</span> BV<span class="token attr-value"><span class="token punctuation">=</span>2</span> BT<span class="token attr-value"><span class="token punctuation">=</span>NDB$BLOB_64_1</span>
b2 Blob<span class="token punctuation">(</span>8000<span class="token punctuation">,</span>2000<span class="token punctuation">,</span>0<span class="token punctuation">)</span> NULL AT<span class="token attr-value"><span class="token punctuation">=</span>MEDIUM_VAR</span> ST<span class="token attr-value"><span class="token punctuation">=</span>MEMORY</span> BV<span class="token attr-value"><span class="token punctuation">=</span>2</span> BT<span class="token attr-value"><span class="token punctuation">=</span>NDB$BLOB_64_2</span></em><span class="token attr-value"></span>
<span class="token property">--</span> Indexes <span class="token property">--</span>
PRIMARY KEY<span class="token punctuation">(</span>a<span class="token punctuation">)</span> - UniqueHashIndex
PRIMARY<span class="token punctuation">(</span>a<span class="token punctuation">)</span> - OrderedIndex</code></pre>
</div>
<p>
For
<code class="literal">
MAX_BLOB_PART_SIZE
</code>
, the
<code class="literal">
=
</code>
sign and the value following it are
optional. Using any value other than 0 or 1 results in a syntax
error.
</p>
<p>
The effect of using
<code class="literal">
MAX_BLOB_PART_SIZE
</code>
in a
column comment is to set the blob part size of a
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
column to the maximum number
of bytes supported for this by
<code class="literal">
NDB
</code>
(13948).
This option can be applied to any blob column type supported by
MySQL except
<code class="literal">
TINYBLOB
</code>
or
<code class="literal">
TINYTEXT
</code>
(
<code class="literal">
BLOB
</code>
,
<code class="literal">
MEDIUMBLOB
</code>
,
<code class="literal">
LONGBLOB
</code>
,
<code class="literal">
TEXT
</code>
,
<code class="literal">
MEDIUMTEXT
</code>
,
<code class="literal">
LONGTEXT
</code>
). Unlike
<code class="literal">
BLOB_INLINE_SIZE
</code>
,
<code class="literal">
MAX_BLOB_PART_SIZE
</code>
has no effect on
<code class="literal">
JSON
</code>
columns.
</p>
<p>
To see the effects of this option, we first run the following
SQL statement in the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client to create a
table with two
<code class="literal">
BLOB
</code>
columns, one
(
<code class="literal">
c1
</code>
) with no extra options, and another
(
<code class="literal">
c2
</code>
) with
<code class="literal">
MAX_BLOB_PART_SIZE
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18435639"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> test<span class="token punctuation">.</span>t2 <span class="token punctuation">(</span>
<span class="token prompt"> -></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>
<span class="token prompt"> -></span> c1 <span class="token datatype">BLOB</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> c2 <span class="token datatype">BLOB</span> <span class="token keyword">COMMENT</span> <span class="token string">'NDB_COLUMN=MAX_BLOB_PART_SIZE'</span>
<span class="token prompt"> -></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 output">Query OK, 0 rows affected (0.32 sec)</span></code></pre>
</div>
<p>
From the system shell, run the
<a class="link" href="mysql-cluster-programs-ndb-desc.html" title="25.5.9 ndb_desc — Describe NDB Tables">
<span class="command">
<strong>
ndb_desc
</strong>
</span>
</a>
utility to obtain information about the table just created, as
shown in this example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa75493080"><div class="copy-help left">Press ⌘+C to 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_desc</span> <span class="token property">-d</span> test t2
<span class="token property">--</span> t <span class="token property">--</span>
Version<span class="token punctuation">:</span> 1
Fragment type<span class="token punctuation">:</span> HashMapPartition
K Value<span class="token punctuation">:</span> 6
Min load factor<span class="token punctuation">:</span> 78
Max load factor<span class="token punctuation">:</span> 80
Temporary table<span class="token punctuation">:</span> no
Number of attributes<span class="token punctuation">:</span> 3
Number of primary keys<span class="token punctuation">:</span> 1
Length of frm data<span class="token punctuation">:</span> 324
Row Checksum<span class="token punctuation">:</span> 1
Row GCI<span class="token punctuation">:</span> 1
SingleUserMode<span class="token punctuation">:</span> 0
ForceVarPart<span class="token punctuation">:</span> 1
FragmentCount<span class="token punctuation">:</span> 2
ExtraRowGciBits<span class="token punctuation">:</span> 0
ExtraRowAuthorBits<span class="token punctuation">:</span> 0
TableStatus<span class="token punctuation">:</span> Retrieved
HashMap<span class="token punctuation">:</span> DEFAULT-HASHMAP-3840-2
<span class="token property">--</span> Attributes <span class="token property">--</span>
p Int PRIMARY KEY DISTRIBUTION KEY AT<span class="token attr-value"><span class="token punctuation">=</span>FIXED</span> ST<span class="token attr-value"><span class="token punctuation">=</span>MEMORY</span>
<em>c1 Blob<span class="token punctuation">(</span>256<span class="token punctuation">,</span>2000<span class="token punctuation">,</span>0<span class="token punctuation">)</span> NULL AT<span class="token attr-value"><span class="token punctuation">=</span>MEDIUM_VAR</span> ST<span class="token attr-value"><span class="token punctuation">=</span>MEMORY</span> BV<span class="token attr-value"><span class="token punctuation">=</span>2</span> BT<span class="token attr-value"><span class="token punctuation">=</span>NDB$BLOB_22_1</span>
c2 Blob<span class="token punctuation">(</span>256<span class="token punctuation">,</span>13948<span class="token punctuation">,</span>0<span class="token punctuation">)</span> NULL AT<span class="token attr-value"><span class="token punctuation">=</span>MEDIUM_VAR</span> ST<span class="token attr-value"><span class="token punctuation">=</span>MEMORY</span> BV<span class="token attr-value"><span class="token punctuation">=</span>2</span> BT<span class="token attr-value"><span class="token punctuation">=</span>NDB$BLOB_22_2</span></em><span class="token attr-value"></span>
<span class="token property">--</span> Indexes <span class="token property">--</span>
PRIMARY KEY<span class="token punctuation">(</span>p<span class="token punctuation">)</span> - UniqueHashIndex
PRIMARY<span class="token punctuation">(</span>p<span class="token punctuation">)</span> - OrderedIndex</code></pre>
</div>
<p>
Column information in the output is listed under
<code class="literal">
Attributes
</code>
; for columns
<code class="literal">
c1
</code>
and
<code class="literal">
c2
</code>
it is displayed here in emphasized
text. For
<code class="literal">
c1
</code>
, the blob part size is 2000, the
default value; for
<code class="literal">
c2
</code>
, it is 13948, as set by
<code class="literal">
MAX_BLOB_PART_SIZE
</code>
.
</p>
<p>
You can also query the
<code class="literal">
ndbinfo.blobs
</code>
table to
see this, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa3590333"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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 keyword">column_name</span> <span class="token keyword">AS</span> <span class="token string">'Column Name'</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> inline_size <span class="token keyword">AS</span> <span class="token string">'Inline Size'</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> part_size <span class="token keyword">AS</span> <span class="token string">'Blob Part Size'</span>
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> ndbinfo<span class="token punctuation">.</span>blobs
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> <span class="token keyword">table_name</span> <span class="token operator">=</span> <span class="token string">'t2'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Column Name <span class="token punctuation">|</span> Inline Size <span class="token punctuation">|</span> Blob Part 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>
<span class="token output"><span class="token punctuation">|</span> c1 <span class="token punctuation">|</span> 256 <span class="token punctuation">|</span> 2000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> c2 <span class="token punctuation">|</span> 256 <span class="token punctuation">|</span> 13948 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">2 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
You can change the blob part size for a given blob column of an
<code class="literal">
NDB
</code>
table using an
<code class="literal">
ALTER
TABLE
</code>
statement such as this one, and verifying the
changes afterwards using
<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>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa47003981"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> test<span class="token punctuation">.</span>t2
<span class="token prompt"> -></span> <span class="token keyword">DROP</span> <span class="token keyword">COLUMN</span> c1<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token keyword">ADD</span> <span class="token keyword">COLUMN</span> c1 <span class="token datatype">BLOB</span> <span class="token keyword">COMMENT</span> <span class="token string">'NDB_COLUMN=MAX_BLOB_PART_SIZE'</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token keyword">CHANGE</span> <span class="token keyword">COLUMN</span> c2 c2 <span class="token datatype">BLOB</span> <span class="token keyword">AFTER</span> c1<span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.47 sec)</span>
<span class="token output">Records: 0 Duplicates: 0 Warnings: 0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> test<span class="token punctuation">.</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> t
Create Table<span class="token punctuation">:</span> CREATE TABLE `t2` (
`p` int(11) NOT NULL,
`c1` blob COMMENT 'NDB_COLUMN=MAX_BLOB_PART_SIZE',
`c2` blob,
PRIMARY KEY (`p`)
) ENGINE=ndbcluster DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
</span><span class="token output">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">EXIT</span>
Bye</code></pre>
</div>
<p>
The output of
<a class="link" href="mysql-cluster-programs-ndb-desc.html" title="25.5.9 ndb_desc — Describe NDB Tables">
<span class="command">
<strong>
ndb_desc
</strong>
</span>
</a>
shows that the blob
part sizes of the columns have been changed as expected:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa2188808"><div class="copy-help left">Press ⌘+C to 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_desc</span> <span class="token property">-d</span> test t2
<span class="token property">--</span> t <span class="token property">--</span>
Version<span class="token punctuation">:</span> 16777220
Fragment type<span class="token punctuation">:</span> HashMapPartition
K Value<span class="token punctuation">:</span> 6
Min load factor<span class="token punctuation">:</span> 78
Max load factor<span class="token punctuation">:</span> 80
Temporary table<span class="token punctuation">:</span> no
Number of attributes<span class="token punctuation">:</span> 3
Number of primary keys<span class="token punctuation">:</span> 1
Length of frm data<span class="token punctuation">:</span> 324
Row Checksum<span class="token punctuation">:</span> 1
Row GCI<span class="token punctuation">:</span> 1
SingleUserMode<span class="token punctuation">:</span> 0
ForceVarPart<span class="token punctuation">:</span> 1
FragmentCount<span class="token punctuation">:</span> 2
ExtraRowGciBits<span class="token punctuation">:</span> 0
ExtraRowAuthorBits<span class="token punctuation">:</span> 0
TableStatus<span class="token punctuation">:</span> Retrieved
HashMap<span class="token punctuation">:</span> DEFAULT-HASHMAP-3840-2
<span class="token property">--</span> Attributes <span class="token property">--</span>
p Int PRIMARY KEY DISTRIBUTION KEY AT<span class="token attr-value"><span class="token punctuation">=</span>FIXED</span> ST<span class="token attr-value"><span class="token punctuation">=</span>MEMORY</span>
<em>c1 Blob<span class="token punctuation">(</span>256<span class="token punctuation">,</span>13948<span class="token punctuation">,</span>0<span class="token punctuation">)</span> NULL AT<span class="token attr-value"><span class="token punctuation">=</span>MEDIUM_VAR</span> ST<span class="token attr-value"><span class="token punctuation">=</span>MEMORY</span> BV<span class="token attr-value"><span class="token punctuation">=</span>2</span> BT<span class="token attr-value"><span class="token punctuation">=</span>NDB$BLOB_26_1</span>
c2 Blob<span class="token punctuation">(</span>256<span class="token punctuation">,</span>2000<span class="token punctuation">,</span>0<span class="token punctuation">)</span> NULL AT<span class="token attr-value"><span class="token punctuation">=</span>MEDIUM_VAR</span> ST<span class="token attr-value"><span class="token punctuation">=</span>MEMORY</span> BV<span class="token attr-value"><span class="token punctuation">=</span>2</span> BT<span class="token attr-value"><span class="token punctuation">=</span>NDB$BLOB_26_2</span></em><span class="token attr-value"></span>
<span class="token property">--</span> Indexes <span class="token property">--</span>
PRIMARY KEY<span class="token punctuation">(</span>p<span class="token punctuation">)</span> - UniqueHashIndex
PRIMARY<span class="token punctuation">(</span>p<span class="token punctuation">)</span> - OrderedIndex</code></pre>
</div>
<p>
You can also see the change by running the query against
<a class="link" href="mysql-cluster-ndbinfo-blobs.html" title="25.6.17.4 The ndbinfo blobs Table">
<code class="literal">
ndbinfo.blobs
</code>
</a>
again:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa80448279"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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 keyword">column_name</span> <span class="token keyword">AS</span> <span class="token string">'Column Name'</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> inline_size <span class="token keyword">AS</span> <span class="token string">'Inline Size'</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> part_size <span class="token keyword">AS</span> <span class="token string">'Blob Part Size'</span>
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> ndbinfo<span class="token punctuation">.</span>blobs
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> <span class="token keyword">table_name</span> <span class="token operator">=</span> <span class="token string">'t2'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Column Name <span class="token punctuation">|</span> Inline Size <span class="token punctuation">|</span> Blob Part 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>
<span class="token output"><span class="token punctuation">|</span> c1 <span class="token punctuation">|</span> 256 <span class="token punctuation">|</span> 13948 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> c2 <span class="token punctuation">|</span> 256 <span class="token punctuation">|</span> 2000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">2 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
It is possible to set both
<code class="literal">
BLOB_INLINE_SIZE
</code>
and
<code class="literal">
MAX_BLOB_PART_SIZE
</code>
for a blob column, as
shown in this
<code class="literal">
CREATE TABLE
</code>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa98439899"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> test<span class="token punctuation">.</span>t3 <span class="token punctuation">(</span>
<span class="token prompt"> -></span> p <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> c1 <span class="token datatype">JSON</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> c2 <span class="token datatype">JSON</span> <span class="token keyword">COMMENT</span> <span class="token string">'NDB_COLUMN=BLOB_INLINE_SIZE=5000,MAX_BLOB_PART_SIZE'</span>
<span class="token prompt"> -></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 output">Query OK, 0 rows affected (0.28 sec)</span></code></pre>
</div>
<p>
Querying the
<a class="link" href="mysql-cluster-ndbinfo-blobs.html" title="25.6.17.4 The ndbinfo blobs Table">
<code class="literal">
blobs
</code>
</a>
table shows
us that the statement worked as expected:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa75045884"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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 keyword">column_name</span> <span class="token keyword">AS</span> <span class="token string">'Column Name'</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> inline_size <span class="token keyword">AS</span> <span class="token string">'Inline Size'</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> part_size <span class="token keyword">AS</span> <span class="token string">'Blob Part Size'</span>
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> ndbinfo<span class="token punctuation">.</span>blobs
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> <span class="token keyword">table_name</span> <span class="token operator">=</span> <span class="token string">'t3'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Column Name <span class="token punctuation">|</span> Inline Size <span class="token punctuation">|</span> Blob Part 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>
<span class="token output"><span class="token punctuation">|</span> c1 <span class="token punctuation">|</span> 4000 <span class="token punctuation">|</span> 8100 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> c2 <span class="token punctuation">|</span> 5000 <span class="token punctuation">|</span> 8100 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">2 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
You can also verify that the statement worked by checking the
output of
<a class="link" href="mysql-cluster-programs-ndb-desc.html" title="25.5.9 ndb_desc — Describe NDB Tables">
<span class="command">
<strong>
ndb_desc
</strong>
</span>
</a>
.
</p>
<p>
Changing a column's blob part size must be done using a
copying
<code class="literal">
ALTER TABLE
</code>
; this operation cannot be
performed online (see
<a class="xref" href="mysql-cluster-online-operations.html" title="25.6.12 Online Operations with ALTER TABLE in NDB Cluster">
Section 25.6.12, “Online Operations with ALTER TABLE in NDB Cluster”
</a>
).
</p>
<p>
For more information about how
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
stores columns of blob types, see
<a class="xref" href="storage-requirements.html#data-types-storage-reqs-strings" title="String Type Storage Requirements">
String Type Storage Requirements
</a>
.
</p>
<h5>
<a name="create-table-ndb-comment-table-options">
</a>
NDB_TABLE Options
</h5>
<p>
<a class="indexterm" name="idm46045184242880">
</a>
<a class="indexterm" name="idm46045184241808">
</a>
<a class="indexterm" name="idm46045184240320">
</a>
<a class="indexterm" name="idm46045184239248">
</a>
<a class="indexterm" name="idm46045184238176">
</a>
For an NDB Cluster table, the table comment in a
<code class="literal">
CREATE
TABLE
</code>
or
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statement can also be used to specify an
<code class="literal">
NDB_TABLE
</code>
option, which consists of one or
more name-value pairs, separated by commas if need be, following
the string
<code class="literal">
NDB_TABLE=
</code>
. Complete syntax for
names and values syntax is shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa52204773"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">COMMENT</span><span class="token operator">=</span><span class="token string">"NDB_TABLE=<em class="replaceable">ndb_table_option</em>[,<em class="replaceable">ndb_table_option</em>[,...]]"</span>
<em class="replaceable">ndb_table_option</em>: {
NOLOGGING<span class="token operator">=</span>{<span class="token number">1</span> <span class="token operator">|</span> <span class="token number">0</span>}
<span class="token operator">|</span> READ_BACKUP<span class="token operator">=</span>{<span class="token number">1</span> <span class="token operator">|</span> <span class="token number">0</span>}
<span class="token operator">|</span> PARTITION_BALANCE<span class="token operator">=</span>{FOR_RP_BY_NODE <span class="token operator">|</span> FOR_RA_BY_NODE <span class="token operator">|</span> FOR_RP_BY_LDM
<span class="token operator">|</span> FOR_RA_BY_LDM <span class="token operator">|</span> FOR_RA_BY_LDM_X_2
<span class="token operator">|</span> FOR_RA_BY_LDM_X_3 <span class="token operator">|</span> FOR_RA_BY_LDM_X_4}
<span class="token operator">|</span> FULLY_REPLICATED<span class="token operator">=</span>{<span class="token number">1</span> <span class="token operator">|</span> <span class="token number">0</span>}
}</code></pre>
</div>
<p>
Spaces are not permitted within the quoted string. The string is
case-insensitive.
</p>
<p>
The four
<code class="literal">
NDB
</code>
table options that can be set as
part of a comment in this way are described in more detail in
the next few paragraphs.
</p>
<p>
<a class="indexterm" name="idm46045184228832">
</a>
<a class="indexterm" name="idm46045184227344">
</a>
<a class="indexterm" name="idm46045184225856">
</a>
<code class="literal">
NOLOGGING
</code>
: By default,
<code class="literal">
NDB
</code>
tables are logged, and checkpointed. This makes them durable to
whole cluster failures. Using
<code class="literal">
NOLOGGING
</code>
when
creating or altering a table means that this table is not redo
logged or included in local checkpoints. In this case, the table
is still replicated across the data nodes for high availability,
and updated using transactions, but changes made to it are not
recorded in the data node's redo logs, and its content is
not checkpointed to disk; when recovering from a cluster
failure, the cluster retains the table definition, but none of
its rows—that is, the table is empty.
</p>
<p>
Using such nonlogging tables reduces the data node's
demands on disk I/O and storage, as well as CPU for
checkpointing CPU. This may be suitable for short-lived data
which is frequently updated, and where the loss of all data in
the unlikely event of a total cluster failure is acceptable.
</p>
<p>
It is also possible to use the
<a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_table_no_logging">
<code class="literal">
ndb_table_no_logging
</code>
</a>
system
variable to cause any NDB tables created or altered while this
variable is in effect to behave as though it had been created
with the
<code class="literal">
NOLOGGING
</code>
comment. Unlike when using
the comment directly, there is nothing in this case in the
output of
<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
indicate that it is a nonlogging table. Using the table comment
approach is recommended since it offers per-table control of the
feature, and this aspect of the table schema is embedded in the
table creation statement where it can be found easily by
SQL-based tools.
</p>
<p>
<a class="indexterm" name="idm46045184215728">
</a>
<a class="indexterm" name="idm46045184214240">
</a>
<a class="indexterm" name="idm46045184212752">
</a>
<code class="literal">
READ_BACKUP
</code>
: Setting this option to 1 has the
same effect as though
<a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_read_backup">
<code class="literal">
ndb_read_backup
</code>
</a>
were enabled;
enables reading from any replica. Doing so greatly improves the
performance of reads from the table at a relatively small cost
to write performance. 1 is the default for
<code class="literal">
READ_BACKUP
</code>
, and the default for
<a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_read_backup">
<code class="literal">
ndb_read_backup
</code>
</a>
is
<code class="literal">
ON
</code>
(previously, read from any replica was
disabled by default).
</p>
<p>
You can set
<code class="literal">
READ_BACKUP
</code>
for an existing table
online, using an
<code class="literal">
ALTER TABLE
</code>
statement
similar to one of those shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa14359515"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> <span class="token punctuation">.</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> <span class="token keyword">COMMENT</span><span class="token operator">=</span><span class="token string">"NDB_TABLE=READ_BACKUP=1"</span><span class="token punctuation">;</span>
<span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> <span class="token punctuation">.</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> <span class="token keyword">COMMENT</span><span class="token operator">=</span><span class="token string">"NDB_TABLE=READ_BACKUP=0"</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For more information about the
<code class="literal">
ALGORITHM
</code>
option for
<code class="literal">
ALTER TABLE
</code>
, see
<a class="xref" href="mysql-cluster-online-operations.html" title="25.6.12 Online Operations with ALTER TABLE in NDB Cluster">
Section 25.6.12, “Online Operations with ALTER TABLE in NDB Cluster”
</a>
.
</p>
<p>
<a class="indexterm" name="idm46045184200304">
</a>
<a class="indexterm" name="idm46045184198848">
</a>
<a class="indexterm" name="idm46045184197344">
</a>
<code class="literal">
PARTITION_BALANCE
</code>
: Provides additional
control over assignment and placement of partitions. The
following four schemes are supported:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
<code class="literal">
FOR_RP_BY_NODE
</code>
: One partition per node.
</p>
<p>
Only one LDM on each node stores a primary partition. Each
partition is stored in the same LDM (same ID) on all nodes.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
FOR_RA_BY_NODE
</code>
: One partition per node
group.
</p>
<p>
Each node stores a single partition, which can be either a
primary replica or a backup replica. Each partition is
stored in the same LDM on all nodes.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
FOR_RP_BY_LDM
</code>
: One partition for each LDM
on each node; the default.
</p>
<p>
This is the setting used if
<code class="literal">
READ_BACKUP
</code>
is set to 1.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
FOR_RA_BY_LDM
</code>
: One partition per LDM in
each node group.
</p>
<p>
These partitions can be primary or backup partitions.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
FOR_RA_BY_LDM_X_2
</code>
: Two partitions per LDM
in each node group.
</p>
<p>
These partitions can be primary or backup partitions.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
FOR_RA_BY_LDM_X_3
</code>
: Three partitions per
LDM in each node group.
</p>
<p>
These partitions can be primary or backup partitions.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
FOR_RA_BY_LDM_X_4
</code>
: Four partitions per
LDM in each node group.
</p>
<p>
These partitions can be primary or backup partitions.
</p>
</li>
</ol>
</div>
<p>
<code class="literal">
PARTITION_BALANCE
</code>
is the preferred interface
for setting the number of partitions per table. Using
<code class="literal">
MAX_ROWS
</code>
to force the number of partitions is
deprecated but continues to be supported for backward
compatibility; it is subject to removal in a future release of
MySQL NDB Cluster. (Bug #81759, Bug #23544301)
</p>
<p>
<a class="indexterm" name="idm46045184176560">
</a>
<a class="indexterm" name="idm46045184175056">
</a>
<code class="literal">
FULLY_REPLICATED
</code>
controls whether the table
is fully replicated, that is, whether each data node has a
complete copy of the table. To enable full replication of the
table, use
<code class="literal">
FULLY_REPLICATED=1
</code>
.
</p>
<p>
This setting can also be controlled using the
<code class="literal">
ndb_fully_replicated
</code>
system variable. Setting
it to
<code class="literal">
ON
</code>
enables the option by default for
all new
<code class="literal">
NDB
</code>
tables; the default is
<code class="literal">
OFF
</code>
. The
<a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_data_node_neighbour">
<code class="literal">
ndb_data_node_neighbour
</code>
</a>
system
variable is also used for fully replicated tables, to ensure
that when a fully replicated table is accessed, we access the
data node which is local to this MySQL Server.
</p>
<p>
An example of a
<code class="literal">
CREATE TABLE
</code>
statement using
such a comment when creating an
<code class="literal">
NDB
</code>
table is
shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa4452154"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>
<span class="token operator">></span> c1 <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">AUTO_INCREMENT</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">,</span>
<span class="token operator">></span> c2 <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token operator">></span> c3 <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 punctuation">)</span>
<span class="token operator">></span> <span class="token keyword">ENGINE</span><span class="token operator">=</span><span class="token keyword">NDB</span>
<span class="token operator">></span>
<span class="token keyword">COMMENT</span><span class="token operator">=</span><span class="token string">"NDB_TABLE=READ_BACKUP=0,PARTITION_BALANCE=FOR_RP_BY_NODE"</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The comment is displayed as part of the output of
<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>
. The text of
the comment is also available from querying the MySQL
Information Schema
<a class="link" href="information-schema-tables-table.html" title="28.3.38 The INFORMATION_SCHEMA TABLES Table">
<code class="literal">
TABLES
</code>
</a>
table, as
in this example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa70016070"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">TABLE_NAME</span><span class="token punctuation">,</span> TABLE_SCHEMA<span class="token punctuation">,</span> TABLE_COMMENT
<span class="token operator">></span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">TABLES</span> <span class="token keyword">WHERE</span> <span class="token keyword">TABLE_NAME</span><span class="token operator">=</span><span class="token string">"t1"</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
TABLE_NAME<span class="token punctuation">:</span> t1
TABLE_SCHEMA<span class="token punctuation">:</span> test
TABLE_COMMENT<span class="token punctuation">:</span> NDB_TABLE=READ_BACKUP=0,PARTITION_BALANCE=FOR_RP_BY_NODE
</span><span class="token output">1 row in set (0.01 sec)</span></code></pre>
</div>
<p>
This comment syntax is also supported with
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statements for
<code class="literal">
NDB
</code>
tables, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa6391331"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">COMMENT</span><span class="token operator">=</span><span class="token string">"NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_NODE"</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.40 sec)</span>
<span class="token output">Records: 0 Duplicates: 0 Warnings: 0</span></code></pre>
</div>
<p>
The
<code class="literal">
TABLE_COMMENT
</code>
column displays the comment
that is required to re-create the table as it is following the
<code class="literal">
ALTER TABLE
</code>
statement, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa16868038"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">TABLE_NAME</span><span class="token punctuation">,</span> TABLE_SCHEMA<span class="token punctuation">,</span> TABLE_COMMENT
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">TABLES</span> <span class="token keyword">WHERE</span> <span class="token keyword">TABLE_NAME</span><span class="token operator">=</span><span class="token string">"t1"</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
TABLE_NAME<span class="token punctuation">:</span> t1
TABLE_SCHEMA<span class="token punctuation">:</span> test
TABLE_COMMENT<span class="token punctuation">:</span> NDB_TABLE=READ_BACKUP=0,PARTITION_BALANCE=FOR_RP_BY_NODE
</span><span class="token output">1 row in set (0.01 sec)</span></code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa38318090"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">TABLE_NAME</span><span class="token punctuation">,</span> TABLE_SCHEMA<span class="token punctuation">,</span> TABLE_COMMENT
<span class="token operator">></span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">TABLES</span> <span class="token keyword">WHERE</span> <span class="token keyword">TABLE_NAME</span><span class="token operator">=</span><span class="token string">"t1"</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> TABLE_NAME <span class="token punctuation">|</span> TABLE_SCHEMA <span class="token punctuation">|</span> TABLE_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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> t1 <span class="token punctuation">|</span> c <span class="token punctuation">|</span> NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_NODE <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> t1 <span class="token punctuation">|</span> d <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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.01 sec)</span></code></pre>
</div>
<p>
Keep in mind that a table comment used with
<code class="literal">
ALTER
TABLE
</code>
replaces any existing comment which the table
might have.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa40273645"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">COMMENT</span><span class="token operator">=</span><span class="token string">"NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_NODE"</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.40 sec)</span>
<span class="token output">Records: 0 Duplicates: 0 Warnings: 0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">TABLE_NAME</span><span class="token punctuation">,</span> TABLE_SCHEMA<span class="token punctuation">,</span> TABLE_COMMENT
<span class="token operator">></span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">TABLES</span> <span class="token keyword">WHERE</span> <span class="token keyword">TABLE_NAME</span><span class="token operator">=</span><span class="token string">"t1"</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> TABLE_NAME <span class="token punctuation">|</span> TABLE_SCHEMA <span class="token punctuation">|</span> TABLE_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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> t1 <span class="token punctuation">|</span> c <span class="token punctuation">|</span> NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_NODE <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> t1 <span class="token punctuation">|</span> d <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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.01 sec)</span></code></pre>
</div>
<p>
You can also see the value of the
<code class="literal">
PARTITION_BALANCE
</code>
option in the output of
<a class="link" href="mysql-cluster-programs-ndb-desc.html" title="25.5.9 ndb_desc — Describe NDB Tables">
<span class="command">
<strong>
ndb_desc
</strong>
</span>
</a>
.
<a class="link" href="mysql-cluster-programs-ndb-desc.html" title="25.5.9 ndb_desc — Describe NDB Tables">
<span class="command">
<strong>
ndb_desc
</strong>
</span>
</a>
also
shows whether the
<code class="literal">
READ_BACKUP
</code>
and
<code class="literal">
FULLY_REPLICATED
</code>
options are set for the
table. See the description of this program for more information.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/plugin-loading.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="plugin-loading">
</a>
7.6.1 Installing and Uninstalling Plugins
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045257098720">
</a>
<a class="indexterm" name="idm46045257097680">
</a>
<a class="indexterm" name="idm46045257096192">
</a>
<a class="indexterm" name="idm46045257095120">
</a>
<a class="indexterm" name="idm46045257093632">
</a>
<a class="indexterm" name="idm46045257092560">
</a>
<p>
Server plugins must be loaded into the server before they can be
used. MySQL supports plugin loading at server startup and runtime.
It is also possible to control the activation state of loaded
plugins at startup, and to unload them at runtime.
</p>
<p>
While a plugin is loaded, information about it is available as
described in
<a class="xref" href="obtaining-plugin-information.html" title="7.6.2 Obtaining Server Plugin Information">
Section 7.6.2, “Obtaining Server Plugin Information”
</a>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="plugin-loading.html#server-plugin-installing" title="Installing Plugins">
Installing Plugins
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="plugin-loading.html#server-plugin-activating" title="Controlling Plugin Activation State">
Controlling Plugin Activation State
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="plugin-loading.html#server-plugin-uninstalling" title="Uninstalling Plugins">
Uninstalling Plugins
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="plugin-loading.html#server-plugin-loadable-function-installing" title="Plugins and Loadable Functions">
Plugins and Loadable Functions
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="server-plugin-installing">
</a>
Installing Plugins
</h4>
</div>
</div>
</div>
<p>
Before a server plugin can be used, it must be installed using
one of the following methods. In the descriptions,
<em class="replaceable">
<code>
plugin_name
</code>
</em>
stands for a plugin name
such as
<code class="literal">
innodb
</code>
,
<code class="literal">
csv
</code>
, or
<code class="literal">
validate_password
</code>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="plugin-loading.html#server-plugin-installing-built-in" title="Built-in Plugins">
Built-in Plugins
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="plugin-loading.html#server-plugin-installing-system-table" title="Plugins Registered in the mysql.plugin System Table">
Plugins Registered in the mysql.plugin System Table
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="plugin-loading.html#server-plugin-installing-command-line" title="Plugins Named with Command-Line Options">
Plugins Named with Command-Line Options
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="plugin-loading.html#server-plugin-installing-install-plugin" title="Plugins Installed with the INSTALL PLUGIN Statement">
Plugins Installed with the INSTALL PLUGIN Statement
</a>
</p>
</li>
</ul>
</div>
<h5>
<a name="server-plugin-installing-built-in">
</a>
Built-in Plugins
</h5>
<p>
A built-in plugin is known by the server automatically. By
default, the server enables the plugin at startup. Some built-in
plugins permit this to be changed with the
<code class="option">
--
<em class="replaceable">
<code>
plugin_name
</code>
</em>
[=
<em class="replaceable">
<code>
activation_state
</code>
</em>
]
</code>
option.
</p>
<h5>
<a name="server-plugin-installing-system-table">
</a>
Plugins Registered in the mysql.plugin System Table
</h5>
<p>
The
<code class="literal">
mysql.plugin
</code>
system table serves as a
registry of plugins (other than built-in plugins, which need not
be registered). During the normal startup sequence, the server
loads plugins registered in the table. By default, for a plugin
loaded from the
<code class="literal">
mysql.plugin
</code>
table, the
server also enables the plugin. This can be changed with the
<code class="option">
--
<em class="replaceable">
<code>
plugin_name
</code>
</em>
[=
<em class="replaceable">
<code>
activation_state
</code>
</em>
]
</code>
option.
</p>
<p>
If the server is started with the
<a class="link" href="server-options.html#option_mysqld_skip-grant-tables">
<code class="option">
--skip-grant-tables
</code>
</a>
option,
plugins registered in the
<code class="literal">
mysql.plugin
</code>
table
are not loaded and are unavailable.
</p>
<h5>
<a name="server-plugin-installing-command-line">
</a>
Plugins Named with Command-Line Options
</h5>
<p>
A plugin located in a plugin library file can be loaded at
server startup with the
<a class="link" href="server-options.html#option_mysqld_plugin-load">
<code class="option">
--plugin-load
</code>
</a>
,
<a class="link" href="server-options.html#option_mysqld_plugin-load-add">
<code class="option">
--plugin-load-add
</code>
</a>
, or
<a class="link" href="server-options.html#option_mysqld_early-plugin-load">
<code class="option">
--early-plugin-load
</code>
</a>
option.
Normally, for a plugin loaded at startup, the server also
enables the plugin. This can be changed with the
<code class="option">
--
<em class="replaceable">
<code>
plugin_name
</code>
</em>
[=
<em class="replaceable">
<code>
activation_state
</code>
</em>
]
</code>
option.
</p>
<p>
The
<a class="link" href="server-options.html#option_mysqld_plugin-load">
<code class="option">
--plugin-load
</code>
</a>
and
<a class="link" href="server-options.html#option_mysqld_plugin-load-add">
<code class="option">
--plugin-load-add
</code>
</a>
options load
plugins after built-in plugins and storage engines have
initialized during the server startup sequence. The
<a class="link" href="server-options.html#option_mysqld_early-plugin-load">
<code class="option">
--early-plugin-load
</code>
</a>
option is
used to load plugins that must be available prior to
initialization of built-in plugins and storage engines.
</p>
<p>
The value of each plugin-loading option is a semicolon-separated
list of
<em class="replaceable">
<code>
plugin_library
</code>
</em>
and
<em class="replaceable">
<code>
name
</code>
</em>
<code class="literal">
=
</code>
<em class="replaceable">
<code>
plugin_library
</code>
</em>
values. Each
<em class="replaceable">
<code>
plugin_library
</code>
</em>
is the
name of a library file that contains plugin code, and each
<em class="replaceable">
<code>
name
</code>
</em>
is the name of a plugin to load.
If a plugin library is named without any preceding plugin name,
the server loads all plugins in the library. With a preceding
plugin name, the server loads only the named plugin from the
library. The server looks for plugin library files in the
directory named by the
<a class="link" href="server-system-variables.html#sysvar_plugin_dir">
<code class="literal">
plugin_dir
</code>
</a>
system variable.
</p>
<p>
Plugin-loading options do not register any plugin in the
<code class="literal">
mysql.plugin
</code>
table. For subsequent restarts,
the server loads the plugin again only if
<a class="link" href="server-options.html#option_mysqld_plugin-load">
<code class="option">
--plugin-load
</code>
</a>
,
<a class="link" href="server-options.html#option_mysqld_plugin-load-add">
<code class="option">
--plugin-load-add
</code>
</a>
, or
<a class="link" href="server-options.html#option_mysqld_early-plugin-load">
<code class="option">
--early-plugin-load
</code>
</a>
is given
again. That is, the option produces a one-time
plugin-installation operation that persists for a single server
invocation.
</p>
<p>
<a class="link" href="server-options.html#option_mysqld_plugin-load">
<code class="option">
--plugin-load
</code>
</a>
,
<a class="link" href="server-options.html#option_mysqld_plugin-load-add">
<code class="option">
--plugin-load-add
</code>
</a>
, and
<a class="link" href="server-options.html#option_mysqld_early-plugin-load">
<code class="option">
--early-plugin-load
</code>
</a>
enable
plugins to be loaded even when
<a class="link" href="server-options.html#option_mysqld_skip-grant-tables">
<code class="option">
--skip-grant-tables
</code>
</a>
is given
(which causes the server to ignore the
<code class="literal">
mysql.plugin
</code>
table).
<a class="link" href="server-options.html#option_mysqld_plugin-load">
<code class="option">
--plugin-load
</code>
</a>
,
<a class="link" href="server-options.html#option_mysqld_plugin-load-add">
<code class="option">
--plugin-load-add
</code>
</a>
, and
<a class="link" href="server-options.html#option_mysqld_early-plugin-load">
<code class="option">
--early-plugin-load
</code>
</a>
also enable
plugins to be loaded at startup that cannot be loaded at
runtime.
</p>
<p>
The
<a class="link" href="server-options.html#option_mysqld_plugin-load-add">
<code class="option">
--plugin-load-add
</code>
</a>
option
complements the
<a class="link" href="server-options.html#option_mysqld_plugin-load">
<code class="option">
--plugin-load
</code>
</a>
option:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Each instance of
<a class="link" href="server-options.html#option_mysqld_plugin-load">
<code class="option">
--plugin-load
</code>
</a>
resets the set
of plugins to load at startup, whereas
<a class="link" href="server-options.html#option_mysqld_plugin-load-add">
<code class="option">
--plugin-load-add
</code>
</a>
adds a
plugin or plugins to the set of plugins to be loaded without
resetting the current set. Consequently, if multiple
instances of
<a class="link" href="server-options.html#option_mysqld_plugin-load">
<code class="option">
--plugin-load
</code>
</a>
are specified, only the last one applies. With multiple
instances of
<a class="link" href="server-options.html#option_mysqld_plugin-load-add">
<code class="option">
--plugin-load-add
</code>
</a>
, all of
them apply.
</p>
</li>
<li class="listitem">
<p>
The argument format is the same as for
<a class="link" href="server-options.html#option_mysqld_plugin-load">
<code class="option">
--plugin-load
</code>
</a>
, but multiple
instances of
<a class="link" href="server-options.html#option_mysqld_plugin-load-add">
<code class="option">
--plugin-load-add
</code>
</a>
can be used
to avoid specifying a large set of plugins as a single long
unwieldy
<a class="link" href="server-options.html#option_mysqld_plugin-load">
<code class="option">
--plugin-load
</code>
</a>
argument.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-options.html#option_mysqld_plugin-load-add">
<code class="option">
--plugin-load-add
</code>
</a>
can be
given in the absence of
<a class="link" href="server-options.html#option_mysqld_plugin-load">
<code class="option">
--plugin-load
</code>
</a>
, but any
instance of
<a class="link" href="server-options.html#option_mysqld_plugin-load-add">
<code class="option">
--plugin-load-add
</code>
</a>
that appears before
<a class="link" href="server-options.html#option_mysqld_plugin-load">
<code class="option">
--plugin-load
</code>
</a>
has no effect
because
<a class="link" href="server-options.html#option_mysqld_plugin-load">
<code class="option">
--plugin-load
</code>
</a>
resets
the set of plugins to load.
</p>
</li>
</ul>
</div>
<p>
For example, these options:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa44252061"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token constant">--plugin-load</span><span class="token attr-value"><span class="token punctuation">=</span>x</span> <span class="token constant">--plugin-load-add</span><span class="token attr-value"><span class="token punctuation">=</span>y</span></code></pre>
</div>
<p>
are equivalent to these options:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa74990702"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token constant">--plugin-load-add</span><span class="token attr-value"><span class="token punctuation">=</span>x</span> <span class="token constant">--plugin-load-add</span><span class="token attr-value"><span class="token punctuation">=</span>y</span></code></pre>
</div>
<p>
and are also equivalent to this option:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa95116440"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token constant">--plugin-load</span>=<span class="token atrule">"x;y"</span></code></pre>
</div>
<p>
But these options:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa83782347"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token constant">--plugin-load-add</span><span class="token attr-value"><span class="token punctuation">=</span>y</span> <span class="token constant">--plugin-load</span><span class="token attr-value"><span class="token punctuation">=</span>x</span></code></pre>
</div>
<p>
are equivalent to this option:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa69693156"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token constant">--plugin-load</span><span class="token attr-value"><span class="token punctuation">=</span>x</span></code></pre>
</div>
<h5>
<a name="server-plugin-installing-install-plugin">
</a>
Plugins Installed with the INSTALL PLUGIN Statement
</h5>
<p>
A plugin located in a plugin library file can be loaded at
runtime with the
<a class="link" href="install-plugin.html" title="15.7.4.4 INSTALL PLUGIN Statement">
<code class="literal">
INSTALL PLUGIN
</code>
</a>
statement. The statement also registers the plugin in the
<code class="literal">
mysql.plugin
</code>
table to cause the server to
load it on subsequent restarts. For this reason,
<a class="link" href="install-plugin.html" title="15.7.4.4 INSTALL PLUGIN Statement">
<code class="literal">
INSTALL PLUGIN
</code>
</a>
requires the
<a class="link" href="privileges-provided.html#priv_insert">
<code class="literal">
INSERT
</code>
</a>
privilege for the
<code class="literal">
mysql.plugin
</code>
table.
</p>
<p>
The plugin library file base name depends on your platform.
Common suffixes are
<code class="filename">
.so
</code>
for Unix and
Unix-like systems,
<code class="filename">
.dll
</code>
for Windows.
</p>
<p>
Example: The
<a class="link" href="server-options.html#option_mysqld_plugin-load-add">
<code class="option">
--plugin-load-add
</code>
</a>
option installs a plugin at server startup. To install a plugin
named
<code class="literal">
myplugin
</code>
from a plugin library file
named
<code class="filename">
somepluglib.so
</code>
, use these lines in a
<code class="filename">
my.cnf
</code>
file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa84251377"><div class="copy-help left">Press ⌘+C to 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">plugin-load-add</span><span class="token attr-value"><span class="token punctuation">=</span>myplugin=somepluglib.so</span></code></pre>
</div>
<p>
In this case, the plugin is not registered in
<code class="literal">
mysql.plugin
</code>
. Restarting the server without
the
<a class="link" href="server-options.html#option_mysqld_plugin-load-add">
<code class="option">
--plugin-load-add
</code>
</a>
option
causes the plugin not to be loaded at startup.
</p>
<p>
Alternatively, the
<a class="link" href="install-plugin.html" title="15.7.4.4 INSTALL PLUGIN Statement">
<code class="literal">
INSTALL PLUGIN
</code>
</a>
statement causes the server to load the plugin code from the
library file at runtime:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa62193990"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">INSTALL</span> <span class="token keyword">PLUGIN</span> myplugin <span class="token keyword">SONAME</span> <span class="token string">'somepluglib.so'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<a class="link" href="install-plugin.html" title="15.7.4.4 INSTALL PLUGIN Statement">
<code class="literal">
INSTALL PLUGIN
</code>
</a>
also causes
<span class="quote">
“
<span class="quote">
permanent
</span>
”
</span>
plugin registration: The plugin is
listed in the
<code class="literal">
mysql.plugin
</code>
table to ensure
that the server loads it on subsequent restarts.
</p>
<p>
Many plugins can be loaded either at server startup or at
runtime. However, if a plugin is designed such that it must be
loaded and initialized during server startup, attempts to load
it at runtime using
<a class="link" href="install-plugin.html" title="15.7.4.4 INSTALL PLUGIN Statement">
<code class="literal">
INSTALL
PLUGIN
</code>
</a>
produce an error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa13534682"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">INSTALL</span> <span class="token keyword">PLUGIN</span> myplugin <span class="token keyword">SONAME</span> <span class="token string">'somepluglib.so'</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1721 (HY000)<span class="token punctuation">:</span> Plugin 'myplugin' is marked as not dynamically
installable. You have to stop the server to install it.</span></code></pre>
</div>
<p>
In this case, you must use
<a class="link" href="server-options.html#option_mysqld_plugin-load">
<code class="option">
--plugin-load
</code>
</a>
,
<a class="link" href="server-options.html#option_mysqld_plugin-load-add">
<code class="option">
--plugin-load-add
</code>
</a>
, or
<a class="link" href="server-options.html#option_mysqld_early-plugin-load">
<code class="option">
--early-plugin-load
</code>
</a>
.
</p>
<p>
If a plugin is named both using a
<a class="link" href="server-options.html#option_mysqld_plugin-load">
<code class="option">
--plugin-load
</code>
</a>
,
<a class="link" href="server-options.html#option_mysqld_plugin-load-add">
<code class="option">
--plugin-load-add
</code>
</a>
, or
<a class="link" href="server-options.html#option_mysqld_early-plugin-load">
<code class="option">
--early-plugin-load
</code>
</a>
option and
(as a result of an earlier
<a class="link" href="install-plugin.html" title="15.7.4.4 INSTALL PLUGIN Statement">
<code class="literal">
INSTALL
PLUGIN
</code>
</a>
statement) in the
<code class="literal">
mysql.plugin
</code>
table, the server starts but
writes these messages to the error log:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa71322025"><div class="copy-help left">Press ⌘+C to 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] Function '<em class="replaceable">plugin_name</em>' already exists
[Warning] Couldn't load plugin named '<em class="replaceable">plugin_name</em>'
with soname '<em class="replaceable">plugin_object_file</em>'.</code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="server-plugin-activating">
</a>
Controlling Plugin Activation State
</h4>
</div>
</div>
</div>
<p>
If the server knows about a plugin when it starts (for example,
because the plugin is named using a
<a class="link" href="server-options.html#option_mysqld_plugin-load-add">
<code class="option">
--plugin-load-add
</code>
</a>
option or is
registered in the
<code class="literal">
mysql.plugin
</code>
table), the
server loads and enables the plugin by default. It is possible
to control activation state for such a plugin using a
<code class="literal">
--
<em class="replaceable">
<code>
plugin_name
</code>
</em>
[=
<em class="replaceable">
<code>
activation_state
</code>
</em>
]
</code>
startup option, where
<em class="replaceable">
<code>
plugin_name
</code>
</em>
is
the name of the plugin to affect, such as
<code class="literal">
innodb
</code>
,
<code class="literal">
csv
</code>
, or
<code class="literal">
validate_password
</code>
. As with other options,
dashes and underscores are interchangeable in option names.
Also, activation state values are not case-sensitive. For
example,
<code class="option">
--my_plugin=ON
</code>
and
<code class="option">
--my-plugin=on
</code>
are equivalent.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="option">
--
<em class="replaceable">
<code>
plugin_name
</code>
</em>
=OFF
</code>
</p>
<a class="indexterm" name="idm46045256966784">
</a>
<a class="indexterm" name="idm46045256965312">
</a>
<p>
Tells the server to disable the plugin. Using this option,
you can disable, for example, the deprecated
<code class="literal">
mysql_native_password
</code>
plugin at server
startup.
</p>
</li>
<li class="listitem">
<p>
<code class="option">
--
<em class="replaceable">
<code>
plugin_name
</code>
</em>
[=ON]
</code>
</p>
<a class="indexterm" name="idm46045256960944">
</a>
<a class="indexterm" name="idm46045256959472">
</a>
<p>
Tells the server to enable the plugin. (Specifying the
option as
<code class="option">
--
<em class="replaceable">
<code>
plugin_name
</code>
</em>
</code>
without a value has the same effect.) If the plugin fails to
initialize, the server runs with the plugin disabled.
</p>
</li>
<li class="listitem">
<p>
<code class="option">
--
<em class="replaceable">
<code>
plugin_name
</code>
</em>
=FORCE
</code>
</p>
<a class="indexterm" name="idm46045256955072">
</a>
<a class="indexterm" name="idm46045256953568">
</a>
<p>
Tells the server to enable the plugin, but if plugin
initialization fails, the server does not start. In other
words, this option forces the server to run with the plugin
enabled or not at all.
</p>
</li>
<li class="listitem">
<p>
<code class="option">
--
<em class="replaceable">
<code>
plugin_name
</code>
</em>
=FORCE_PLUS_PERMANENT
</code>
</p>
<a class="indexterm" name="idm46045256949808">
</a>
<a class="indexterm" name="idm46045256948304">
</a>
<p>
Like
<code class="literal">
FORCE
</code>
, but in addition prevents the
plugin from being unloaded at runtime. If a user attempts to
do so with
<a class="link" href="uninstall-plugin.html" title="15.7.4.6 UNINSTALL PLUGIN Statement">
<code class="literal">
UNINSTALL PLUGIN
</code>
</a>
,
an error occurs.
</p>
</li>
</ul>
</div>
<p>
Plugin activation states are visible in the
<code class="literal">
LOAD_OPTION
</code>
column of the Information Schema
<a class="link" href="information-schema-plugins-table.html" title="28.3.22 The INFORMATION_SCHEMA PLUGINS Table">
<code class="literal">
PLUGINS
</code>
</a>
table.
</p>
<p>
Suppose that
<code class="literal">
CSV
</code>
,
<code class="literal">
BLACKHOLE
</code>
, and
<code class="literal">
ARCHIVE
</code>
are
built-in pluggable storage engines and that you want the server
to load them at startup, subject to these conditions: The server
is permitted to run if
<code class="literal">
CSV
</code>
initialization
fails, must require that
<code class="literal">
BLACKHOLE
</code>
initialization succeeds, and should disable
<code class="literal">
ARCHIVE
</code>
. To accomplish that, use these lines
in an option file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa39602780"><div class="copy-help left">Press ⌘+C to 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">csv</span><span class="token attr-value"><span class="token punctuation">=</span>ON</span>
<span class="token constant">blackhole</span><span class="token attr-value"><span class="token punctuation">=</span>FORCE</span>
<span class="token constant">archive</span><span class="token attr-value"><span class="token punctuation">=</span>OFF</span></code></pre>
</div>
<p>
The
<code class="option">
--enable-
<em class="replaceable">
<code>
plugin_name
</code>
</em>
</code>
option format is a synonym for
<code class="option">
--
<em class="replaceable">
<code>
plugin_name
</code>
</em>
=ON
</code>
.
The
<code class="option">
--disable-
<em class="replaceable">
<code>
plugin_name
</code>
</em>
</code>
and
<code class="option">
--skip-
<em class="replaceable">
<code>
plugin_name
</code>
</em>
</code>
option formats are synonyms for
<code class="option">
--
<em class="replaceable">
<code>
plugin_name
</code>
</em>
=OFF
</code>
.
</p>
<p>
If a plugin is disabled, either explicitly with
<code class="literal">
OFF
</code>
or implicitly because it was enabled with
<code class="literal">
ON
</code>
but fails to initialize, aspects of server
operation requiring the plugin change. For example, if the
plugin implements a storage engine, existing tables for the
storage engine become inaccessible, and attempts to create new
tables for the storage engine result in tables that use the
default storage engine unless the
<a class="link" href="sql-mode.html#sqlmode_no_engine_substitution">
<code class="literal">
NO_ENGINE_SUBSTITUTION
</code>
</a>
SQL
mode is enabled to cause an error to occur instead.
</p>
<p>
Disabling a plugin may require adjustment to other options.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="server-plugin-uninstalling">
</a>
Uninstalling Plugins
</h4>
</div>
</div>
</div>
<p>
At runtime, the
<a class="link" href="uninstall-plugin.html" title="15.7.4.6 UNINSTALL PLUGIN Statement">
<code class="literal">
UNINSTALL PLUGIN
</code>
</a>
statement disables and uninstalls a plugin known to the server.
The statement unloads the plugin and removes it from the
<code class="literal">
mysql.plugin
</code>
system table, if it is
registered there. For this reason,
<a class="link" href="uninstall-plugin.html" title="15.7.4.6 UNINSTALL PLUGIN Statement">
<code class="literal">
UNINSTALL PLUGIN
</code>
</a>
statement
requires the
<a class="link" href="privileges-provided.html#priv_delete">
<code class="literal">
DELETE
</code>
</a>
privilege for
the
<code class="literal">
mysql.plugin
</code>
table. With the plugin no
longer registered in the table, the server does not load the
plugin during subsequent restarts.
</p>
<p>
<a class="link" href="uninstall-plugin.html" title="15.7.4.6 UNINSTALL PLUGIN Statement">
<code class="literal">
UNINSTALL PLUGIN
</code>
</a>
can unload a
plugin regardless of whether it was loaded at runtime with
<a class="link" href="install-plugin.html" title="15.7.4.4 INSTALL PLUGIN Statement">
<code class="literal">
INSTALL PLUGIN
</code>
</a>
or at startup with
a plugin-loading option, subject to these conditions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
It cannot unload plugins that are built in to the server.
These can be identified as those that have a library name of
<code class="literal">
NULL
</code>
in the output from the Information
Schema
<a class="link" href="information-schema-plugins-table.html" title="28.3.22 The INFORMATION_SCHEMA PLUGINS Table">
<code class="literal">
PLUGINS
</code>
</a>
table or
<a class="link" href="show-plugins.html" title="15.7.7.27 SHOW PLUGINS Statement">
<code class="literal">
SHOW PLUGINS
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
It cannot unload plugins for which the server was started
with
<code class="option">
--
<em class="replaceable">
<code>
plugin_name
</code>
</em>
=FORCE_PLUS_PERMANENT
</code>
,
which prevents plugin unloading at runtime. These can be
identified from the
<code class="literal">
LOAD_OPTION
</code>
column of
the
<a class="link" href="information-schema-plugins-table.html" title="28.3.22 The INFORMATION_SCHEMA PLUGINS Table">
<code class="literal">
PLUGINS
</code>
</a>
table.
</p>
</li>
</ul>
</div>
<p>
To uninstall a plugin that currently is loaded at server startup
with a plugin-loading option, use this procedure.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Remove from the
<code class="filename">
my.cnf
</code>
file any options
and system variables related to the plugin. If any plugin
system variables were persisted to the
<code class="filename">
mysqld-auto.cnf
</code>
file, remove them using
<a class="link" href="reset-persist.html" title="15.7.8.7 RESET PERSIST Statement">
<code class="literal">
RESET PERSIST
<em class="replaceable">
<code>
var_name
</code>
</em>
</code>
</a>
for each one
to remove it.
</p>
</li>
<li class="listitem">
<p>
Restart the server.
</p>
</li>
<li class="listitem">
<p>
Plugins normally are installed using either a plugin-loading
option at startup or with
<a class="link" href="install-plugin.html" title="15.7.4.4 INSTALL PLUGIN Statement">
<code class="literal">
INSTALL
PLUGIN
</code>
</a>
at runtime, but not both. However, removing
options for a plugin from the
<code class="filename">
my.cnf
</code>
file may not be sufficient to uninstall it if at some point
<a class="link" href="install-plugin.html" title="15.7.4.4 INSTALL PLUGIN Statement">
<code class="literal">
INSTALL PLUGIN
</code>
</a>
has also been
used. If the plugin still appears in the output from
<a class="link" href="information-schema-plugins-table.html" title="28.3.22 The INFORMATION_SCHEMA PLUGINS Table">
<code class="literal">
PLUGINS
</code>
</a>
or
<a class="link" href="show-plugins.html" title="15.7.7.27 SHOW PLUGINS Statement">
<code class="literal">
SHOW PLUGINS
</code>
</a>
, use
<a class="link" href="uninstall-plugin.html" title="15.7.4.6 UNINSTALL PLUGIN Statement">
<code class="literal">
UNINSTALL PLUGIN
</code>
</a>
to remove it
from the
<code class="literal">
mysql.plugin
</code>
table. Then restart
the server again.
</p>
</li>
</ol>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="server-plugin-loadable-function-installing">
</a>
Plugins and Loadable Functions
</h4>
</div>
</div>
</div>
<p>
A plugin when installed may also automatically install related
loadable functions. If so, the plugin when uninstalled also
automatically uninstalls those functions.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/preface.html | <div id="docs-body">
<div class="preface">
<div class="titlepage">
<div>
<div>
<h1 class="title">
<a name="preface">
</a>
Preface and Legal Notices
</h1>
</div>
</div>
</div>
<p>
This is the Reference Manual for the MySQL Database System, for the
8.4.3 LTS release. For license information, see
the
<a class="link" href="preface.html#legalnotice" title="Legal Notices">
Legal Notices
</a>
.
</p>
<p>
This manual is not intended for use with older versions of the MySQL
software due to the many functional and other differences between
MySQL 8.4 and previous versions. If you are using an
earlier release of the MySQL software, please refer to the
appropriate manual. For example,
<a class="ulink" href="/doc/refman/8.0/en/" target="_top">
MySQL 8.0
Reference Manual
</a>
covers the 8.0 bugfix series of MySQL
software releases.
</p>
<p>
<b>
Licensing information—MySQL 8.4.
</b>
This product may include third-party software, used under license.
If you are using a
<span class="emphasis">
<em>
Commercial
</em>
</span>
release of MySQL
8.4, see the
<a class="ulink" href="https://downloads.mysql.com/docs/licenses/mysqld-8.4-com-en.pdf" target="_blank">
MySQL 8.4
Commercial Release License Information User Manual
</a>
for licensing information,
including licensing information relating to third-party software
that may be included in this Commercial release. If you are using a
<span class="emphasis">
<em>
Community
</em>
</span>
release of MySQL 8.4, see the
<a class="ulink" href="https://downloads.mysql.com/docs/licenses/mysqld-8.4-gpl-en.pdf" target="_blank">
MySQL 8.4
Community Release License Information User Manual
</a>
for licensing information,
including licensing information relating to third-party software
that may be included in this Community release.
</p>
<p>
<b>
Licensing information—MySQL NDB Cluster 8.4.
</b>
This product may include third-party software, used under license.
If you are using a
<span class="emphasis">
<em>
Commercial
</em>
</span>
release of MySQL
NDB Cluster 8.4, see the
<a class="ulink" href="https://downloads.mysql.com/docs/licenses/cluster-8.4-com-en.pdf" target="_blank">
MySQL NDB
Cluster 8.4 Commercial Release License Information User Manual
</a>
for licensing
information, including licensing information relating to third-party
software that may be included in this Commercial release. If you are
using a
<span class="emphasis">
<em>
Community
</em>
</span>
release of MySQL NDB Cluster
8.4, see the
<a class="ulink" href="https://downloads.mysql.com/docs/licenses/cluster-8.4-gpl-en.pdf" target="_blank">
MySQL NDB
Cluster 8.4 Community Release License Information User Manual
</a>
for licensing
information, including licensing information relating to third-party
software that may be included in this Community release.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h2 class="title">
<a name="legalnotice">
</a>
Legal Notices
</h2>
</div>
</div>
</div>
<p>
Copyright © 1997, 2024, Oracle and/or its affiliates.
</p>
<p>
<span class="strong">
<strong>
License Restrictions
</strong>
</span>
</p>
<p>
This software and related documentation are provided under a license
agreement containing restrictions on use and disclosure and are
protected by intellectual property laws. Except as expressly
permitted in your license agreement or allowed by law, you may not
use, copy, reproduce, translate, broadcast, modify, license,
transmit, distribute, exhibit, perform, publish, or display any
part, in any form, or by any means. Reverse engineering,
disassembly, or decompilation of this software, unless required by
law for interoperability, is prohibited.
</p>
<p>
<span class="strong">
<strong>
Warranty Disclaimer
</strong>
</span>
</p>
<p>
The information contained herein is subject to change without notice
and is not warranted to be error-free. If you find any errors,
please report them to us in writing.
</p>
<p>
<span class="strong">
<strong>
Restricted Rights Notice
</strong>
</span>
</p>
<p>
If this is software, software documentation, data (as defined in the
Federal Acquisition Regulation), or related documentation that is
delivered to the U.S. Government or anyone licensing it on behalf of
the U.S. Government, then the following notice is applicable:
</p>
<p>
U.S. GOVERNMENT END USERS: Oracle programs (including any operating
system, integrated software, any programs embedded, installed, or
activated on delivered hardware, and modifications of such programs)
and Oracle computer documentation or other Oracle data delivered to
or accessed by U.S. Government end users are "commercial computer
software," "commercial computer software documentation," or "limited
rights data" pursuant to the applicable Federal Acquisition
Regulation and agency-specific supplemental regulations. As such,
the use, reproduction, duplication, release, display, disclosure,
modification, preparation of derivative works, and/or adaptation of
i) Oracle programs (including any operating system, integrated
software, any programs embedded, installed, or activated on
delivered hardware, and modifications of such programs), ii) Oracle
computer documentation and/or iii) other Oracle data, is subject to
the rights and limitations specified in the license contained in the
applicable contract. The terms governing the U.S. Government's use
of Oracle cloud services are defined by the applicable contract for
such services. No other rights are granted to the U.S. Government.
</p>
<p>
<span class="strong">
<strong>
Hazardous Applications Notice
</strong>
</span>
</p>
<p>
This software or hardware is developed for general use in a variety
of information management applications. It is not developed or
intended for use in any inherently dangerous applications, including
applications that may create a risk of personal injury. If you use
this software or hardware in dangerous applications, then you shall
be responsible to take all appropriate fail-safe, backup,
redundancy, and other measures to ensure its safe use. Oracle
Corporation and its affiliates disclaim any liability for any
damages caused by use of this software or hardware in dangerous
applications.
</p>
<p>
<span class="strong">
<strong>
Trademark Notice
</strong>
</span>
</p>
<p>
Oracle, Java, MySQL, and NetSuite are registered trademarks of
Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
</p>
<p>
Intel and Intel Inside are trademarks or registered trademarks of
Intel Corporation. All SPARC trademarks are used under license and
are trademarks or registered trademarks of SPARC International, Inc.
AMD, Epyc, and the AMD logo are trademarks or registered trademarks
of Advanced Micro Devices. UNIX is a registered trademark of The
Open Group.
</p>
<p>
<span class="strong">
<strong>
Third-Party Content, Products, and Services Disclaimer
</strong>
</span>
</p>
<p>
This software or hardware and documentation may provide access to or
information about content, products, and services from third
parties. Oracle Corporation and its affiliates are not responsible
for and expressly disclaim all warranties of any kind with respect
to third-party content, products, and services unless otherwise set
forth in an applicable agreement between you and Oracle. Oracle
Corporation and its affiliates will not be responsible for any loss,
costs, or damages incurred due to your access to or use of
third-party content, products, or services, except as set forth in
an applicable agreement between you and Oracle.
</p>
<p>
<span class="strong">
<strong>
Use of This Documentation
</strong>
</span>
</p>
<p>
This documentation is NOT distributed under a GPL license. Use of
this documentation is subject to the following terms:
</p>
<p>
You may create a printed copy of this documentation solely for your
own personal use. Conversion to other formats is allowed as long as
the actual content is not altered or edited in any way. You shall
not publish or distribute this documentation in any form or on any
media, except if you distribute the documentation in a manner
similar to how Oracle disseminates it (that is, electronically for
download on a Web site with the software) or on a CD-ROM or similar
medium, provided however that the documentation is disseminated
together with the software on the same medium. Any other use, such
as any dissemination of printed copies or use of this documentation,
in whole or in part, in another publication, requires the prior
written consent from an authorized representative of Oracle. Oracle
and/or its affiliates reserve any and all rights to this
documentation not expressly granted above.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h2 class="title">
<a name="idm46045340966176">
</a>
Documentation Accessibility
</h2>
</div>
</div>
</div>
<p>
For information about Oracle's commitment to accessibility, visit
the Oracle Accessibility Program website at
<a class="ulink" href="http://www.oracle.com/pls/topic/lookup?ctx=acc&id=docacc" target="_blank">
http://www.oracle.com/pls/topic/lookup?ctx=acc&id=docacc
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h2 class="title">
<a name="idm46045340963568">
</a>
Access to Oracle Support for Accessibility
</h2>
</div>
</div>
</div>
<p>
Oracle customers that have purchased support have access to
electronic support through My Oracle Support. For information, visit
<a class="ulink" href="http://www.oracle.com/pls/topic/lookup?ctx=acc&id=info" target="_blank">
http://www.oracle.com/pls/topic/lookup?ctx=acc&id=info
</a>
or visit
<code class="code">
<a class="ulink" href="http://www.oracle.com/pls/topic/lookup?ctx=acc&id=trs" target="_blank">
http://www.oracle.com/pls/topic/lookup?ctx=acc&id=trs
</a>
</code>
if you are hearing impaired.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/deallocate-prepare.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="deallocate-prepare">
</a>
15.5.3 DEALLOCATE PREPARE Statement
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045176537616">
</a>
<a class="indexterm" name="idm46045176536576">
</a>
<a class="indexterm" name="idm46045176535504">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa59305104"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">DEALLOCATE</span> <span class="token operator">|</span> <span class="token keyword">DROP</span>} <span class="token keyword">PREPARE</span> <em class="replaceable">stmt_name</em></code></pre>
</div>
<p>
To deallocate a prepared statement produced with
<a class="link" href="prepare.html" title="15.5.1 PREPARE Statement">
<code class="literal">
PREPARE
</code>
</a>
, use a
<a class="link" href="deallocate-prepare.html" title="15.5.3 DEALLOCATE PREPARE Statement">
<code class="literal">
DEALLOCATE PREPARE
</code>
</a>
statement that
refers to the prepared statement name. Attempting to execute a
prepared statement after deallocating it results in an error. If
too many prepared statements are created and not deallocated by
either the
<code class="literal">
DEALLOCATE PREPARE
</code>
statement or the
end of the session, you might encounter the upper limit enforced
by the
<a class="link" href="server-system-variables.html#sysvar_max_prepared_stmt_count">
<code class="literal">
max_prepared_stmt_count
</code>
</a>
system variable.
</p>
<p>
For examples, see
<a class="xref" href="sql-prepared-statements.html" title="15.5 Prepared Statements">
Section 15.5, “Prepared Statements”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/se-csv-repair.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="se-csv-repair">
</a>
18.4.1 Repairing and Checking CSV Tables
</h3>
</div>
</div>
</div>
<p>
The
<code class="literal">
CSV
</code>
storage engine supports the
<a class="link" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
<code class="literal">
CHECK TABLE
</code>
</a>
and
<a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
<code class="literal">
REPAIR TABLE
</code>
</a>
statements to verify
and, if possible, repair a damaged
<code class="literal">
CSV
</code>
table.
</p>
<p>
When running the
<a class="link" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
<code class="literal">
CHECK TABLE
</code>
</a>
statement, the
<code class="literal">
CSV
</code>
file is checked for validity
by looking for the correct field separators, escaped fields
(matching or missing quotation marks), the correct number of
fields compared to the table definition and the existence of a
corresponding
<code class="literal">
CSV
</code>
metafile. The first invalid
row discovered causes an error. Checking a valid table produces
output like that shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa67695514"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CHECK</span> <span class="token keyword">TABLE</span> csvtest<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Table <span class="token punctuation">|</span> Op <span class="token punctuation">|</span> Msg_type <span class="token punctuation">|</span> Msg_text <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> test.csvtest <span class="token punctuation">|</span> check <span class="token punctuation">|</span> status <span class="token punctuation">|</span> OK <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
A check on a corrupted table returns a fault such as
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa49965264"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CHECK</span> <span class="token keyword">TABLE</span> csvtest<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Table <span class="token punctuation">|</span> Op <span class="token punctuation">|</span> Msg_type <span class="token punctuation">|</span> Msg_text <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> test.csvtest <span class="token punctuation">|</span> check <span class="token punctuation">|</span> error <span class="token punctuation">|</span> Corrupt <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
To repair a table, use
<a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
<code class="literal">
REPAIR
TABLE
</code>
</a>
, which copies as many valid rows from the existing
<code class="literal">
CSV
</code>
data as possible, and then replaces the
existing
<code class="literal">
CSV
</code>
file with the recovered rows. Any
rows beyond the corrupted data are lost.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa44877215"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">REPAIR</span> <span class="token keyword">TABLE</span> csvtest<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Table <span class="token punctuation">|</span> Op <span class="token punctuation">|</span> Msg_type <span class="token punctuation">|</span> Msg_text <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> test.csvtest <span class="token punctuation">|</span> repair <span class="token punctuation">|</span> status <span class="token punctuation">|</span> OK <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
During repair, only the rows from the
<code class="literal">
CSV
</code>
file up to the first damaged row are copied to the new table.
All other rows from the first damaged row to the end of the
table are removed, even valid rows.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/optimize-data-types.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="optimize-data-types">
</a>
10.4.2 Optimizing MySQL Data Types
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="optimize-numeric.html">
10.4.2.1 Optimizing for Numeric Data
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimize-character.html">
10.4.2.2 Optimizing for Character and String Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimize-blob.html">
10.4.2.3 Optimizing for BLOB Types
</a>
</span>
</dt>
</dl>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-ps-setup-show-disabled.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-ps-setup-show-disabled">
</a>
30.4.4.15 The ps_setup_show_disabled() Procedure
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045061375264">
</a>
<a class="indexterm" name="idm46045061373760">
</a>
<p>
Displays all currently disabled Performance Schema
configuration.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-ps-setup-show-disabled-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_show_instruments BOOLEAN
</code>
: Whether
to display disabled instruments. This might be a long
list.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
in_show_threads BOOLEAN
</code>
: Whether to
display disabled threads.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-ps-setup-show-disabled-example">
</a>
Example
</h5>
</div>
</div>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa12547033"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CALL</span> sys<span class="token punctuation">.</span>ps_setup_show_disabled<span class="token punctuation">(</span><span class="token boolean">TRUE</span><span class="token punctuation">,</span> <span class="token boolean">TRUE</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>
<span class="token output"><span class="token punctuation">|</span> performance_schema_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>
<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>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> enabled_users <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> '%'@'%' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> object_type <span class="token punctuation">|</span> objects <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span> timed <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> EVENT <span class="token punctuation">|</span> mysql.% <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> EVENT <span class="token punctuation">|</span> performance_schema.% <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> EVENT <span class="token punctuation">|</span> information_schema.% <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> FUNCTION <span class="token punctuation">|</span> mysql.% <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> FUNCTION <span class="token punctuation">|</span> performance_schema.% <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> FUNCTION <span class="token punctuation">|</span> information_schema.% <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> PROCEDURE <span class="token punctuation">|</span> mysql.% <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> PROCEDURE <span class="token punctuation">|</span> performance_schema.% <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> PROCEDURE <span class="token punctuation">|</span> information_schema.% <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> TABLE <span class="token punctuation">|</span> mysql.% <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> TABLE <span class="token punctuation">|</span> performance_schema.% <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> TABLE <span class="token punctuation">|</span> information_schema.% <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> TRIGGER <span class="token punctuation">|</span> mysql.% <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> TRIGGER <span class="token punctuation">|</span> performance_schema.% <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> TRIGGER <span class="token punctuation">|</span> information_schema.% <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-tables">
</a>
17.6.1 Tables
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="using-innodb-tables.html">
17.6.1.1 Creating InnoDB Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-create-table-external.html">
17.6.1.2 Creating Tables Externally
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-table-import.html">
17.6.1.3 Importing InnoDB Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-migration.html">
17.6.1.4 Moving or Copying InnoDB Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="converting-tables-to-innodb.html">
17.6.1.5 Converting Tables from MyISAM to InnoDB
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-auto-increment-handling.html">
17.6.1.6 AUTO_INCREMENT Handling in InnoDB
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045166872272">
</a>
<p>
This section covers topics related to
<code class="literal">
InnoDB
</code>
tables.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-install-linux-binary.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-install-linux-binary">
</a>
25.3.1.1 Installing an NDB Cluster Binary Release on Linux
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045123010192">
</a>
<a class="indexterm" name="idm46045123008704">
</a>
<p>
This section covers the steps necessary to install the correct
executables for each type of Cluster node from precompiled
binaries supplied by Oracle.
</p>
<p>
For setting up a cluster using precompiled binaries, the first
step in the installation process for each cluster host is to
download the binary archive from the
<a class="ulink" href="https://dev.mysql.com/downloads/cluster/" target="_top">
NDB Cluster downloads
page
</a>
. (For the most recent 64-bit NDB 8.4 release, this
is
<code class="filename">
mysql-cluster-gpl-8.4.0-linux-glibc2.12-x86_64.tar.gz
</code>
.)
We assume that you have placed this file in each machine's
<code class="filename">
/var/tmp
</code>
directory.
</p>
<p>
If you require a custom binary, see
<a class="xref" href="installing-development-tree.html" title="2.8.5 Installing MySQL Using a Development Source Tree">
Section 2.8.5, “Installing MySQL Using a Development Source Tree”
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
After completing the installation, do not yet start any of the
binaries. We show you how to do so following the configuration
of the nodes (see
<a class="xref" href="mysql-cluster-install-configuration.html" title="25.3.3 Initial Configuration of NDB Cluster">
Section 25.3.3, “Initial Configuration of NDB Cluster”
</a>
).
</p>
</div>
<p>
<b>
SQL nodes.
</b>
On each of the machines designated to host SQL nodes, perform
the following steps as the system
<code class="literal">
root
</code>
user:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Check your
<code class="filename">
/etc/passwd
</code>
and
<code class="filename">
/etc/group
</code>
files (or use whatever tools
are provided by your operating system for managing users and
groups) to see whether there is already a
<code class="literal">
mysql
</code>
group and
<code class="literal">
mysql
</code>
user on the system. Some OS distributions create these as
part of the operating system installation process. If they
are not already present, create a new
<code class="literal">
mysql
</code>
user group, and then add a
<code class="literal">
mysql
</code>
user to this group:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa38081118"><div class="copy-help left">Press ⌘+C to 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">groupadd</span> mysql
<span class="token prompt">$> </span><span class="token command">useradd</span> <span class="token property">-g</span> mysql <span class="token property">-s</span> /bin/false mysql</code></pre>
</div>
<p>
The syntax for
<span class="command">
<strong>
useradd
</strong>
</span>
and
<span class="command">
<strong>
groupadd
</strong>
</span>
may differ slightly on different
versions of Unix, or they may have different names such as
<span class="command">
<strong>
adduser
</strong>
</span>
and
<span class="command">
<strong>
addgroup
</strong>
</span>
.
</p>
</li>
<li class="listitem">
<p>
Change location to the directory containing the downloaded
file, unpack the archive, and create a symbolic link named
<code class="filename">
mysql
</code>
to the
<code class="filename">
mysql
</code>
directory.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The actual file and directory names vary according to the
NDB Cluster version number.
</p>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa98415522"><div class="copy-help left">Press ⌘+C to 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/tmp
<span class="token prompt">$> </span><span class="token command">tar</span> <span class="token property">-C</span> /usr/local <span class="token property">-xzvf</span> mysql-cluster-gpl-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0-linux-glibc2<span class="token punctuation">.</span>12-x86_64<span class="token punctuation">.</span>tar<span class="token punctuation">.</span>gz
<span class="token prompt">$> </span><span class="token command">ln</span> <span class="token property">-s</span> /usr/local/mysql-cluster-gpl-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0-linux-glibc2<span class="token punctuation">.</span>12-x86_64 /usr/local/mysql</code></pre>
</div>
</li>
<li class="listitem">
<p>
Change location to the
<code class="filename">
mysql
</code>
directory
and set up the system databases using
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
<a class="link" href="server-options.html#option_mysqld_initialize">
<code class="option">
--initialize
</code>
</a>
as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa92419177"><div class="copy-help left">Press ⌘+C to 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> mysql
<span class="token prompt">$> </span><span class="token command">mysqld</span> <span class="token property">--initialize</span></code></pre>
</div>
<p>
This generates a random password for the MySQL
<code class="literal">
root
</code>
account. If you do
<span class="emphasis">
<em>
not
</em>
</span>
want the random password to be
generated, you can substitute the
<a class="link" href="server-options.html#option_mysqld_initialize-insecure">
<code class="option">
--initialize-insecure
</code>
</a>
option
for
<code class="option">
--initialize
</code>
. In either case, you
should review
<a class="xref" href="data-directory-initialization.html" title="2.9.1 Initializing the Data Directory">
Section 2.9.1, “Initializing the Data Directory”
</a>
, for
additional information before performing this step. See also
<a class="xref" href="mysql-secure-installation.html" title="6.4.2 mysql_secure_installation — Improve MySQL Installation Security">
Section 6.4.2, “mysql_secure_installation — Improve MySQL Installation Security”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Set the necessary permissions for the MySQL server and data
directories:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa77819048"><div class="copy-help left">Press ⌘+C to 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">chown</span> <span class="token property">-R</span> root <span class="token punctuation">.</span>
<span class="token prompt">$> </span><span class="token command">chown</span> <span class="token property">-R</span> mysql data
<span class="token prompt">$> </span><span class="token command">chgrp</span> <span class="token property">-R</span> mysql <span class="token punctuation">.</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Copy the MySQL startup script to the appropriate directory,
make it executable, and set it to start when the operating
system is booted up:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa11911896"><div class="copy-help left">Press ⌘+C to 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">cp</span> support-files/mysql<span class="token punctuation">.</span>server /etc/rc<span class="token punctuation">.</span>d/init<span class="token punctuation">.</span>d/
<span class="token prompt">$> </span><span class="token command">chmod</span> +x /etc/rc<span class="token punctuation">.</span>d/init<span class="token punctuation">.</span>d/mysql<span class="token punctuation">.</span>server
<span class="token prompt">$> </span><span class="token command">chkconfig</span> <span class="token property">--add</span> mysql<span class="token punctuation">.</span>server</code></pre>
</div>
<p>
(The startup scripts directory may vary depending on your
operating system and version—for example, in some
Linux distributions, it is
<code class="filename">
/etc/init.d
</code>
.)
</p>
<p>
Here we use Red Hat's
<span class="command">
<strong>
chkconfig
</strong>
</span>
for
creating links to the startup scripts; use whatever means is
appropriate for this purpose on your platform, such as
<span class="command">
<strong>
update-rc.d
</strong>
</span>
on Debian.
</p>
</li>
</ol>
</div>
<p>
Remember that the preceding steps must be repeated on each
machine where an SQL node is to reside.
</p>
<p>
<b>
Data nodes.
</b>
Installation of the data nodes does not require the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
binary. Only the NDB Cluster data
node executable
<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>
(single-threaded) 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>
(multithreaded) is required. These
binaries can also be found in the
<code class="filename">
.tar.gz
</code>
archive. Again, we assume that you have placed this archive in
<code class="filename">
/var/tmp
</code>
.
</p>
<p>
As system
<code class="literal">
root
</code>
(that is, after using
<span class="command">
<strong>
sudo
</strong>
</span>
,
<span class="command">
<strong>
su root
</strong>
</span>
, or your
system's equivalent for temporarily assuming the system
administrator account's privileges), perform the following steps
to install the data node binaries on the data node hosts:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Change location to the
<code class="filename">
/var/tmp
</code>
directory, and extract 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>
and
<a class="link" href="mysql-cluster-programs-ndbmtd.html" title="25.5.3 ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)">
<span class="command">
<strong>
ndbmtd
</strong>
</span>
</a>
binaries from the archive into a
suitable directory such as
<code class="filename">
/usr/local/bin
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa44008824"><div class="copy-help left">Press ⌘+C to 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/tmp
<span class="token prompt">$> </span><span class="token command">tar</span> <span class="token property">-zxvf</span> mysql-cluster-gpl-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0-linux-glibc2<span class="token punctuation">.</span>12-x86_64<span class="token punctuation">.</span>tar<span class="token punctuation">.</span>gz
<span class="token prompt">$> </span><span class="token command">cd</span> mysql-cluster-gpl-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0-linux-glibc2<span class="token punctuation">.</span>12-x86_64
<span class="token prompt">$> </span><span class="token command">cp</span> bin/ndbd /usr/local/bin/ndbd
<span class="token prompt">$> </span><span class="token command">cp</span> bin/ndbmtd /usr/local/bin/ndbmtd</code></pre>
</div>
<p>
(You can safely delete the directory created by unpacking
the downloaded archive, and the files it contains, from
<code class="filename">
/var/tmp
</code>
once
<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>
and
<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>
have been copied to the executables directory.)
</p>
</li>
<li class="listitem">
<p>
Change location to the directory into which you copied the
files, and then make both of them executable:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa23276035"><div class="copy-help left">Press ⌘+C to 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> /usr/local/bin
<span class="token prompt">$> </span><span class="token command">chmod</span> +x ndb*</code></pre>
</div>
</li>
</ol>
</div>
<p>
The preceding steps should be repeated on each data node host.
</p>
<p>
Although only one of the data node executables is required to
run an NDB Cluster data node, we have shown you how to install
both
<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>
and
<a class="link" href="mysql-cluster-programs-ndbmtd.html" title="25.5.3 ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)">
<span class="command">
<strong>
ndbmtd
</strong>
</span>
</a>
in
the preceding instructions. We recommend that you do this when
installing or upgrading NDB Cluster, even if you plan to use
only one of them, since this saves time and trouble in the event
that you later decide to change from one to the other.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The data directory on each machine hosting a data node is
<code class="filename">
/usr/local/mysql/data
</code>
. This piece of
information is essential when configuring the management node.
(See
<a class="xref" href="mysql-cluster-install-configuration.html" title="25.3.3 Initial Configuration of NDB Cluster">
Section 25.3.3, “Initial Configuration of NDB Cluster”
</a>
.)
</p>
</div>
<p>
<b>
Management nodes.
</b>
Installation of the management node does not require the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
binary. Only the NDB Cluster
management server (
<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>
) is required;
you most likely want to install the management client
(
<a class="link" href="mysql-cluster-programs-ndb-mgm.html" title="25.5.5 ndb_mgm — The NDB Cluster Management Client">
<span class="command">
<strong>
ndb_mgm
</strong>
</span>
</a>
) as well. Both of these binaries
also be found in the
<code class="filename">
.tar.gz
</code>
archive.
Again, we assume that you have placed this archive in
<code class="filename">
/var/tmp
</code>
.
</p>
<p>
As system
<code class="literal">
root
</code>
, perform the following steps
to install
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
<span class="command">
<strong>
ndb_mgmd
</strong>
</span>
</a>
and
<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>
on the management node host:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Change location to the
<code class="filename">
/var/tmp
</code>
directory, and extract 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>
and
<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>
from the archive into a suitable
directory such as
<code class="filename">
/usr/local/bin
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa96655295"><div class="copy-help left">Press ⌘+C to 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/tmp
<span class="token prompt">$> </span><span class="token command">tar</span> <span class="token property">-zxvf</span> mysql-cluster-gpl-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0-linux-glibc2<span class="token punctuation">.</span>12-x86_64<span class="token punctuation">.</span>tar<span class="token punctuation">.</span>gz
<span class="token prompt">$> </span><span class="token command">cd</span> mysql-cluster-gpl-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0-linux-glibc2<span class="token punctuation">.</span>12-x86_64
<span class="token prompt">$> </span><span class="token command">cp</span> bin/ndb_mgm* /usr/local/bin</code></pre>
</div>
<p>
(You can safely delete the directory created by unpacking
the downloaded archive, and the files it contains, from
<code class="filename">
/var/tmp
</code>
once
<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>
and
<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>
have been copied to the executables directory.)
</p>
</li>
<li class="listitem">
<p>
Change location to the directory into which you copied the
files, and then make both of them executable:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa32557925"><div class="copy-help left">Press ⌘+C to 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> /usr/local/bin
<span class="token prompt">$> </span><span class="token command">chmod</span> +x ndb_mgm*</code></pre>
</div>
</li>
</ol>
</div>
<p>
In
<a class="xref" href="mysql-cluster-install-configuration.html" title="25.3.3 Initial Configuration of NDB Cluster">
Section 25.3.3, “Initial Configuration of NDB Cluster”
</a>
, we
create configuration files for all of the nodes in our example
NDB Cluster.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/telemetry-trace-install.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="telemetry-trace-install">
</a>
35.1 Installing OpenTelemetry Support
</h2>
</div>
</div>
</div>
<p>
This section describes the installation of the server and client
OpenTelemetry support.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="telemetry-trace-install.html#telemetry-trace-install-server" title="Installing Server Component">
Installing Server Component
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="telemetry-trace-install.html#telemetry-trace-install-client" title="Installing Client Plugin">
Installing Client Plugin
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="telemetry-trace-install-server">
</a>
Installing Server Component
</h3>
</div>
</div>
</div>
<p>
To install the server component, run the following command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa36059205"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">install</span> <span class="token keyword">component</span> <span class="token string">'file://component_telemetry'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
To confirm the component is present in your server, run the
following query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa31537525"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> mysql<span class="token punctuation">.</span><span class="token keyword">component</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>
<span class="token output"><span class="token punctuation">|</span> component_id <span class="token punctuation">|</span> component_group_id <span class="token punctuation">|</span> component_urn <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> file://component_validate_password <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> file://component_telemetry <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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
<code class="literal">
component_telemetry
</code>
is present in the
<code class="literal">
component_urn
</code>
column, the component is
installed.
</p>
<p>
The component installation also adds telemetry-specific system
variables.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa48285371"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">show</span> <span class="token keyword">variables</span> <span class="token operator">like</span> <span class="token string">"%telemetry%"</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>
<span class="token output"><span class="token punctuation">|</span> Variable_name <span class="token punctuation">|</span> Value <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.metrics_enabled <span class="token punctuation">|</span> ON <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.metrics_reader_frequency_1 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.metrics_reader_frequency_2 <span class="token punctuation">|</span> 60 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.metrics_reader_frequency_3 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_bsp_max_export_batch_size <span class="token punctuation">|</span> 512 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_bsp_max_queue_size <span class="token punctuation">|</span> 2048 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_bsp_schedule_delay <span class="token punctuation">|</span> 5000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_metrics_certificates <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_metrics_cipher <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_metrics_cipher_suite <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_metrics_client_certificates <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_metrics_client_key <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_metrics_compression <span class="token punctuation">|</span> none <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_metrics_endpoint <span class="token punctuation">|</span> http://localhost:4318/v1/metrics <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_metrics_headers <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_metrics_max_tls <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_metrics_min_tls <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_metrics_protocol <span class="token punctuation">|</span> http/protobuf <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_metrics_timeout <span class="token punctuation">|</span> 10000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_traces_certificates <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_traces_cipher <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_traces_cipher_suite <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_traces_client_certificates <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_traces_client_key <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_traces_compression <span class="token punctuation">|</span> none <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_traces_endpoint <span class="token punctuation">|</span> http://localhost:4318/v1/traces <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_traces_headers <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_traces_max_tls <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_traces_min_tls <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_traces_protocol <span class="token punctuation">|</span> http/protobuf <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_exporter_otlp_traces_timeout <span class="token punctuation">|</span> 10000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_log_level <span class="token punctuation">|</span> info <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.otel_resource_attributes <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.query_text_enabled <span class="token punctuation">|</span> ON <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> telemetry.trace_enabled <span class="token punctuation">|</span> ON <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
See
<a class="xref" href="telemetry-trace-configuration.html#telemetry-trace-configuration-server" title="Server Configuration">
Server Configuration
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="telemetry-trace-install-client">
</a>
Installing Client Plugin
</h3>
</div>
</div>
</div>
<p>
The Telemetry plugin for the MySQL client can be enabled with a
command line switch,
<a class="link" href="mysql-command-options.html#option_mysql_telemetry_client">
<code class="option">
--telemetry_client
</code>
</a>
or from a
configuration option,
<code class="literal">
telemetry-client=ON
|OFF
</code>
, defined in the
<code class="literal">
[mysql]
</code>
section of the configuration file.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-config.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-config">
</a>
6.7.1 mysql_config — Display Options for Compiling Clients
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045303064400">
</a>
<a class="indexterm" name="idm46045303063488">
</a>
<p>
<a class="link" href="mysql-config.html" title="6.7.1 mysql_config — Display Options for Compiling Clients">
<span class="command">
<strong>
mysql_config
</strong>
</span>
</a>
provides you with useful
information for compiling your MySQL client and connecting it to
MySQL. It is a shell script, so it is available only on Unix and
Unix-like systems.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<span class="command">
<strong>
pkg-config
</strong>
</span>
can be used as an alternative to
<a class="link" href="mysql-config.html" title="6.7.1 mysql_config — Display Options for Compiling Clients">
<span class="command">
<strong>
mysql_config
</strong>
</span>
</a>
for obtaining information such
as compiler flags or link libraries required to compile MySQL
applications. For more information, see
<a class="ulink" href="/doc/c-api/8.4/en/c-api-building-clients-pkg-config.html" target="_top">
Building C API Client Programs Using pkg-config
</a>
.
</p>
</div>
<p>
<a class="link" href="mysql-config.html" title="6.7.1 mysql_config — Display Options for Compiling Clients">
<span class="command">
<strong>
mysql_config
</strong>
</span>
</a>
supports the following options.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="option_mysql_config_cflags">
</a>
<a class="link" href="mysql-config.html#option_mysql_config_cflags">
<code class="option">
--cflags
</code>
</a>
</p>
<a class="indexterm" name="idm46045303052896">
</a>
<a class="indexterm" name="idm46045303051408">
</a>
<p>
C Compiler flags to find include files and critical compiler
flags and defines used when compiling the
<code class="literal">
libmysqlclient
</code>
library. The options
returned are tied to the specific compiler that was used
when the library was created and might clash with the
settings for your own compiler. Use
<a class="link" href="mysql-config.html#option_mysql_config_include">
<code class="option">
--include
</code>
</a>
for more
portable options that contain only include paths.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_config_cxxflags">
</a>
<a class="link" href="mysql-config.html#option_mysql_config_cxxflags">
<code class="option">
--cxxflags
</code>
</a>
</p>
<a class="indexterm" name="idm46045303045024">
</a>
<a class="indexterm" name="idm46045303043536">
</a>
<p>
Like
<a class="link" href="mysql-config.html#option_mysql_config_cflags">
<code class="option">
--cflags
</code>
</a>
, but for
C++ compiler flags.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_config_include">
</a>
<a class="link" href="mysql-config.html#option_mysql_config_include">
<code class="option">
--include
</code>
</a>
</p>
<a class="indexterm" name="idm46045303038480">
</a>
<a class="indexterm" name="idm46045303036992">
</a>
<p>
Compiler options to find MySQL include files.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_config_libs">
</a>
<a class="link" href="mysql-config.html#option_mysql_config_libs">
<code class="option">
--libs
</code>
</a>
</p>
<a class="indexterm" name="idm46045303032736">
</a>
<a class="indexterm" name="idm46045303031248">
</a>
<p>
Libraries and options required to link with the MySQL client
library.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_config_libs_r">
</a>
<a class="link" href="mysql-config.html#option_mysql_config_libs_r">
<code class="option">
--libs_r
</code>
</a>
</p>
<a class="indexterm" name="idm46045303026880">
</a>
<a class="indexterm" name="idm46045303025392">
</a>
<p>
Libraries and options required to link with the thread-safe
MySQL client library. In MySQL 8.4, all client
libraries are thread-safe, so this option need not be used.
The
<a class="link" href="mysql-config.html#option_mysql_config_libs">
<code class="option">
--libs
</code>
</a>
option can
be used in all cases.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_config_plugindir">
</a>
<a class="link" href="mysql-config.html#option_mysql_config_plugindir">
<code class="option">
--plugindir
</code>
</a>
</p>
<a class="indexterm" name="idm46045303019872">
</a>
<a class="indexterm" name="idm46045303018384">
</a>
<p>
The default plugin directory path name, defined when
configuring MySQL.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_config_port">
</a>
<a class="link" href="mysql-config.html#option_mysql_config_port">
<code class="option">
--port
</code>
</a>
</p>
<a class="indexterm" name="idm46045303014128">
</a>
<a class="indexterm" name="idm46045303012640">
</a>
<a class="indexterm" name="idm46045303011152">
</a>
<p>
The default TCP/IP port number, defined when configuring
MySQL.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_config_socket">
</a>
<a class="link" href="mysql-config.html#option_mysql_config_socket">
<code class="option">
--socket
</code>
</a>
</p>
<a class="indexterm" name="idm46045303007216">
</a>
<a class="indexterm" name="idm46045303005728">
</a>
<p>
The default Unix socket file, defined when configuring
MySQL.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_config_variable">
</a>
<a class="link" href="mysql-config.html#option_mysql_config_variable">
<code class="option">
--variable=
<em class="replaceable">
<code>
var_name
</code>
</em>
</code>
</a>
</p>
<a class="indexterm" name="idm46045303001216">
</a>
<a class="indexterm" name="idm46045302999728">
</a>
<p>
Display the value of the named configuration variable.
Permitted
<em class="replaceable">
<code>
var_name
</code>
</em>
values are
<code class="literal">
pkgincludedir
</code>
(the header file
directory),
<code class="literal">
pkglibdir
</code>
(the library
directory), and
<code class="literal">
plugindir
</code>
(the plugin
directory).
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_config_version">
</a>
<a class="link" href="mysql-config.html#option_mysql_config_version">
<code class="option">
--version
</code>
</a>
</p>
<a class="indexterm" name="idm46045302992720">
</a>
<a class="indexterm" name="idm46045302991232">
</a>
<p>
Version number for the MySQL distribution.
</p>
</li>
</ul>
</div>
<p>
If you invoke
<a class="link" href="mysql-config.html" title="6.7.1 mysql_config — Display Options for Compiling Clients">
<span class="command">
<strong>
mysql_config
</strong>
</span>
</a>
with no options,
it displays a list of all options that it supports, and their
values:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa82131391"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql_config</span>
Usage<span class="token punctuation">:</span> <span class="token punctuation">.</span>/mysql_config <span class="token property"><span class="token punctuation">[</span>OPTIONS<span class="token punctuation">]</span></span>
Compiler<span class="token punctuation">:</span> GNU 10<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0
Options<span class="token punctuation">:</span>
<span class="token property">--cflags</span> <span class="token punctuation">[</span><span class="token property">-I/usr/local/mysql/include/mysql</span><span class="token punctuation">]</span>
<span class="token property">--cxxflags</span> <span class="token punctuation">[</span><span class="token property">-I/usr/local/mysql/include/mysql</span><span class="token punctuation">]</span>
<span class="token property">--include</span> <span class="token punctuation">[</span><span class="token property">-I/usr/local/mysql/include/mysql</span><span class="token punctuation">]</span>
<span class="token property">--libs</span> <span class="token punctuation">[</span><span class="token property">-L/usr/local/mysql/lib/mysql</span> <span class="token property">-lmysqlclient</span> <span class="token property">-lpthread</span> <span class="token property">-ldl</span>
<span class="token property">-lssl</span> <span class="token property">-lcrypto</span> <span class="token property">-lresolv</span> <span class="token property">-lm</span> <span class="token property">-lrt</span><span class="token punctuation">]</span>
<span class="token property">--libs_r</span> <span class="token punctuation">[</span><span class="token property">-L/usr/local/mysql/lib/mysql</span> <span class="token property">-lmysqlclient</span> <span class="token property">-lpthread</span> <span class="token property">-ldl</span>
<span class="token property">-lssl</span> <span class="token property">-lcrypto</span> <span class="token property">-lresolv</span> <span class="token property">-lm</span> <span class="token property">-lrt</span><span class="token punctuation">]</span>
<span class="token property">--plugindir</span> <span class="token punctuation">[</span>/usr/local/mysql/lib/plugin<span class="token punctuation">]</span>
<span class="token property">--socket</span> <span class="token punctuation">[</span>/tmp/mysql<span class="token punctuation">.</span>sock<span class="token punctuation">]</span>
<span class="token property">--port</span> <span class="token punctuation">[</span>3306<span class="token punctuation">]</span>
<span class="token property">--version</span> <span class="token punctuation">[</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token punctuation">]</span>
<span class="token constant">--variable</span><span class="token attr-value"><span class="token punctuation">=</span>VAR</span> VAR is one of<span class="token punctuation">:</span>
pkgincludedir <span class="token punctuation">[</span>/usr/local/mysql/include<span class="token punctuation">]</span>
pkglibdir <span class="token punctuation">[</span>/usr/local/mysql/lib<span class="token punctuation">]</span>
plugindir <span class="token punctuation">[</span>/usr/local/mysql/lib/plugin<span class="token punctuation">]</span></code></pre>
</div>
<p>
You can use
<a class="link" href="mysql-config.html" title="6.7.1 mysql_config — Display Options for Compiling Clients">
<span class="command">
<strong>
mysql_config
</strong>
</span>
</a>
within a command
line using backticks to include the output that it produces for
particular options. For example, to compile and link a MySQL
client program, use
<a class="link" href="mysql-config.html" title="6.7.1 mysql_config — Display Options for Compiling Clients">
<span class="command">
<strong>
mysql_config
</strong>
</span>
</a>
as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa97222803"><div class="copy-help left">Press ⌘+C to 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">gcc <span class="token property">-c</span> `mysql_config <span class="token property">--cflags`</span> progname<span class="token punctuation">.</span>c
gcc <span class="token property">-o</span> progname progname<span class="token punctuation">.</span>o `mysql_config <span class="token property">--libs`</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/stored-routines.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="stored-routines">
</a>
27.2 Using Stored Routines
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="stored-routines-syntax.html">
27.2.1 Stored Routine Syntax
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="stored-routines-privileges.html">
27.2.2 Stored Routines and MySQL Privileges
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="stored-routines-metadata.html">
27.2.3 Stored Routine Metadata
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="stored-routines-last-insert-id.html">
27.2.4 Stored Procedures, Functions, Triggers, and LAST_INSERT_ID()
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045082566208">
</a>
<a class="indexterm" name="idm46045082565136">
</a>
<a class="indexterm" name="idm46045082563648">
</a>
<a class="indexterm" name="idm46045082562576">
</a>
<a class="indexterm" name="idm46045082561088">
</a>
<a class="indexterm" name="idm46045082560016">
</a>
<p>
MySQL supports stored routines (procedures and functions). A stored
routine is a set of SQL statements that can be stored in the server.
Once this has been done, clients don't need to keep reissuing the
individual statements but can refer to the stored routine instead.
</p>
<p>
Stored routines can be particularly useful in certain situations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
When multiple client applications are written in different
languages or work on different platforms, but need to perform
the same database operations.
</p>
</li>
<li class="listitem">
<p>
When security is paramount. Banks, for example, use stored
procedures and functions for all common operations. This
provides a consistent and secure environment, and routines can
ensure that each operation is properly logged. In such a setup,
applications and users would have no access to the database
tables directly, but can only execute specific stored routines.
</p>
</li>
</ul>
</div>
<p>
Stored routines can provide improved performance because less
information needs to be sent between the server and the client. The
tradeoff is that this does increase the load on the database server
because more of the work is done on the server side and less is done
on the client (application) side. Consider this if many client
machines (such as Web servers) are serviced by only one or a few
database servers.
</p>
<p>
Stored routines also enable you to have libraries of functions in
the database server. This is a feature shared by modern application
languages that enable such design internally (for example, by using
classes). Using these client application language features is
beneficial for the programmer even outside the scope of database
use.
</p>
<p>
MySQL follows the SQL:2003 syntax for stored routines, which is also
used by IBM's DB2. All syntax described here is supported and any
limitations and extensions are documented where appropriate.
</p>
<h3>
<a name="idm46045082552592">
</a>
Additional Resources
</h3>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
You may find the
<a class="ulink" href="https://forums.mysql.com/list.php?98" target="_blank">
Stored
Procedures User Forum
</a>
of use when working with stored
procedures and functions.
</p>
</li>
<li class="listitem">
<p>
For answers to some commonly asked questions regarding stored
routines in MySQL, see
<a class="xref" href="faqs-stored-procs.html" title="A.4 MySQL 8.4 FAQ: Stored Procedures and Functions">
Section A.4, “MySQL 8.4 FAQ: Stored Procedures and Functions”
</a>
.
</p>
</li>
<li class="listitem">
<p>
There are some restrictions on the use of stored routines. See
<a class="xref" href="stored-program-restrictions.html" title="27.8 Restrictions on Stored Programs">
Section 27.8, “Restrictions on Stored Programs”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Binary logging for stored routines takes place as described in
<a class="xref" href="stored-programs-logging.html" title="27.7 Stored Program Binary Logging">
Section 27.7, “Stored Program Binary Logging”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-enabled-roles-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-enabled-roles-table">
</a>
28.3.12 The INFORMATION_SCHEMA ENABLED_ROLES Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045080049760">
</a>
<p>
The
<a class="link" href="information-schema-enabled-roles-table.html" title="28.3.12 The INFORMATION_SCHEMA ENABLED_ROLES Table">
<code class="literal">
ENABLED_ROLES
</code>
</a>
table provides
information about the roles that are enabled within the current
session.
</p>
<p>
The
<a class="link" href="information-schema-enabled-roles-table.html" title="28.3.12 The INFORMATION_SCHEMA ENABLED_ROLES Table">
<code class="literal">
ENABLED_ROLES
</code>
</a>
table has these
columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
ROLE_NAME
</code>
</p>
<p>
The user name part of the granted role.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ROLE_HOST
</code>
</p>
<p>
The host name part of the granted role.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
IS_DEFAULT
</code>
</p>
<p>
<code class="literal">
YES
</code>
or
<code class="literal">
NO
</code>
, depending on
whether the role is a default role.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
IS_MANDATORY
</code>
</p>
<p>
<code class="literal">
YES
</code>
or
<code class="literal">
NO
</code>
, depending on
whether the role is mandatory.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/gis-wkt-functions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="gis-wkt-functions">
</a>
14.16.3 Functions That Create Geometry Values from WKT Values
</h3>
</div>
</div>
</div>
<p>
These functions take as arguments a Well-Known Text (WKT)
representation and, optionally, a spatial reference system
identifier (SRID). They return the corresponding geometry. For a
description of WKT format, see
<a class="xref" href="gis-data-formats.html#gis-wkt-format" title="Well-Known Text (WKT) Format">
Well-Known Text (WKT) Format
</a>
.
</p>
<p>
Functions in this section detect arguments in either Cartesian or
geographic spatial reference systems (SRSs), and return results
appropriate to the SRS.
</p>
<p>
<a class="link" href="gis-wkt-functions.html#function_st-geomfromtext">
<code class="literal">
ST_GeomFromText()
</code>
</a>
accepts a WKT
value of any geometry type as its first argument. Other functions
provide type-specific construction functions for construction of
geometry values of each geometry type.
</p>
<p>
Functions such as
<a class="link" href="gis-wkt-functions.html#function_st-mpointfromtext">
<code class="literal">
ST_MPointFromText()
</code>
</a>
and
<a class="link" href="gis-wkt-functions.html#function_st-geomfromtext">
<code class="literal">
ST_GeomFromText()
</code>
</a>
that accept
WKT-format representations of
<code class="literal">
MultiPoint
</code>
values
permit individual points within values to be surrounded by
parentheses. For example, both of the following function calls are
valid:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa86016679"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">ST_MPointFromText</span><span class="token punctuation">(</span><span class="token string">'MULTIPOINT (1 1, 2 2, 3 3)'</span><span class="token punctuation">)</span>
<span class="token function">ST_MPointFromText</span><span class="token punctuation">(</span><span class="token string">'MULTIPOINT ((1 1), (2 2), (3 3))'</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
Functions such as
<a class="link" href="gis-wkt-functions.html#function_st-geomfromtext">
<code class="literal">
ST_GeomFromText()
</code>
</a>
that accept WKT geometry collection arguments understand both
OpenGIS
<code class="literal">
'GEOMETRYCOLLECTION EMPTY'
</code>
standard
syntax and MySQL
<code class="literal">
'GEOMETRYCOLLECTION()'
</code>
nonstandard syntax. Functions such as
<a class="link" href="gis-format-conversion-functions.html#function_st-astext">
<code class="literal">
ST_AsWKT()
</code>
</a>
that produce WKT values produce
<code class="literal">
'GEOMETRYCOLLECTION
EMPTY'
</code>
standard syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa51638539"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@s1</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'GEOMETRYCOLLECTION()'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@s2</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'GEOMETRYCOLLECTION EMPTY'</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_AsWKT</span><span class="token punctuation">(</span><span class="token variable">@s1</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">ST_AsWKT</span><span class="token punctuation">(</span><span class="token variable">@s2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsWKT(@s1) <span class="token punctuation">|</span> ST_AsWKT(@s2) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> GEOMETRYCOLLECTION EMPTY <span class="token punctuation">|</span> GEOMETRYCOLLECTION EMPTY <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
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 geometry argument is
<code class="literal">
NULL
</code>
or is not
a syntactically well-formed geometry, or if the SRID argument
is
<code class="literal">
NULL
</code>
, the return value is
<code class="literal">
NULL
</code>
.
</p>
</li>
<li class="listitem">
<p>
By default, geographic coordinates (latitude, longitude) are
interpreted as in the order specified by the spatial reference
system of geometry arguments. An optional
<em class="replaceable">
<code>
options
</code>
</em>
argument may be given to
override the default axis order.
<code class="option">
options
</code>
consists of a list of comma-separated
<code class="literal">
<em class="replaceable">
<code>
key
</code>
</em>
=
<em class="replaceable">
<code>
value
</code>
</em>
</code>
.
The only permitted
<em class="replaceable">
<code>
key
</code>
</em>
value is
<code class="literal">
axis-order
</code>
, with permitted values of
<code class="literal">
lat-long
</code>
,
<code class="literal">
long-lat
</code>
and
<code class="literal">
srid-defined
</code>
(the default).
</p>
<p>
If the
<em class="replaceable">
<code>
options
</code>
</em>
argument is
<code class="literal">
NULL
</code>
, the return value is
<code class="literal">
NULL
</code>
. If the
<em class="replaceable">
<code>
options
</code>
</em>
argument is invalid, an
error occurs to indicate why.
</p>
</li>
<li class="listitem">
<p>
If an SRID argument refers to 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>
For geographic SRS geometry arguments, if any argument has a
longitude or latitude that is out of range, an error occurs:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If a longitude value is not in the range (−180,
180], an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_longitude_out_of_range" target="_top">
<code class="literal">
ER_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_latitude_out_of_range" target="_top">
<code class="literal">
ER_LATITUDE_OUT_OF_RANGE
</code>
</a>
error occurs.
</p>
</li>
</ul>
</div>
<p>
Ranges shown are in degrees. If an SRS uses another unit, the
range uses the corresponding values in its unit. The exact
range limits deviate slightly due to floating-point
arithmetic.
</p>
</li>
</ul>
</div>
<p>
These functions are available for creating geometries from WKT
values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a name="function_st-geomcollfromtext">
</a>
<p>
<a class="link" href="gis-wkt-functions.html#function_st-geomcollfromtext">
<code class="literal">
ST_GeomCollFromText(
<em class="replaceable">
<code>
wkt
</code>
</em>
[,
<em class="replaceable">
<code>
srid
</code>
</em>
[,
<em class="replaceable">
<code>
options
</code>
</em>
]])
</code>
</a>
,
<a class="link" href="gis-wkt-functions.html#function_st-geomcollfromtext">
<code class="literal">
ST_GeometryCollectionFromText(
<em class="replaceable">
<code>
wkt
</code>
</em>
[,
<em class="replaceable">
<code>
srid
</code>
</em>
[,
<em class="replaceable">
<code>
options
</code>
</em>
]])
</code>
</a>
,
<a class="link" href="gis-wkt-functions.html#function_st-geomcollfromtext">
<code class="literal">
ST_GeomCollFromTxt(
<em class="replaceable">
<code>
wkt
</code>
</em>
[,
<em class="replaceable">
<code>
srid
</code>
</em>
[,
<em class="replaceable">
<code>
options
</code>
</em>
]])
</code>
</a>
</p>
<a class="indexterm" name="idm46045197995056">
</a>
<a class="indexterm" name="idm46045197993984">
</a>
<p>
Constructs a
<code class="literal">
GeometryCollection
</code>
value using
its WKT representation and SRID.
</p>
<p>
These functions handle their 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="sa12758941"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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 string">"MULTILINESTRING((10 10, 11 11), (9 9, 10 10))"</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span><span class="token function">ST_GeomCollFromText</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 punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_GeomCollFromText(@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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> MULTILINESTRING((10 10,11 11),(9 9,10 10)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_st-geomfromtext">
</a>
<p>
<a class="link" href="gis-wkt-functions.html#function_st-geomfromtext">
<code class="literal">
ST_GeomFromText(
<em class="replaceable">
<code>
wkt
</code>
</em>
[,
<em class="replaceable">
<code>
srid
</code>
</em>
[,
<em class="replaceable">
<code>
options
</code>
</em>
]])
</code>
</a>
,
<a class="link" href="gis-wkt-functions.html#function_st-geomfromtext">
<code class="literal">
ST_GeometryFromText(
<em class="replaceable">
<code>
wkt
</code>
</em>
[,
<em class="replaceable">
<code>
srid
</code>
</em>
[,
<em class="replaceable">
<code>
options
</code>
</em>
]])
</code>
</a>
</p>
<a class="indexterm" name="idm46045197978592">
</a>
<a class="indexterm" name="idm46045197977520">
</a>
<p>
Constructs a geometry value of any type using its WKT
representation and SRID.
</p>
<p>
These functions handle their arguments as described in the
introduction to this section.
</p>
</li>
<li class="listitem">
<a name="function_st-linefromtext">
</a>
<p>
<a class="link" href="gis-wkt-functions.html#function_st-linefromtext">
<code class="literal">
ST_LineFromText(
<em class="replaceable">
<code>
wkt
</code>
</em>
[,
<em class="replaceable">
<code>
srid
</code>
</em>
[,
<em class="replaceable">
<code>
options
</code>
</em>
]])
</code>
</a>
,
<a class="link" href="gis-wkt-functions.html#function_st-linefromtext">
<code class="literal">
ST_LineStringFromText(
<em class="replaceable">
<code>
wkt
</code>
</em>
[,
<em class="replaceable">
<code>
srid
</code>
</em>
[,
<em class="replaceable">
<code>
options
</code>
</em>
]])
</code>
</a>
</p>
<a class="indexterm" name="idm46045197966544">
</a>
<a class="indexterm" name="idm46045197965472">
</a>
<p>
Constructs a
<code class="literal">
LineString
</code>
value using its WKT
representation and SRID.
</p>
<p>
These functions handle their arguments as described in the
introduction to this section.
</p>
</li>
<li class="listitem">
<a name="function_st-mlinefromtext">
</a>
<p>
<a class="link" href="gis-wkt-functions.html#function_st-mlinefromtext">
<code class="literal">
ST_MLineFromText(
<em class="replaceable">
<code>
wkt
</code>
</em>
[,
<em class="replaceable">
<code>
srid
</code>
</em>
[,
<em class="replaceable">
<code>
options
</code>
</em>
]])
</code>
</a>
,
<a class="link" href="gis-wkt-functions.html#function_st-mlinefromtext">
<code class="literal">
ST_MultiLineStringFromText(
<em class="replaceable">
<code>
wkt
</code>
</em>
[,
<em class="replaceable">
<code>
srid
</code>
</em>
[,
<em class="replaceable">
<code>
options
</code>
</em>
]])
</code>
</a>
</p>
<a class="indexterm" name="idm46045197953904">
</a>
<a class="indexterm" name="idm46045197952832">
</a>
<p>
Constructs a
<code class="literal">
MultiLineString
</code>
value using
its WKT representation and SRID.
</p>
<p>
These functions handle their arguments as described in the
introduction to this section.
</p>
</li>
<li class="listitem">
<a name="function_st-mpointfromtext">
</a>
<p>
<a class="link" href="gis-wkt-functions.html#function_st-mpointfromtext">
<code class="literal">
ST_MPointFromText(
<em class="replaceable">
<code>
wkt
</code>
</em>
[,
<em class="replaceable">
<code>
srid
</code>
</em>
[,
<em class="replaceable">
<code>
options
</code>
</em>
]])
</code>
</a>
,
<a class="link" href="gis-wkt-functions.html#function_st-mpointfromtext">
<code class="literal">
ST_MultiPointFromText(
<em class="replaceable">
<code>
wkt
</code>
</em>
[,
<em class="replaceable">
<code>
srid
</code>
</em>
[,
<em class="replaceable">
<code>
options
</code>
</em>
]])
</code>
</a>
</p>
<a class="indexterm" name="idm46045197941104">
</a>
<a class="indexterm" name="idm46045197940032">
</a>
<p>
Constructs a
<code class="literal">
MultiPoint
</code>
value using its WKT
representation and SRID.
</p>
<p>
These functions handle their arguments as described in the
introduction to this section.
</p>
</li>
<li class="listitem">
<a name="function_st-mpolyfromtext">
</a>
<p>
<a class="link" href="gis-wkt-functions.html#function_st-mpolyfromtext">
<code class="literal">
ST_MPolyFromText(
<em class="replaceable">
<code>
wkt
</code>
</em>
[,
<em class="replaceable">
<code>
srid
</code>
</em>
[,
<em class="replaceable">
<code>
options
</code>
</em>
]])
</code>
</a>
,
<a class="link" href="gis-wkt-functions.html#function_st-mpolyfromtext">
<code class="literal">
ST_MultiPolygonFromText(
<em class="replaceable">
<code>
wkt
</code>
</em>
[,
<em class="replaceable">
<code>
srid
</code>
</em>
[,
<em class="replaceable">
<code>
options
</code>
</em>
]])
</code>
</a>
</p>
<a class="indexterm" name="idm46045197928400">
</a>
<a class="indexterm" name="idm46045197927328">
</a>
<p>
Constructs a
<code class="literal">
MultiPolygon
</code>
value using its
WKT representation and SRID.
</p>
<p>
These functions handle their arguments as described in the
introduction to this section.
</p>
</li>
<li class="listitem">
<a name="function_st-pointfromtext">
</a>
<p>
<a class="link" href="gis-wkt-functions.html#function_st-pointfromtext">
<code class="literal">
ST_PointFromText(
<em class="replaceable">
<code>
wkt
</code>
</em>
[,
<em class="replaceable">
<code>
srid
</code>
</em>
[,
<em class="replaceable">
<code>
options
</code>
</em>
]])
</code>
</a>
</p>
<a class="indexterm" name="idm46045197918176">
</a>
<p>
Constructs a
<code class="literal">
Point
</code>
value using its WKT
representation and SRID.
</p>
<p>
<a class="link" href="gis-wkt-functions.html#function_st-pointfromtext">
<code class="literal">
ST_PointFromText()
</code>
</a>
handles its
arguments as described in the introduction to this section.
</p>
</li>
<li class="listitem">
<a name="function_st-polyfromtext">
</a>
<p>
<a class="link" href="gis-wkt-functions.html#function_st-polyfromtext">
<code class="literal">
ST_PolyFromText(
<em class="replaceable">
<code>
wkt
</code>
</em>
[,
<em class="replaceable">
<code>
srid
</code>
</em>
[,
<em class="replaceable">
<code>
options
</code>
</em>
]])
</code>
</a>
,
<a class="link" href="gis-wkt-functions.html#function_st-polyfromtext">
<code class="literal">
ST_PolygonFromText(
<em class="replaceable">
<code>
wkt
</code>
</em>
[,
<em class="replaceable">
<code>
srid
</code>
</em>
[,
<em class="replaceable">
<code>
options
</code>
</em>
]])
</code>
</a>
</p>
<a class="indexterm" name="idm46045197905312">
</a>
<a class="indexterm" name="idm46045197904240">
</a>
<p>
Constructs a
<code class="literal">
Polygon
</code>
value using its WKT
representation and SRID.
</p>
<p>
These functions handle their arguments as described in the
introduction to this section.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/charset-repertoire.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="charset-repertoire">
</a>
12.2.1 Character Set Repertoire
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045218083200">
</a>
<a class="indexterm" name="idm46045218081744">
</a>
<a class="indexterm" name="idm46045218080256">
</a>
<a class="indexterm" name="idm46045218078768">
</a>
<p>
The
<span class="firstterm">
repertoire
</span>
of a
character set is the collection of characters in the set.
</p>
<p>
String expressions have a repertoire attribute, which can have
two values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
ASCII
</code>
: The expression can contain only
ASCII characters; that is, characters in the Unicode range
<code class="literal">
U+0000
</code>
to
<code class="literal">
U+007F
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
UNICODE
</code>
: The expression can contain
characters in the Unicode range
<code class="literal">
U+0000
</code>
to
<code class="literal">
U+10FFFF
</code>
. This includes characters in the
Basic Multilingual Plane (BMP) range
(
<code class="literal">
U+0000
</code>
to
<code class="literal">
U+FFFF
</code>
) and
supplementary characters outside the BMP range
(
<code class="literal">
U+10000
</code>
to
<code class="literal">
U+10FFFF
</code>
).
</p>
</li>
</ul>
</div>
<p>
The
<code class="literal">
ASCII
</code>
range is a subset of
<code class="literal">
UNICODE
</code>
range, so a string with
<code class="literal">
ASCII
</code>
repertoire can be converted safely
without loss of information to the character set of any string
with
<code class="literal">
UNICODE
</code>
repertoire. It can also be
converted safely to any character set that is a superset of the
<code class="literal">
ascii
</code>
character set. (All MySQL character
sets are supersets of
<code class="literal">
ascii
</code>
with the
exception of
<code class="literal">
swe7
</code>
, which reuses some
punctuation characters for Swedish accented characters.)
</p>
<p>
The use of repertoire enables character set conversion in
expressions for many cases where MySQL would otherwise return an
<span class="quote">
“
<span class="quote">
illegal mix of collations
</span>
”
</span>
error when the rules
for collation coercibility are insufficient to resolve
ambiguities. (For information about coercibility, see
<a class="xref" href="charset-collation-coercibility.html" title="12.8.4 Collation Coercibility in Expressions">
Section 12.8.4, “Collation Coercibility in Expressions”
</a>
.)
</p>
<p>
The following discussion provides examples of expressions and
their repertoires, and describes how the use of repertoire
changes string expression evaluation:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The repertoire for a string constant depends on string
content and may differ from the repertoire of the string
character set. Consider these statements:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa60377236"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">NAMES</span> utf8mb4<span class="token punctuation">;</span> <span class="token keyword">SELECT</span> <span class="token string">'abc'</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> _utf8mb4<span class="token string">'def'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Although the character set is
<code class="literal">
utf8mb4
</code>
in
each of the preceding cases, the strings do not actually
contain any characters outside the ASCII range, so their
repertoire is
<code class="literal">
ASCII
</code>
rather than
<code class="literal">
UNICODE
</code>
.
</p>
</li>
<li class="listitem">
<p>
A column having the
<code class="literal">
ascii
</code>
character set
has
<code class="literal">
ASCII
</code>
repertoire because of its
character set. In the following table,
<code class="literal">
c1
</code>
has
<code class="literal">
ASCII
</code>
repertoire:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa65011247"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>c1 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> ascii<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The following example illustrates how repertoire enables a
result to be determined in a case where an error occurs
without repertoire:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa40017395"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>
c1 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> latin1<span class="token punctuation">,</span>
c2 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> ascii
<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t1 <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token string">'a'</span><span class="token punctuation">,</span><span class="token string">'b'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token function">CONCAT</span><span class="token punctuation">(</span>c1<span class="token punctuation">,</span>c2<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1<span class="token punctuation">;</span></code></pre>
</div>
<p>
Without repertoire, this error occurs:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa97760120"><div class="copy-help left">Press ⌘+C to 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 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,IMPLICIT)
and (ascii_general_ci,IMPLICIT) for operation 'concat'</code></pre>
</div>
<p>
Using repertoire, subset to superset
(
<code class="literal">
ascii
</code>
to
<code class="literal">
latin1
</code>
)
conversion can occur and a result is returned:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa95460253"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple"><span class="token operator">+</span><span class="token operator">--</span><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> CONCAT<span class="token punctuation">(</span>c1<span class="token punctuation">,</span>c2<span class="token punctuation">)</span> <span class="token operator">|</span>
<span class="token operator">+</span><span class="token operator">--</span><span class="token operator">--</span><span class="token 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> ab <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></code></pre>
</div>
</li>
<li class="listitem">
<p>
Functions with one string argument inherit the repertoire of
their argument. The result of
<a class="link" href="string-functions.html#function_upper">
<code class="literal">
UPPER(_utf8mb4'abc')
</code>
</a>
has
<code class="literal">
ASCII
</code>
repertoire because its argument has
<code class="literal">
ASCII
</code>
repertoire. (Despite the
<code class="literal">
_utf8mb4
</code>
introducer, the string
<code class="literal">
'abc'
</code>
contains no characters outside the
ASCII range.)
</p>
</li>
<li class="listitem">
<p>
For functions that return a string but do not have string
arguments and use
<a class="link" href="server-system-variables.html#sysvar_character_set_connection">
<code class="literal">
character_set_connection
</code>
</a>
as
the result character set, the result repertoire is
<code class="literal">
ASCII
</code>
if
<a class="link" href="server-system-variables.html#sysvar_character_set_connection">
<code class="literal">
character_set_connection
</code>
</a>
is
<code class="literal">
ascii
</code>
, and
<code class="literal">
UNICODE
</code>
otherwise:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa3123511"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">FORMAT</span><span class="token punctuation">(</span><em class="replaceable">numeric_column</em><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Use of repertoire changes how MySQL evaluates the following
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa39087744"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">NAMES</span> ascii<span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>a <span class="token datatype">INT</span><span class="token punctuation">,</span> b <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> latin1<span class="token punctuation">)</span><span class="token punctuation">;</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 string">'b'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token function">CONCAT</span><span class="token punctuation">(</span><span class="token function">FORMAT</span><span class="token punctuation">(</span>a<span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">,</span> b<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1<span class="token punctuation">;</span></code></pre>
</div>
<p>
Without repertoire, this error occurs:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa16859809"><div class="copy-help left">Press ⌘+C to 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 1267 (HY000): Illegal mix of collations (ascii_general_ci,COERCIBLE)
and (latin1_swedish_ci,IMPLICIT) for operation 'concat'</code></pre>
</div>
<p>
With repertoire, a result is returned:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa56447398"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> CONCAT(FORMAT(a, 4), b) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1.0000b <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
Functions with two or more string arguments use the
<span class="quote">
“
<span class="quote">
widest
</span>
”
</span>
argument repertoire for the result
repertoire, where
<code class="literal">
UNICODE
</code>
is wider than
<code class="literal">
ASCII
</code>
. Consider the following
<a class="link" href="string-functions.html#function_concat">
<code class="literal">
CONCAT()
</code>
</a>
calls:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa23933692"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CONCAT</span><span class="token punctuation">(</span>_ucs2 X<span class="token string">'0041'</span><span class="token punctuation">,</span> _ucs2 X<span class="token string">'0042'</span><span class="token punctuation">)</span>
<span class="token function">CONCAT</span><span class="token punctuation">(</span>_ucs2 X<span class="token string">'0041'</span><span class="token punctuation">,</span> _ucs2 X<span class="token string">'00C2'</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
For the first call, the repertoire is
<code class="literal">
ASCII
</code>
because both arguments are within
the ASCII range. For the second call, the repertoire is
<code class="literal">
UNICODE
</code>
because the second argument is
outside the ASCII range.
</p>
</li>
<li class="listitem">
<p>
The repertoire for function return values is determined
based on the repertoire of only those arguments that affect
the result's character set and collation.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa67789889"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">IF</span><span class="token punctuation">(</span>column1 <span class="token operator"><</span> column2<span class="token punctuation">,</span> <span class="token string">'smaller'</span><span class="token punctuation">,</span> <span class="token string">'greater'</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
The result repertoire is
<code class="literal">
ASCII
</code>
because
the two string arguments (the second argument and the third
argument) both have
<code class="literal">
ASCII
</code>
repertoire. The
first argument does not matter for the result repertoire,
even if the expression uses string values.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/selecting-all.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="selecting-all">
</a>
5.3.4.1 Selecting All Data
</h4>
</div>
</div>
</div>
<p>
The simplest form of
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
retrieves everything from a table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa2731599"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> pet<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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> owner <span class="token punctuation">|</span> species <span class="token punctuation">|</span> sex <span class="token punctuation">|</span> birth <span class="token punctuation">|</span> death <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Fluffy <span class="token punctuation">|</span> Harold <span class="token punctuation">|</span> cat <span class="token punctuation">|</span> f <span class="token punctuation">|</span> 1993<span class="token punctuation">-</span>02<span class="token punctuation">-</span>04 <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Claws <span class="token punctuation">|</span> Gwen <span class="token punctuation">|</span> cat <span class="token punctuation">|</span> m <span class="token punctuation">|</span> 1994<span class="token punctuation">-</span>03<span class="token punctuation">-</span>17 <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Buffy <span class="token punctuation">|</span> Harold <span class="token punctuation">|</span> dog <span class="token punctuation">|</span> f <span class="token punctuation">|</span> 1989<span class="token punctuation">-</span>05<span class="token punctuation">-</span>13 <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Fang <span class="token punctuation">|</span> Benny <span class="token punctuation">|</span> dog <span class="token punctuation">|</span> m <span class="token punctuation">|</span> 1990<span class="token punctuation">-</span>08<span class="token punctuation">-</span>27 <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Bowser <span class="token punctuation">|</span> Diane <span class="token punctuation">|</span> dog <span class="token punctuation">|</span> m <span class="token punctuation">|</span> 1979<span class="token punctuation">-</span>08<span class="token punctuation">-</span>31 <span class="token punctuation">|</span> 1995<span class="token punctuation">-</span>07<span class="token punctuation">-</span>29 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Chirpy <span class="token punctuation">|</span> Gwen <span class="token punctuation">|</span> bird <span class="token punctuation">|</span> f <span class="token punctuation">|</span> 1998<span class="token punctuation">-</span>09<span class="token punctuation">-</span>11 <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Whistler <span class="token punctuation">|</span> Gwen <span class="token punctuation">|</span> bird <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 1997<span class="token punctuation">-</span>12<span class="token punctuation">-</span>09 <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Slim <span class="token punctuation">|</span> Benny <span class="token punctuation">|</span> snake <span class="token punctuation">|</span> m <span class="token punctuation">|</span> 1996<span class="token punctuation">-</span>04<span class="token punctuation">-</span>29 <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Puffball <span class="token punctuation">|</span> Diane <span class="token punctuation">|</span> hamster <span class="token punctuation">|</span> f <span class="token punctuation">|</span> 1999<span class="token punctuation">-</span>03<span class="token punctuation">-</span>30 <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
This form of
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
uses
<code class="literal">
*
</code>
, which is shorthand for
<span class="quote">
“
<span class="quote">
select all
columns.
</span>
”
</span>
This is useful if you want to review your
entire table, for example, after you've just loaded it with
your initial data set. For example, you may happen to think
that the birth date for Bowser doesn't seem quite right.
Consulting your original pedigree papers, you find that the
correct birth year should be 1989, not 1979.
</p>
<p>
There are at least two ways to fix this:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Edit the file
<code class="filename">
pet.txt
</code>
to correct the
error, then empty the table and reload it using
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
and
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa83899697"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">DELETE</span> <span class="token keyword">FROM</span> pet<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">LOAD</span> <span class="token keyword">DATA</span> <span class="token keyword">LOCAL</span> <span class="token keyword">INFILE</span> <span class="token string">'pet.txt'</span> <span class="token keyword">INTO</span> <span class="token keyword">TABLE</span> pet<span class="token punctuation">;</span></code></pre>
</div>
<p>
However, if you do this, you must also re-enter the record
for Puffball.
</p>
</li>
<li class="listitem">
<p>
Fix only the erroneous record with an
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa21935260"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> pet <span class="token keyword">SET</span> birth <span class="token operator">=</span> <span class="token string">'1989-08-31'</span> <span class="token keyword">WHERE</span> <span class="token keyword">name</span> <span class="token operator">=</span> <span class="token string">'Bowser'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
changes only the
record in question and does not require you to reload the
table.
</p>
</li>
</ul>
</div>
<p>
There is an exception to the principle that
<code class="literal">
SELECT
*
</code>
selects all columns. If a table contains invisible
columns,
<code class="literal">
*
</code>
does not include them. For more
information, see
<a class="xref" href="invisible-columns.html" title="15.1.20.10 Invisible Columns">
Section 15.1.20.10, “Invisible Columns”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/option-defaults-equals.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="option-defaults-equals">
</a>
6.2.2.6 Option Defaults, Options Expecting Values, and the = Sign
</h4>
</div>
</div>
</div>
<p>
By convention, long forms of options that assign a value are
written with an equals (
<code class="literal">
=
</code>
) sign, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa44783281"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysql <span class="token constant">--host</span><span class="token attr-value"><span class="token punctuation">=</span>tonfisk</span> <span class="token constant">--user</span><span class="token attr-value"><span class="token punctuation">=</span>jon</span></code></pre>
</div>
<p>
For options that require a value (that is, not having a default
value), the equal sign is not required, and so the following is
also valid:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa45185826"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysql <span class="token property">--host</span> tonfisk <span class="token property">--user</span> jon</code></pre>
</div>
<p>
In both cases, the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client attempts to
connect to a MySQL server running on the host named
<span class="quote">
“
<span class="quote">
tonfisk
</span>
”
</span>
using an account with the user name
<span class="quote">
“
<span class="quote">
jon
</span>
”
</span>
.
</p>
<p>
Due to this behavior, problems can occasionally arise when no
value is provided for an option that expects one. Consider the
following example, where a user connects to a MySQL server
running on host
<code class="literal">
tonfisk
</code>
as user
<code class="literal">
jon
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa76328561"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span> <span class="token property">--host</span> 85<span class="token punctuation">.</span>224<span class="token punctuation">.</span>35<span class="token punctuation">.</span>45 <span class="token property">--user</span> jon
Welcome to the MySQL monitor<span class="token punctuation">.</span> Commands end with <span class="token punctuation">;</span> or \g<span class="token punctuation">.</span>
Your MySQL connection id is 3
Server version<span class="token punctuation">:</span> 8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>3 Source distribution
Type <span class="token atrule">'help;'</span> or <span class="token atrule">'\h'</span> for help<span class="token punctuation">.</span> Type <span class="token atrule">'\c'</span> to clear the buffer<span class="token punctuation">.</span>
<span class="token prompt">mysql></span><span class="token command"> SELECT</span> CURRENT_USER<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> CURRENT_USER() <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> jon@% <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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>
Omitting the required value for one of these option yields an
error, such as the one shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa21792931"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span> <span class="token property">--host</span> 85<span class="token punctuation">.</span>224<span class="token punctuation">.</span>35<span class="token punctuation">.</span>45 <span class="token property">--user</span>
mysql<span class="token punctuation">:</span> option <span class="token atrule">'--user'</span> requires an argument</code></pre>
</div>
<p>
In this case,
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
was unable to find a
value following the
<a class="link" href="connection-options.html#option_general_user">
<code class="option">
--user
</code>
</a>
option because nothing came after it on the command line.
However, if you omit the value for an option that is
<span class="emphasis">
<em>
not
</em>
</span>
the last option to be used, you obtain
a different error that you may not be expecting:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa97399641"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span> <span class="token property">--host</span> <span class="token property">--user</span> jon
<span class="token output">ERROR 2005 (HY000)<span class="token punctuation">:</span> Unknown MySQL server host '--user' (1)</span></code></pre>
</div>
<p>
Because
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
assumes that any string
following
<a class="link" href="connection-options.html#option_general_host">
<code class="option">
--host
</code>
</a>
on the command
line is a host name,
<a class="link" href="connection-options.html#option_general_host">
<code class="option">
--host
</code>
</a>
<a class="link" href="connection-options.html#option_general_user">
<code class="option">
--user
</code>
</a>
is interpreted as
<a class="link" href="connection-options.html#option_general_host">
<code class="option">
--host=--user
</code>
</a>
, and the client
attempts to connect to a MySQL server running on a host named
<span class="quote">
“
<span class="quote">
--user
</span>
”
</span>
.
</p>
<p>
Options having default values always require an equal sign when
assigning a value; failing to do so causes an error. For
example, the MySQL server
<a class="link" href="server-options.html#option_mysqld_log-error">
<code class="option">
--log-error
</code>
</a>
option has the
default value
<code class="filename">
<em class="replaceable">
<code>
host_name
</code>
</em>
.err
</code>
,
where
<em class="replaceable">
<code>
host_name
</code>
</em>
is the name of the
host on which MySQL is running. Assume that you are running
MySQL on a computer whose host name is
<span class="quote">
“
<span class="quote">
tonfisk
</span>
”
</span>
,
and consider the following invocation of
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa86831917"><div class="copy-help left">Press ⌘+C to 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 punctuation">[</span>1<span class="token punctuation">]</span> 11699
<span class="token prompt">$> </span><span class="token command">080112</span> 12<span class="token punctuation">:</span>53<span class="token punctuation">:</span>40 mysqld_safe Logging to <span class="token atrule">'/usr/local/mysql/var/tonfisk.err'</span><span class="token punctuation">.</span>
080112 12<span class="token punctuation">:</span>53<span class="token punctuation">:</span>40 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
$></code></pre>
</div>
<p>
After shutting down the server, restart it as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa39068703"><div class="copy-help left">Press ⌘+C to 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 property">--log-error</span> &
<span class="token punctuation">[</span>1<span class="token punctuation">]</span> 11699
<span class="token prompt">$> </span><span class="token command">080112</span> 12<span class="token punctuation">:</span>53<span class="token punctuation">:</span>40 mysqld_safe Logging to <span class="token atrule">'/usr/local/mysql/var/tonfisk.err'</span><span class="token punctuation">.</span>
080112 12<span class="token punctuation">:</span>53<span class="token punctuation">:</span>40 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
$></code></pre>
</div>
<p>
The result is the same, since
<a class="link" href="mysqld-safe.html#option_mysqld_safe_log-error">
<code class="option">
--log-error
</code>
</a>
is not followed
by anything else on the command line, and it supplies its own
default value. (The
<code class="literal">
&
</code>
character tells the
operating system to run MySQL in the background; it is ignored
by MySQL itself.) Now suppose that you wish to log errors to a
file named
<code class="filename">
my-errors.err
</code>
. You might try
starting the server with
<code class="option">
--log-error my-errors
</code>
,
but this does not have the intended effect, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa92125802"><div class="copy-help left">Press ⌘+C to 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 property">--log-error</span> my-errors &
<span class="token punctuation">[</span>1<span class="token punctuation">]</span> 31357
<span class="token prompt">$> </span><span class="token command">080111</span> 22<span class="token punctuation">:</span>53<span class="token punctuation">:</span>31 mysqld_safe Logging to <span class="token atrule">'/usr/local/mysql/var/tonfisk.err'</span><span class="token punctuation">.</span>
080111 22<span class="token punctuation">:</span>53<span class="token punctuation">:</span>32 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
080111 22<span class="token punctuation">:</span>53<span class="token punctuation">:</span>34 mysqld_safe mysqld from pid file /usr/local/mysql/var/tonfisk<span class="token punctuation">.</span>pid ended
<span class="token punctuation">[</span>1<span class="token punctuation">]</span>+ Done <span class="token punctuation">.</span>/mysqld_safe <span class="token property">--log-error</span> my-errors</code></pre>
</div>
<p>
The server attempted to start using
<code class="filename">
/usr/local/mysql/var/tonfisk.err
</code>
as the
error log, but then shut down. Examining the last few lines of
this file shows the reason:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa64018264"><div class="copy-help left">Press ⌘+C to 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">tail</span> /usr/local/mysql/var/tonfisk<span class="token punctuation">.</span>err
2013-09-24T15<span class="token punctuation">:</span>36<span class="token punctuation">:</span>22<span class="token punctuation">.</span>278034Z 0 <span class="token property"><span class="token punctuation">[</span>ERROR<span class="token punctuation">]</span></span> Too many arguments <span class="token punctuation">(</span>first extra is <span class="token atrule">'my-errors'</span><span class="token punctuation">)</span><span class="token punctuation">.</span>
2013-09-24T15<span class="token punctuation">:</span>36<span class="token punctuation">:</span>22<span class="token punctuation">.</span>278059Z 0 <span class="token punctuation">[</span>Note<span class="token punctuation">]</span> Use <span class="token property">--verbose</span> <span class="token property">--help</span> to get a list of available options!
2013-09-24T15<span class="token punctuation">:</span>36<span class="token punctuation">:</span>22<span class="token punctuation">.</span>278076Z 0 <span class="token property"><span class="token punctuation">[</span>ERROR<span class="token punctuation">]</span></span> Aborting
2013-09-24T15<span class="token punctuation">:</span>36<span class="token punctuation">:</span>22<span class="token punctuation">.</span>279704Z 0 <span class="token punctuation">[</span>Note<span class="token punctuation">]</span> InnoDB<span class="token punctuation">:</span> Starting shutdown<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
2013-09-24T15<span class="token punctuation">:</span>36<span class="token punctuation">:</span>23<span class="token punctuation">.</span>777471Z 0 <span class="token punctuation">[</span>Note<span class="token punctuation">]</span> InnoDB<span class="token punctuation">:</span> Shutdown completed<span class="token punctuation">;</span> log sequence number 2319086
2013-09-24T15<span class="token punctuation">:</span>36<span class="token punctuation">:</span>23<span class="token punctuation">.</span>780134Z 0 <span class="token punctuation">[</span>Note<span class="token punctuation">]</span> mysqld<span class="token punctuation">:</span> Shutdown complete</code></pre>
</div>
<p>
Because the
<a class="link" href="mysqld-safe.html#option_mysqld_safe_log-error">
<code class="option">
--log-error
</code>
</a>
option supplies a default value, you must use an equal sign to
assign a different value to it, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa48839322"><div class="copy-help left">Press ⌘+C to 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">--log-error</span><span class="token attr-value"><span class="token punctuation">=</span>my-errors</span> &
<span class="token punctuation">[</span>1<span class="token punctuation">]</span> 31437
<span class="token prompt">$> </span><span class="token command">080111</span> 22<span class="token punctuation">:</span>54<span class="token punctuation">:</span>15 mysqld_safe Logging to <span class="token atrule">'/usr/local/mysql/var/my-errors.err'</span><span class="token punctuation">.</span>
080111 22<span class="token punctuation">:</span>54<span class="token punctuation">:</span>15 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
$></code></pre>
</div>
<p>
Now the server has been started successfully, and is logging
errors to the file
<code class="filename">
/usr/local/mysql/var/my-errors.err
</code>
.
</p>
<p>
Similar issues can arise when specifying option values in option
files. For example, consider a
<code class="filename">
my.cnf
</code>
file
that contains the following:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa47793027"><div class="copy-help left">Press ⌘+C to 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">[mysql]</span>
<span class="token constant">host</span>
<span class="token constant">user</span></code></pre>
</div>
<p>
When the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client reads this file, these
entries are parsed as
<a class="link" href="mysql-command-options.html#option_mysql_host">
<code class="option">
--host
</code>
</a>
<a class="link" href="mysql-command-options.html#option_mysql_user">
<code class="option">
--user
</code>
</a>
or
<a class="link" href="mysql-command-options.html#option_mysql_host">
<code class="option">
--host=--user
</code>
</a>
, with the result
shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa49341005"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span>
<span class="token output">ERROR 2005 (HY000)<span class="token punctuation">:</span> Unknown MySQL server host '--user' (1)</span></code></pre>
</div>
<p>
However, in option files, an equal sign is not assumed. Suppose
the
<code class="filename">
my.cnf
</code>
file is as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa2341676"><div class="copy-help left">Press ⌘+C to 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">[mysql]</span>
user jon</code></pre>
</div>
<p>
Trying to start
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
in this case causes a
different error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa68792210"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span>
mysql<span class="token punctuation">:</span> unknown option <span class="token atrule">'--user jon'</span></code></pre>
</div>
<p>
A similar error would occur if you were to write
<code class="literal">
host
tonfisk
</code>
in the option file rather than
<code class="literal">
host=tonfisk
</code>
. Instead, you must use the equal
sign:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa26978338"><div class="copy-help left">Press ⌘+C to 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">[mysql]</span>
<span class="token constant">user</span><span class="token attr-value"><span class="token punctuation">=</span>jon</span></code></pre>
</div>
<p>
Now the login attempt succeeds:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa60260027"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span>
Welcome to the MySQL monitor<span class="token punctuation">.</span> Commands end with <span class="token punctuation">;</span> or \g<span class="token punctuation">.</span>
Your MySQL connection id is 5
Server version<span class="token punctuation">:</span> 8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>3 Source distribution
Type <span class="token atrule">'help;'</span> or <span class="token atrule">'\h'</span> for help<span class="token punctuation">.</span> Type <span class="token atrule">'\c'</span> to clear the buffer<span class="token punctuation">.</span>
<span class="token prompt">mysql></span><span class="token command"> SELECT</span> USER<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>
<span class="token output"><span class="token punctuation">|</span> USER() <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> jon@localhost <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
This is not the same behavior as with the command line, where
the equal sign is not required:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa57383363"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span> <span class="token property">--user</span> jon <span class="token property">--host</span> tonfisk
Welcome to the MySQL monitor<span class="token punctuation">.</span> Commands end with <span class="token punctuation">;</span> or \g<span class="token punctuation">.</span>
Your MySQL connection id is 6
Server version<span class="token punctuation">:</span> 8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>3 Source distribution
Type <span class="token atrule">'help;'</span> or <span class="token atrule">'\h'</span> for help<span class="token punctuation">.</span> Type <span class="token atrule">'\c'</span> to clear the buffer<span class="token punctuation">.</span>
<span class="token prompt">mysql></span><span class="token command"> SELECT</span> USER<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>
<span class="token output"><span class="token punctuation">|</span> USER() <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> jon@tonfisk <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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>
Specifying an option requiring a value without a value in an
option file causes the server to abort with an error.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-monitors.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="innodb-monitors">
</a>
17.17 InnoDB Monitors
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="innodb-monitor-types.html">
17.17.1 InnoDB Monitor Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-enabling-monitors.html">
17.17.2 Enabling InnoDB Monitors
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-standard-monitor.html">
17.17.3 InnoDB Standard Monitor and Lock Monitor Output
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045149443120">
</a>
<a class="indexterm" name="idm46045149442048">
</a>
<p>
<code class="literal">
InnoDB
</code>
monitors provide information about the
<code class="literal">
InnoDB
</code>
internal state. This information is useful
for performance tuning.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/spatial-convenience-functions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="spatial-convenience-functions">
</a>
14.16.13 Spatial Convenience Functions
</h3>
</div>
</div>
</div>
<p>
The functions in this section provide convenience operations on
geometry values.
</p>
<p>
Unless otherwise specified, functions in this section handle their
geometry arguments as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If any argument is
<code class="literal">
NULL
</code>
, 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>
For functions that take multiple geometry arguments, if those
arguments are not in the same SRS, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_gis_different_srids" target="_top">
<code class="literal">
ER_GIS_DIFFERENT_SRIDS
</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 convenience functions are available:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a name="function_st-distance-sphere">
</a>
<p>
<a class="link" href="spatial-convenience-functions.html#function_st-distance-sphere">
<code class="literal">
ST_Distance_Sphere(
<em class="replaceable">
<code>
g1
</code>
</em>
,
<em class="replaceable">
<code>
g2
</code>
</em>
[,
<em class="replaceable">
<code>
radius
</code>
</em>
])
</code>
</a>
</p>
<a class="indexterm" name="idm46045195989344">
</a>
<p>
Returns the minimum spherical distance between
<code class="literal">
Point
</code>
or
<code class="literal">
MultiPoint
</code>
arguments on a sphere, in meters. (For general-purpose
distance calculations, see the
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-distance">
<code class="literal">
ST_Distance()
</code>
</a>
function.) The
optional
<em class="replaceable">
<code>
radius
</code>
</em>
argument should be
given in meters.
</p>
<p>
If both geometry parameters are valid Cartesian
<code class="literal">
Point
</code>
or
<code class="literal">
MultiPoint
</code>
values in SRID 0, the return value is shortest distance
between the two geometries on a sphere with the provided
radius. If omitted, the default radius is 6,370,986 meters,
Point X and Y coordinates are interpreted as longitude and
latitude, respectively, in degrees.
</p>
<p>
If both geometry parameters are valid
<code class="literal">
Point
</code>
or
<code class="literal">
MultiPoint
</code>
values in a geographic
spatial reference system (SRS), the return value is the
shortest distance between the two geometries on a sphere with
the provided radius. If omitted, the default radius is equal
to the mean radius, defined as (2a+b)/3, where a is the
semi-major axis and b is the semi-minor axis of the SRS.
</p>
<p>
<a class="link" href="spatial-convenience-functions.html#function_st-distance-sphere">
<code class="literal">
ST_Distance_Sphere()
</code>
</a>
handles
its arguments as described in the introduction to this
section, with these exceptions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Supported geometry argument combinations are
<code class="literal">
Point
</code>
and
<code class="literal">
Point
</code>
, or
<code class="literal">
Point
</code>
and
<code class="literal">
MultiPoint
</code>
(in any argument order). If at least one of the geometries
is neither
<code class="literal">
Point
</code>
nor
<code class="literal">
MultiPoint
</code>
, and its SRID is 0, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_not_implemented_for_cartesian_srs" target="_top">
<code class="literal">
ER_NOT_IMPLEMENTED_FOR_CARTESIAN_SRS
</code>
</a>
error occurs. If at least one of the geometries is neither
<code class="literal">
Point
</code>
nor
<code class="literal">
MultiPoint
</code>
, and its SRID refers to a
geographic 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. If any geometry refers to a projected SRS,
an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_not_implemented_for_projected_srs" target="_top">
<code class="literal">
ER_NOT_IMPLEMENTED_FOR_PROJECTED_SRS
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
If any argument has 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. If an SRS uses another unit,
the range uses the corresponding values in its unit. The
exact range limits deviate slightly due to floating-point
arithmetic.
</p>
</li>
<li class="listitem">
<p>
If the
<em class="replaceable">
<code>
radius
</code>
</em>
argument is
present but not positive, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_nonpositive_radius" target="_top">
<code class="literal">
ER_NONPOSITIVE_RADIUS
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
If the distance exceeds the range of a double-precision
number, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_std_overflow_error" target="_top">
<code class="literal">
ER_STD_OVERFLOW_ERROR
</code>
</a>
error occurs.
</p>
</li>
</ul>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa74263015"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">@pt1</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'POINT(0 0)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@pt2</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'POINT(180 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_Distance_Sphere</span><span class="token punctuation">(</span><span class="token variable">@pt1</span><span class="token punctuation">,</span> <span class="token variable">@pt2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_Distance_Sphere(@pt1, @pt2) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 20015042.813723423 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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-isvalid">
</a>
<p>
<a class="link" href="spatial-convenience-functions.html#function_st-isvalid">
<code class="literal">
ST_IsValid(
<em class="replaceable">
<code>
g
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045195946416">
</a>
<p>
Returns 1 if the argument is geometrically valid, 0 if the
argument is not geometrically valid. Geometry validity is
defined by the OGC specification.
</p>
<p>
The only valid empty geometry is represented in the form of an
empty geometry collection value.
<a class="link" href="spatial-convenience-functions.html#function_st-isvalid">
<code class="literal">
ST_IsValid()
</code>
</a>
returns 1 in this
case. 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="spatial-convenience-functions.html#function_st-isvalid">
<code class="literal">
ST_IsValid()
</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. If an SRS uses another unit,
the range uses the corresponding values in its unit. The
exact range limits deviate slightly due to floating-point
arithmetic.
</p>
</li>
</ul>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa4390175"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">@ls1</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'LINESTRING(0 0,-0.00 0,0.0 0)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@ls2</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'LINESTRING(0 0, 1 1)'</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_IsValid</span><span class="token punctuation">(</span><span class="token variable">@ls1</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>
<span class="token output"><span class="token punctuation">|</span> ST_IsValid(@ls1) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">ST_IsValid</span><span class="token punctuation">(</span><span class="token variable">@ls2</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>
<span class="token output"><span class="token punctuation">|</span> ST_IsValid(@ls2) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_st-makeenvelope">
</a>
<p>
<a class="link" href="spatial-convenience-functions.html#function_st-makeenvelope">
<code class="literal">
ST_MakeEnvelope(
<em class="replaceable">
<code>
pt1
</code>
</em>
,
<em class="replaceable">
<code>
pt2
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045195921680">
</a>
<p>
Returns the rectangle that forms the envelope around two
points, as a
<code class="literal">
Point
</code>
,
<code class="literal">
LineString
</code>
, or
<code class="literal">
Polygon
</code>
.
</p>
<p>
Calculations are done using the Cartesian coordinate system
rather than on a sphere, spheroid, or on earth.
</p>
<p>
Given two points
<em class="replaceable">
<code>
pt1
</code>
</em>
and
<em class="replaceable">
<code>
pt2
</code>
</em>
,
<a class="link" href="spatial-convenience-functions.html#function_st-makeenvelope">
<code class="literal">
ST_MakeEnvelope()
</code>
</a>
creates the
result geometry on an abstract plane like this:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If
<em class="replaceable">
<code>
pt1
</code>
</em>
and
<em class="replaceable">
<code>
pt2
</code>
</em>
are equal, the result is
the point
<em class="replaceable">
<code>
pt1
</code>
</em>
.
</p>
</li>
<li class="listitem">
<p>
Otherwise, if
<code class="literal">
(
<em class="replaceable">
<code>
pt1
</code>
</em>
,
<em class="replaceable">
<code>
pt2
</code>
</em>
)
</code>
is a vertical or
horizontal line segment, the result is the line segment
<code class="literal">
(
<em class="replaceable">
<code>
pt1
</code>
</em>
,
<em class="replaceable">
<code>
pt2
</code>
</em>
)
</code>
.
</p>
</li>
<li class="listitem">
<p>
Otherwise, the result is a polygon using
<em class="replaceable">
<code>
pt1
</code>
</em>
and
<em class="replaceable">
<code>
pt2
</code>
</em>
as diagonal points.
</p>
</li>
</ul>
</div>
<p>
The result geometry has an SRID of 0.
</p>
<p>
<a class="link" href="spatial-convenience-functions.html#function_st-makeenvelope">
<code class="literal">
ST_MakeEnvelope()
</code>
</a>
handles its
arguments as described in the introduction to this section,
with these exceptions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If the arguments are not
<code class="literal">
Point
</code>
values,
an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_wrong_arguments" target="_top">
<code class="literal">
ER_WRONG_ARGUMENTS
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
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 for the additional condition that any
coordinate value of the two points is infinite or
<code class="literal">
NaN
</code>
.
</p>
</li>
<li class="listitem">
<p>
If any 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>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa33408951"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">@pt1</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'POINT(0 0)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@pt2</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 punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span><span class="token function">ST_MakeEnvelope</span><span class="token punctuation">(</span><span class="token variable">@pt1</span><span class="token punctuation">,</span> <span class="token variable">@pt2</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_MakeEnvelope(@pt1, @pt2)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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((0 0,1 0,1 1,0 1,0 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></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_st-simplify">
</a>
<p>
<a class="link" href="spatial-convenience-functions.html#function_st-simplify">
<code class="literal">
ST_Simplify(
<em class="replaceable">
<code>
g
</code>
</em>
,
<em class="replaceable">
<code>
max_distance
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045195886192">
</a>
<p>
Simplifies a geometry using the Douglas-Peucker algorithm and
returns a simplified value of the same type.
</p>
<p>
The geometry may be any geometry type, although the
Douglas-Peucker algorithm may not actually process every type.
A geometry collection is processed by giving its components
one by one to the simplification algorithm, and the returned
geometries are put into a geometry collection as result.
</p>
<p>
The
<em class="replaceable">
<code>
max_distance
</code>
</em>
argument is the
distance (in units of the input coordinates) of a vertex to
other segments to be removed. Vertices within this distance of
the simplified linestring are removed.
</p>
<p>
According to Boost.Geometry, geometries might become invalid
as a result of the simplification process, and the process
might create self-intersections. To check the validity of the
result, pass it to
<a class="link" href="spatial-convenience-functions.html#function_st-isvalid">
<code class="literal">
ST_IsValid()
</code>
</a>
.
</p>
<p>
<a class="link" href="spatial-convenience-functions.html#function_st-simplify">
<code class="literal">
ST_Simplify()
</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
<em class="replaceable">
<code>
max_distance
</code>
</em>
argument is
not positive, or is
<code class="literal">
NaN
</code>
, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_wrong_arguments" target="_top">
<code class="literal">
ER_WRONG_ARGUMENTS
</code>
</a>
error
occurs.
</p>
</li>
</ul>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa84233553"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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(0 0,0 1,1 1,1 2,2 2,2 3,3 3)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span><span class="token function">ST_Simplify</span><span class="token punctuation">(</span><span class="token variable">@g</span><span class="token punctuation">,</span> <span class="token number">0.5</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>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_Simplify(@g, 0.5)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> LINESTRING(0 0,0 1,1 1,2 3,3 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>
<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_Simplify</span><span class="token punctuation">(</span><span class="token variable">@g</span><span class="token punctuation">,</span> <span class="token number">1.0</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>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_Simplify(@g, 1.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>
<span class="token output"><span class="token punctuation">|</span> LINESTRING(0 0,3 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></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_st-validate">
</a>
<p>
<a class="link" href="spatial-convenience-functions.html#function_st-validate">
<code class="literal">
ST_Validate(
<em class="replaceable">
<code>
g
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045195865536">
</a>
<p>
Validates a geometry according to the OGC specification. A
geometry can be syntactically well-formed (WKB value plus
SRID) but geometrically invalid. For example, this polygon is
geometrically invalid:
<code class="literal">
POLYGON((0 0, 0 0, 0 0, 0 0, 0
0))
</code>
</p>
<p>
<a class="link" href="spatial-convenience-functions.html#function_st-validate">
<code class="literal">
ST_Validate()
</code>
</a>
returns the
geometry if it is syntactically well-formed and is
geometrically valid,
<code class="literal">
NULL
</code>
if the argument
is not syntactically well-formed or is not geometrically valid
or is
<code class="literal">
NULL
</code>
.
</p>
<p>
<a class="link" href="spatial-convenience-functions.html#function_st-validate">
<code class="literal">
ST_Validate()
</code>
</a>
can be used to
filter out invalid geometry data, although at a cost. For
applications that require more precise results not tainted by
invalid data, this penalty may be worthwhile.
</p>
<p>
If the geometry argument is valid, it is returned as is,
except that if an input
<code class="literal">
Polygon
</code>
or
<code class="literal">
MultiPolygon
</code>
has clockwise rings, those
rings are reversed before checking for validity. If the
geometry is valid, the value with the reversed rings is
returned.
</p>
<p>
The only valid empty geometry is represented in the form of an
empty geometry collection value.
<a class="link" href="spatial-convenience-functions.html#function_st-validate">
<code class="literal">
ST_Validate()
</code>
</a>
returns it
directly without further checks in this case.
</p>
<p>
<a class="link" href="spatial-convenience-functions.html#function_st-validate">
<code class="literal">
ST_Validate()
</code>
</a>
handles its
arguments as described in the introduction to this section,
with the exceptions listed here:
</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>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa46860898"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">@ls1</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'LINESTRING(0 0)'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@ls2</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'LINESTRING(0 0, 1 1)'</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_AsText</span><span class="token punctuation">(</span><span class="token function">ST_Validate</span><span class="token punctuation">(</span><span class="token variable">@ls1</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>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_Validate(@ls1)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<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_Validate</span><span class="token punctuation">(</span><span class="token variable">@ls2</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>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_Validate(@ls2)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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(0 0,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></code></pre>
</div>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/tuning-trace-purging.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="tuning-trace-purging">
</a>
10.15.4 Tuning Trace Purging
</h3>
</div>
</div>
</div>
<p>
By default, each new trace overwrites the previous trace. Thus, if
a statement contains substatements (such as invoking stored
procedures, stored functions, or triggers), the topmost statement
and substatements each generate one trace, but at the end of
execution, the trace for only the last substatement is visible.
</p>
<p>
A user who wants to see the trace of a different substatement can
enable or disable tracing for the desired substatement, but this
requires editing the routine code, which may not always be
possible. Another solution is to tune trace purging. This is done
by setting the
<a class="link" href="server-system-variables.html#sysvar_optimizer_trace_offset">
<code class="literal">
optimizer_trace_offset
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_optimizer_trace_limit">
<code class="literal">
optimizer_trace_limit
</code>
</a>
system
variables, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa96188187"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> optimizer_trace_offset<span class="token operator">=</span><span class="token keyword"><em class="replaceable">offset</em></span><span class="token punctuation">,</span> optimizer_trace_limit<span class="token operator">=</span><span class="token keyword"><em class="replaceable">limit</em></span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<em class="replaceable">
<code>
offset
</code>
</em>
is a signed integer (default
<code class="literal">
-1
</code>
);
<em class="replaceable">
<code>
limit
</code>
</em>
is a
positive integer (default
<code class="literal">
1
</code>
). Such a
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
statement has the following
effects:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
All traces previously stored are cleared from memory.
</p>
</li>
<li class="listitem">
<p>
A subsequent
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
from the
<a class="link" href="information-schema-optimizer-trace-table.html" title="28.3.19 The INFORMATION_SCHEMA OPTIMIZER_TRACE Table">
<code class="literal">
OPTIMIZER_TRACE
</code>
</a>
table returns the
first
<em class="replaceable">
<code>
limit
</code>
</em>
traces of the
<em class="replaceable">
<code>
offset
</code>
</em>
oldest stored traces (if
<em class="replaceable">
<code>
offset
</code>
</em>
>= 0), or the first
<em class="replaceable">
<code>
limit
</code>
</em>
traces of the
<em class="replaceable">
<code>
-offset
</code>
</em>
newest stored traces (if
<em class="replaceable">
<code>
offset
</code>
</em>
< 0).
</p>
</li>
</ul>
</div>
<p>
Examples:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
SET optimizer_trace_offset=-1,
optimizer_trace_limit=1
</code>
: The most recent trace is
shown (the default).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SET optimizer_trace_offset=-2,
optimizer_trace_limit=1
</code>
: The next-to-last trace is
shown.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SET optimizer_trace_offset=-5,
optimizer_trace_limit=5
</code>
: The last five traces are
shown.
</p>
</li>
</ul>
</div>
<p>
Negative values for
<em class="replaceable">
<code>
offset
</code>
</em>
can thus
prove useful when the substatements of interest are the last few
in a stored routine. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63729201"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> optimizer_trace_offset<span class="token operator">=</span><span class="token operator">-</span><span class="token number">5</span><span class="token punctuation">,</span> optimizer_trace_limit<span class="token operator">=</span><span class="token number">5</span><span class="token punctuation">;</span>
<span class="token keyword">CALL</span> stored_routine<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment" spellcheck="true"># more than 5 substatements in this routine</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>OPTIMIZER_TRACE<span class="token punctuation">;</span> <span class="token comment" spellcheck="true"># see only the last 5 traces</span></code></pre>
</div>
<p>
A positive
<em class="replaceable">
<code>
offset
</code>
</em>
can be useful when
one knows that the interesting substatements are the first few in
a stored routine.
</p>
<p>
The more accurately these two variables are set, the less memory
is used. For example,
<code class="literal">
SET optimizer_trace_offset=0,
optimizer_trace_limit=5
</code>
requires sufficient memory to
store five traces, so if only the three first are needed, is is
better to use
<code class="literal">
SET optimizer_trace_offset=0,
optimizer_trace_limit=3
</code>
, since tracing stops after
<em class="replaceable">
<code>
limit
</code>
</em>
traces. A stored routine may have
a loop which executes many substatements and thus generates many
traces, which can use a lot of memory; in such cases, choosing
appropriate values for
<em class="replaceable">
<code>
offset
</code>
</em>
and
<em class="replaceable">
<code>
limit
</code>
</em>
can restrict tracing to, for
example, a single iteration of the loop. This also decreases the
impact of tracing on execution speed.
</p>
<p>
If
<em class="replaceable">
<code>
offset
</code>
</em>
is greater than or equal to
0, only
<em class="replaceable">
<code>
limit
</code>
</em>
traces are kept in
memory. If
<em class="replaceable">
<code>
offset
</code>
</em>
is less than 0, that
is not true: instead,
<em class="replaceable">
<code>
-offset
</code>
</em>
traces
are kept in memory. Even if
<em class="replaceable">
<code>
limit
</code>
</em>
is
smaller than
<em class="replaceable">
<code>
-offset
</code>
</em>
, excluding the
last statement, the last statement must still be traced because it
will be within the limit after executing one more statement. Since
an offset less than 0 is counted from the end, the
<span class="quote">
“
<span class="quote">
window
</span>
”
</span>
moves as more statements execute.
</p>
<p>
Using
<code class="literal">
optimizer_trace_offset
</code>
and
<code class="literal">
optimizer_trace_limit
</code>
, which are restrictions
at the trace producer level, provide better (greater) speed and
(less) memory usage than setting offsets or limits at the trace
consumer (SQL) level with
<code class="literal">
SELECT * FROM OPTIMIZER_TRACE
LIMIT
<em class="replaceable">
<code>
limit
</code>
</em>
OFFSET
<em class="replaceable">
<code>
offset
</code>
</em>
</code>
, which saves almost
nothing.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-solutions-scaleout.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="replication-solutions-scaleout">
</a>
19.4.5 Using Replication for Scale-Out
</h3>
</div>
</div>
</div>
<p>
You can use replication as a scale-out solution; that is, where
you want to split up the load of database queries across multiple
database servers, within some reasonable limitations.
</p>
<p>
Because replication works from the distribution of one source to
one or more replicas, using replication for scale-out works best
in an environment where you have a high number of reads and low
number of writes/updates. Most websites fit into this category,
where users are browsing the website, reading articles, posts, or
viewing products. Updates only occur during session management, or
when making a purchase or adding a comment/message to a forum.
</p>
<p>
Replication in this situation enables you to distribute the reads
over the replicas, while still enabling your web servers to
communicate with the source when a write is required. You can see
a sample replication layout for this scenario in
<a class="xref" href="replication-solutions-scaleout.html#figure_replication-scaleout" title="Figure 19.1 Using Replication to Improve Performance During Scale-Out">
Figure 19.1, “Using Replication to Improve Performance During Scale-Out”
</a>
.
</p>
<div class="figure">
<a name="figure_replication-scaleout">
</a>
<p class="title">
<b>
Figure 19.1 Using Replication to Improve Performance During Scale-Out
</b>
</p>
<div class="figure-contents">
<div class="mediaobject">
<img alt="Incoming requests from clients are directed to a load balancer, which distributes client data among a number of web clients. Writes made by web clients are directed to a single MySQL source server, and reads made by web clients are directed to one of three MySQL replica servers. Replication takes place from the MySQL source server to the three MySQL replica servers." src="images/scaleout.png" style="width: 100%; max-width: 376px;"/>
</div>
</div>
</div>
<br class="figure-break"/>
<p>
If the part of your code that is responsible for database access
has been properly abstracted/modularized, converting it to run
with a replicated setup should be very smooth and easy. Change the
implementation of your database access to send all writes to the
source, and to send reads to either the source or a replica. If
your code does not have this level of abstraction, setting up a
replicated system gives you the opportunity and motivation to
clean it up. Start by creating a wrapper library or module that
implements the following functions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
safe_writer_connect()
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
safe_reader_connect()
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
safe_reader_statement()
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
safe_writer_statement()
</code>
</p>
</li>
</ul>
</div>
<p>
<code class="literal">
safe_
</code>
in each function name means that the
function takes care of handling all error conditions. You can use
different names for the functions. The important thing is to have
a unified interface for connecting for reads, connecting for
writes, doing a read, and doing a write.
</p>
<p>
Then convert your client code to use the wrapper library. This may
be a painful and scary process at first, but it pays off in the
long run. All applications that use the approach just described
are able to take advantage of a source/replica configuration, even
one involving multiple replicas. The code is much easier to
maintain, and adding troubleshooting options is trivial. You need
modify only one or two functions (for example, to log how long
each statement took, or which statement among those issued gave
you an error).
</p>
<p>
If you have written a lot of code, you may want to automate the
conversion task by writing a conversion script. Ideally, your code
uses consistent programming style conventions. If not, then you
are probably better off rewriting it anyway, or at least going
through and manually regularizing it to use a consistent style.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/charset-syntax.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="charset-syntax">
</a>
12.3 Specifying Character Sets and Collations
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="charset-collation-names.html">
12.3.1 Collation Naming Conventions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-server.html">
12.3.2 Server Character Set and Collation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-database.html">
12.3.3 Database Character Set and Collation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-table.html">
12.3.4 Table Character Set and Collation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-column.html">
12.3.5 Column Character Set and Collation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-literal.html">
12.3.6 Character String Literal Character Set and Collation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-national.html">
12.3.7 The National Character Set
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-introducer.html">
12.3.8 Character Set Introducers
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-examples.html">
12.3.9 Examples of Character Set and Collation Assignment
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-compatibility.html">
12.3.10 Compatibility with Other DBMSs
</a>
</span>
</dt>
</dl>
</div>
<p>
There are default settings for character sets and collations at
four levels: server, database, table, and column. The description
in the following sections may appear complex, but it has been
found in practice that multiple-level defaulting leads to natural
and obvious results.
</p>
<p>
<code class="literal">
CHARACTER SET
</code>
is used in clauses that specify a
character set.
<code class="literal">
CHARSET
</code>
can be used as a synonym
for
<code class="literal">
CHARACTER SET
</code>
.
</p>
<p>
Character set issues affect not only data storage, but also
communication between client programs and the MySQL server. If you
want the client program to communicate with the server using a
character set different from the default, you need to indicate
which one. For example, to use the
<code class="literal">
latin1
</code>
Unicode character set, issue this statement after connecting to
the server:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa64069952"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">NAMES</span> <span class="token string">'latin1'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For more information about character set-related issues in
client/server communication, see
<a class="xref" href="charset-connection.html" title="12.4 Connection Character Sets and Collations">
Section 12.4, “Connection Character Sets and Collations”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/data-masking-component-variables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="data-masking-component-variables">
</a>
8.5.2.5 MySQL Enterprise Data Masking and De-Identification Component Variables
</h4>
</div>
</div>
</div>
<p>
The MySQL Enterprise Data Masking and De-Identification components support the following system variables.
Use these variables to configure related component operations.
Variables are unavailable unless the appropriate MySQL Enterprise Data Masking and De-Identification
components are installed (see
<a class="xref" href="data-masking-components-installation.html" title="8.5.2.1 MySQL Enterprise Data Masking and De-Identification Component Installation">
Section 8.5.2.1, “MySQL Enterprise Data Masking and De-Identification Component Installation”
</a>
).
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="sysvar_component_masking.dictionaries_flush_interval_seconds">
</a>
<a class="link" href="data-masking-component-variables.html#sysvar_component_masking.dictionaries_flush_interval_seconds">
<code class="literal">
component_masking.dictionaries_flush_interval_seconds
</code>
</a>
</p>
<a class="indexterm" name="idm46045232570656">
</a>
<a class="indexterm" name="idm46045232569616">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for component_masking.dictionaries_flush_interval_seconds">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--component-masking.dictionaries-flush-interval-seconds=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="data-masking-component-variables.html#sysvar_component_masking.dictionaries_flush_interval_seconds">
component_masking.dictionaries_flush_interval_seconds
</a>
</code>
</td>
</tr>
<tr>
<th>
Scope
</th>
<td>
Global
</td>
</tr>
<tr>
<th>
Dynamic
</th>
<td>
No
</td>
</tr>
<tr>
<th>
<a class="link" href="optimizer-hints.html#optimizer-hints-set-var" title="Variable-Setting Hint Syntax">
<code class="literal">
SET_VAR
</code>
</a>
Hint Applies
</th>
<td>
No
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
0
</code>
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
60
</code>
</td>
</tr>
<tr>
<th>
Maximum Value (Unix)
</th>
<td>
<code class="literal">
18446744073709551615
</code>
</td>
</tr>
<tr>
<th>
Maximum Value (Windows)
</th>
<td>
<code class="literal">
4294967295
</code>
</td>
</tr>
<tr>
<th>
Unit
</th>
<td>
seconds
</td>
</tr>
</tbody>
</table>
</div>
<p>
Sets the interval, in seconds, to wait before attempting to
schedule another flush of the data masking dictionaries
table to the memory data masking dictionaries cache
following a restart or previous execution. The value is
handled as listed here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
0: No flushing
</p>
</li>
<li class="listitem">
<p>
1 - 59 inclusive: Round up to 60, with a warning
</p>
</li>
<li class="listitem">
<p>
>= 60: Wait this many seconds to perform flush
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a name="sysvar_component_masking.masking_database">
</a>
<a class="link" href="data-masking-component-variables.html#sysvar_component_masking.masking_database">
<code class="literal">
component_masking.masking_database
</code>
</a>
</p>
<a class="indexterm" name="idm46045232532032">
</a>
<a class="indexterm" name="idm46045232530992">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for component_masking.masking_database">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--component-masking.masking-database[=value]
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="data-masking-component-variables.html#sysvar_component_masking.masking_database">
component_masking.masking_database
</a>
</code>
</td>
</tr>
<tr>
<th>
Scope
</th>
<td>
Global
</td>
</tr>
<tr>
<th>
Dynamic
</th>
<td>
No
</td>
</tr>
<tr>
<th>
<a class="link" href="optimizer-hints.html#optimizer-hints-set-var" title="Variable-Setting Hint Syntax">
<code class="literal">
SET_VAR
</code>
</a>
Hint Applies
</th>
<td>
No
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
mysql
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Specifies the database to use for data masking dictionaries
at server startup. This variable is read only.
</p>
<p>
Use this variable to set and persist a schema other than the
default value (
<code class="literal">
mysql
</code>
). For additional
information about setting up the data-masking components to
use an alternative location for the data-masking table, see
<a class="xref" href="data-masking-components-installation.html#data-masking-components-installation-dedicated" title="Install Using a Dedicated Schema">
Install Using a Dedicated Schema
</a>
.
For general guidelines about using the
<code class="literal">
PERSIST
ONLY
</code>
keyword, see
<a class="xref" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
Section 15.7.6.1, “SET Syntax for Variable Assignment”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-tls-channel-status-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-tls-channel-status-table">
</a>
29.12.22.9 The tls_channel_status Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045067008704">
</a>
<a class="indexterm" name="idm46045067007200">
</a>
<p>
Connection interface TLS properties are set at server startup,
and can be updated at runtime using the
<a class="link" href="alter-instance.html#alter-instance-reload-tls">
<code class="literal">
ALTER INSTANCE RELOAD TLS
</code>
</a>
statement. See
<a class="xref" href="using-encrypted-connections.html#using-encrypted-connections-server-side-runtime-configuration" title="Server-Side Runtime Configuration and Monitoring for Encrypted Connections">
Server-Side Runtime Configuration and Monitoring for Encrypted
Connections
</a>
.
</p>
<p>
The
<a class="link" href="performance-schema-tls-channel-status-table.html" title="29.12.22.9 The tls_channel_status Table">
<code class="literal">
tls_channel_status
</code>
</a>
table
provides information about connection interface TLS
properties:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa48269860"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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>tls_channel_status\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>
CHANNEL<span class="token punctuation">:</span> mysql_main
PROPERTY<span class="token punctuation">:</span> Enabled
VALUE<span class="token punctuation">:</span> Yes
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 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>
CHANNEL<span class="token punctuation">:</span> mysql_main
PROPERTY<span class="token punctuation">:</span> ssl_accept_renegotiates
VALUE<span class="token punctuation">:</span> 0
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 3. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
CHANNEL<span class="token punctuation">:</span> mysql_main
PROPERTY<span class="token punctuation">:</span> Ssl_accepts
VALUE<span class="token punctuation">:</span> 2
...
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 29. 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>
CHANNEL<span class="token punctuation">:</span> mysql_admin
PROPERTY<span class="token punctuation">:</span> Enabled
VALUE<span class="token punctuation">:</span> No
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 30. 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>
CHANNEL<span class="token punctuation">:</span> mysql_admin
PROPERTY<span class="token punctuation">:</span> ssl_accept_renegotiates
VALUE<span class="token punctuation">:</span> 0
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 31. 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>
CHANNEL<span class="token punctuation">:</span> mysql_admin
PROPERTY<span class="token punctuation">:</span> Ssl_accepts
VALUE<span class="token punctuation">:</span> 0
...</span></code></pre>
</div>
<p>
The
<a class="link" href="performance-schema-tls-channel-status-table.html" title="29.12.22.9 The tls_channel_status Table">
<code class="literal">
tls_channel_status
</code>
</a>
table has
these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
CHANNEL
</code>
</p>
<p>
The name of the connection interface to which the TLS
property row applies.
<code class="literal">
mysql_main
</code>
and
<code class="literal">
mysql_admin
</code>
are the channel names for
the main and administrative connection interfaces,
respectively. For information about the different
interfaces, see
<a class="xref" href="connection-interfaces.html" title="7.1.12.1 Connection Interfaces">
Section 7.1.12.1, “Connection Interfaces”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PROPERTY
</code>
</p>
<p>
The TLS property name. The row for the
<code class="literal">
Enabled
</code>
property indicates overall
interface status, where the interface and its status are
named in the
<code class="literal">
CHANNEL
</code>
and
<code class="literal">
VALUE
</code>
columns, respectively. Other
property names indicate particular TLS properties. These
often correspond to the names of TLS-related status
variables.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
VALUE
</code>
</p>
<p>
The TLS property value.
</p>
</li>
</ul>
</div>
<p>
The properties exposed by this table are not fixed and depend
on the instrumentation implemented by each channel.
</p>
<p>
For each channel, the row with a
<code class="literal">
PROPERTY
</code>
value of
<code class="literal">
Enabled
</code>
indicates whether the
channel supports encrypted connections, and other channel rows
indicate TLS context properties:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For
<code class="literal">
mysql_main
</code>
, the
<code class="literal">
Enabled
</code>
property is
<code class="literal">
yes
</code>
or
<code class="literal">
no
</code>
to
indicate whether the main interface supports encrypted
connections. Other channel rows display TLS context
properties for the main interface.
</p>
<p>
For the main interface, similar status information can be
obtained using these statements:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa27373781"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">GLOBAL</span> <span class="token keyword">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'current_tls%'</span><span class="token punctuation">;</span>
<span class="token keyword">SHOW</span> <span class="token keyword">GLOBAL</span> <span class="token keyword">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'ssl%'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
For
<code class="literal">
mysql_admin
</code>
, the
<code class="literal">
Enabled
</code>
property is
<code class="literal">
no
</code>
if the administrative interface is
not enabled or it is enabled but does not support
encrypted connections.
<code class="literal">
Enabled
</code>
is
<code class="literal">
yes
</code>
if the interface is enabled and
supports encrypted connections.
</p>
<p>
When
<code class="literal">
Enabled
</code>
is
<code class="literal">
yes
</code>
,
the other
<code class="literal">
mysql_admin
</code>
rows indicate
channel properties for the administrative interface TLS
context only if some nondefault TLS parameter value is
configured for that interface. (This is the case if any
<code class="literal">
admin_tls_
<em class="replaceable">
<code>
xxx
</code>
</em>
</code>
or
<code class="literal">
admin_ssl_
<em class="replaceable">
<code>
xxx
</code>
</em>
</code>
system variable is set to a value different from its
default.) Otherwise, the administrative interface uses the
same TLS context as the main interface.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-tls-channel-status-table.html" title="29.12.22.9 The tls_channel_status Table">
<code class="literal">
tls_channel_status
</code>
</a>
table has
no indexes.
</p>
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
is not permitted
for the
<a class="link" href="performance-schema-tls-channel-status-table.html" title="29.12.22.9 The tls_channel_status Table">
<code class="literal">
tls_channel_status
</code>
</a>
table.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-innodb-tablespaces-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-innodb-tablespaces-table">
</a>
28.4.24 The INFORMATION_SCHEMA INNODB_TABLESPACES Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045076461376">
</a>
<p>
The
<a class="link" href="information-schema-innodb-tablespaces-table.html" title="28.4.24 The INFORMATION_SCHEMA INNODB_TABLESPACES Table">
<code class="literal">
INNODB_TABLESPACES
</code>
</a>
table provides
metadata about
<code class="literal">
InnoDB
</code>
file-per-table, general,
and undo tablespaces.
</p>
<p>
For related usage information and examples, see
<a class="xref" href="innodb-information-schema-system-tables.html" title="17.15.3 InnoDB INFORMATION_SCHEMA Schema Object Tables">
Section 17.15.3, “InnoDB INFORMATION_SCHEMA Schema Object Tables”
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<code class="literal">
INFORMATION_SCHEMA
</code>
<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 reports metadata for
<code class="literal">
InnoDB
</code>
tablespace types including
file-per-table tablespaces, general tablespaces, the system
tablespace, the global temporary tablespace, and undo
tablespaces.
</p>
</div>
<p>
The
<a class="link" href="information-schema-innodb-tablespaces-table.html" title="28.4.24 The INFORMATION_SCHEMA INNODB_TABLESPACES Table">
<code class="literal">
INNODB_TABLESPACES
</code>
</a>
table has
these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
SPACE
</code>
</p>
<p>
The tablespace ID.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NAME
</code>
</p>
<p>
The schema (database) and table name.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
FLAG
</code>
</p>
<p>
A numeric value that represents bit-level information about
tablespace format and storage characteristics.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ROW_FORMAT
</code>
</p>
<p>
The tablespace row format (
<code class="literal">
Compact or
Redundant
</code>
,
<code class="literal">
Dynamic
</code>
or
<code class="literal">
Compressed
</code>
, or
<code class="literal">
Undo
</code>
).
The data in this column is interpreted from the tablespace
flag information that resides in the data file.
</p>
<p>
There is no way to determine from this flag information if the
tablespace row format is
<code class="literal">
Redundant
</code>
or
<code class="literal">
Compact
</code>
, which is why one of the possible
<code class="literal">
ROW_FORMAT
</code>
values is
<code class="literal">
Compact or
Redundant
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PAGE_SIZE
</code>
</p>
<p>
The tablespace page size. The data in this column is
interpreted from the tablespace flags information that resides
in the
<a class="link" href="glossary.html#glos_ibd_file" title=".ibd file">
<code class="filename">
.ibd
</code>
file
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ZIP_PAGE_SIZE
</code>
</p>
<p>
The tablespace zip page size. The data in this column is
interpreted from the tablespace flags information that resides
in the
<a class="link" href="glossary.html#glos_ibd_file" title=".ibd file">
<code class="filename">
.ibd
</code>
file
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SPACE_TYPE
</code>
</p>
<p>
The type of tablespace. Possible values include
<code class="literal">
General
</code>
for general tablespaces,
<code class="literal">
Single
</code>
for file-per-table tablespaces,
<code class="literal">
System
</code>
for the system tablespace, and
<code class="literal">
Undo
</code>
for undo tablespaces.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
FS_BLOCK_SIZE
</code>
</p>
<p>
The file system block size, which is the unit size used for
hole punching. This column pertains to the
<code class="literal">
InnoDB
</code>
<a class="link" href="innodb-page-compression.html" title="17.9.2 InnoDB Page Compression">
transparent page
compression
</a>
feature.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
FILE_SIZE
</code>
</p>
<p>
The apparent size of the file, which represents the maximum
size of the file, uncompressed. This column pertains to the
<code class="literal">
InnoDB
</code>
<a class="link" href="innodb-page-compression.html" title="17.9.2 InnoDB Page Compression">
transparent page
compression
</a>
feature.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ALLOCATED_SIZE
</code>
</p>
<p>
The actual size of the file, which is the amount of space
allocated on disk. This column pertains to the
<code class="literal">
InnoDB
</code>
<a class="link" href="innodb-page-compression.html" title="17.9.2 InnoDB Page Compression">
transparent page
compression
</a>
feature.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
AUTOEXTEND_SIZE
</code>
</p>
<p>
The auto-extend size of the tablespace.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SERVER_VERSION
</code>
</p>
<p>
The MySQL version that created the tablespace, or the MySQL
version into which the tablespace was imported, or the version
of the last major MySQL version upgrade. The value is
unchanged by a release series upgrade, such as an upgrade from
MySQL 8.4.
<em class="replaceable">
<code>
x
</code>
</em>
to
8.4.
<em class="replaceable">
<code>
y
</code>
</em>
. The value can be considered
a
<span class="quote">
“
<span class="quote">
creation
</span>
”
</span>
marker or
<span class="quote">
“
<span class="quote">
certified
</span>
”
</span>
marker for the tablespace.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SPACE_VERSION
</code>
</p>
<p>
The tablespace version, used to track changes to the
tablespace format.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ENCRYPTION
</code>
</p>
<p>
Whether the tablespace is encrypted.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
STATE
</code>
</p>
<p>
The tablespace state.
</p>
<p>
For file-per-table and general tablespaces, states include:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
normal
</code>
: The tablespace is normal and
active.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
discarded
</code>
: The tablespace was discarded
by an
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE ... DISCARD TABLESPACE
</code>
</a>
statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
corrupted
</code>
: The tablespace is identified
by
<code class="literal">
InnoDB
</code>
as corrupted.
</p>
</li>
</ul>
</div>
<p>
For undo tablespaces, states include:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
active
</code>
: Rollback segments in the undo
tablespace can be allocated to new transactions.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
inactive
</code>
: Rollback segments in the undo
tablespace are no longer used by new transactions. The
truncate process is in progress. The undo tablespace was
either selected by the purge thread implicitly or was made
inactive by an
<a class="link" href="alter-tablespace.html" title="15.1.10 ALTER TABLESPACE Statement">
<code class="literal">
ALTER
UNDO TABLESPACE ... SET INACTIVE
</code>
</a>
statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
empty
</code>
: The undo tablespace was
truncated and is no longer active. It is ready to be
dropped or made active again by an
<a class="link" href="alter-tablespace.html" title="15.1.10 ALTER TABLESPACE Statement">
<code class="literal">
ALTER
UNDO TABLESPACE ... SET INACTIVE
</code>
</a>
statement.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<h4>
<a name="idm46045076386512">
</a>
Example
</h4>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa25839018"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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_TABLESPACES <span class="token keyword">WHERE</span> SPACE <span class="token operator">=</span> <span class="token number">26</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>
SPACE<span class="token punctuation">:</span> 26
NAME<span class="token punctuation">:</span> test/t1
FLAG<span class="token punctuation">:</span> 0
ROW_FORMAT<span class="token punctuation">:</span> Compact or Redundant
PAGE_SIZE<span class="token punctuation">:</span> 16384
ZIP_PAGE_SIZE<span class="token punctuation">:</span> 0
SPACE_TYPE<span class="token punctuation">:</span> Single
FS_BLOCK_SIZE<span class="token punctuation">:</span> 4096
FILE_SIZE<span class="token punctuation">:</span> 98304
ALLOCATED_SIZE<span class="token punctuation">:</span> 65536
AUTOEXTEND_SIZE<span class="token punctuation">:</span> 0
SERVER_VERSION<span class="token punctuation">:</span> 8.4.0
SPACE_VERSION<span class="token punctuation">:</span> 1
ENCRYPTION<span class="token punctuation">:</span> N
STATE<span class="token punctuation">:</span> normal</span></code></pre>
</div>
<h4>
<a name="idm46045076383760">
</a>
Notes
</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<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/mysql-cluster-logs-ndb-messages.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-logs-ndb-messages">
</a>
25.6.2 NDB Cluster Log Messages
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="mysql-cluster-logs-cluster-log.html">
25.6.2.1 NDB Cluster: Messages in the Cluster Log
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-log-startup-messages.html">
25.6.2.2 NDB Cluster Log Startup Messages
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-logs-event-buffer.html">
25.6.2.3 Event Buffer Reporting in the Cluster Log
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-ndb-transporter-errors.html">
25.6.2.4 NDB Cluster: NDB Transporter Errors
</a>
</span>
</dt>
</dl>
</div>
<p>
This section contains information about the messages written to
the cluster log in response to different cluster log events. It
provides additional, more specific information on
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
transporter errors.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-ndbinfo-cluster-operations.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-ndbinfo-cluster-operations">
</a>
25.6.17.8 The ndbinfo cluster_operations Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045090365744">
</a>
<p>
The
<code class="literal">
cluster_operations
</code>
table provides a
per-operation (stateful primary key op) view of all activity in
the NDB Cluster from the point of view of the local data
management (LQH) blocks (see
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-kernel-blocks-dblqh.html" target="_top">
The DBLQH Block
</a>
).
</p>
<p>
The
<code class="literal">
cluster_operations
</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 of reporting LQH block
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
block_instance
</code>
</p>
<p>
LQH block instance
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
transid
</code>
</p>
<p>
Transaction ID
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
operation_type
</code>
</p>
<p>
Operation type (see text for possible values)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
state
</code>
</p>
<p>
Operation state (see text for possible values)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
tableid
</code>
</p>
<p>
Table ID
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
fragmentid
</code>
</p>
<p>
Fragment ID
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
client_node_id
</code>
</p>
<p>
Client node ID
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
client_block_ref
</code>
</p>
<p>
Client block reference
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
tc_node_id
</code>
</p>
<p>
Transaction coordinator node ID
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
tc_block_no
</code>
</p>
<p>
Transaction coordinator block number
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
tc_block_instance
</code>
</p>
<p>
Transaction coordinator block instance
</p>
</li>
</ul>
</div>
<h5>
<a name="idm46045090337808">
</a>
Notes
</h5>
<p>
The transaction ID is a unique 64-bit number which can be
obtained using the NDB API's
<a class="ulink" href="/doc/ndbapi/en/ndb-ndbtransaction.html#ndb-ndbtransaction-gettransactionid" target="_top">
<code class="literal">
getTransactionId()
</code>
</a>
method. (Currently, the MySQL Server does not expose the NDB API
transaction ID of an ongoing transaction.)
</p>
<p>
The
<code class="literal">
operation_type
</code>
column can take any one of
the values
<code class="literal">
READ
</code>
,
<code class="literal">
READ-SH
</code>
,
<code class="literal">
READ-EX
</code>
,
<code class="literal">
INSERT
</code>
,
<code class="literal">
UPDATE
</code>
,
<code class="literal">
DELETE
</code>
,
<code class="literal">
WRITE
</code>
,
<code class="literal">
UNLOCK
</code>
,
<code class="literal">
REFRESH
</code>
,
<code class="literal">
SCAN
</code>
,
<code class="literal">
SCAN-SH
</code>
,
<code class="literal">
SCAN-EX
</code>
, or
<code class="literal">
<unknown>
</code>
.
</p>
<p>
The
<code class="literal">
state
</code>
column can have any one of the
values
<code class="literal">
ABORT_QUEUED
</code>
,
<code class="literal">
ABORT_STOPPED
</code>
,
<code class="literal">
COMMITTED
</code>
,
<code class="literal">
COMMIT_QUEUED
</code>
,
<code class="literal">
COMMIT_STOPPED
</code>
,
<code class="literal">
COPY_CLOSE_STOPPED
</code>
,
<code class="literal">
COPY_FIRST_STOPPED
</code>
,
<code class="literal">
COPY_STOPPED
</code>
,
<code class="literal">
COPY_TUPKEY
</code>
,
<code class="literal">
IDLE
</code>
,
<code class="literal">
LOG_ABORT_QUEUED
</code>
,
<code class="literal">
LOG_COMMIT_QUEUED
</code>
,
<code class="literal">
LOG_COMMIT_QUEUED_WAIT_SIGNAL
</code>
,
<code class="literal">
LOG_COMMIT_WRITTEN
</code>
,
<code class="literal">
LOG_COMMIT_WRITTEN_WAIT_SIGNAL
</code>
,
<code class="literal">
LOG_QUEUED
</code>
,
<code class="literal">
PREPARED
</code>
,
<code class="literal">
PREPARED_RECEIVED_COMMIT
</code>
,
<code class="literal">
SCAN_CHECK_STOPPED
</code>
,
<code class="literal">
SCAN_CLOSE_STOPPED
</code>
,
<code class="literal">
SCAN_FIRST_STOPPED
</code>
,
<code class="literal">
SCAN_RELEASE_STOPPED
</code>
,
<code class="literal">
SCAN_STATE_USED
</code>
,
<code class="literal">
SCAN_STOPPED
</code>
,
<code class="literal">
SCAN_TUPKEY
</code>
,
<code class="literal">
STOPPED
</code>
,
<code class="literal">
TC_NOT_CONNECTED
</code>
,
<code class="literal">
WAIT_ACC
</code>
,
<code class="literal">
WAIT_ACC_ABORT
</code>
,
<code class="literal">
WAIT_AI_AFTER_ABORT
</code>
,
<code class="literal">
WAIT_ATTR
</code>
,
<code class="literal">
WAIT_SCAN_AI
</code>
,
<code class="literal">
WAIT_TUP
</code>
,
<code class="literal">
WAIT_TUPKEYINFO
</code>
,
<code class="literal">
WAIT_TUP_COMMIT
</code>
, or
<code class="literal">
WAIT_TUP_TO_ABORT
</code>
. (If the MySQL Server is
running with
<a class="link" href="mysql-cluster-options-variables.html#sysvar_ndbinfo_show_hidden">
<code class="literal">
ndbinfo_show_hidden
</code>
</a>
enabled,
you can view this list of states by selecting from the
<code class="literal">
ndb$dblqh_tcconnect_state
</code>
table, which is
normally hidden.)
</p>
<p>
You can obtain the name of an
<code class="literal">
NDB
</code>
table from
its table ID by checking the output of
<a class="link" href="mysql-cluster-programs-ndb-show-tables.html" title="25.5.27 ndb_show_tables — Display List of NDB Tables">
<span class="command">
<strong>
ndb_show_tables
</strong>
</span>
</a>
.
</p>
<p>
The
<code class="literal">
fragid
</code>
is the same as the partition
number seen in the output of
<a class="link" href="mysql-cluster-programs-ndb-desc.html" title="25.5.9 ndb_desc — Describe NDB Tables">
<span class="command">
<strong>
ndb_desc
</strong>
</span>
</a>
<a class="link" href="mysql-cluster-programs-ndb-desc.html#option_ndb_desc_extra-partition-info">
<code class="option">
--extra-partition-info
</code>
</a>
(short
form
<code class="option">
-p
</code>
).
</p>
<p>
In
<code class="literal">
client_node_id
</code>
and
<code class="literal">
client_block_ref
</code>
,
<code class="literal">
client
</code>
refers to an NDB Cluster API or SQL node (that is, an NDB API
client or a MySQL Server attached to the cluster).
</p>
<p>
The
<code class="literal">
block_instance
</code>
and
<code class="literal">
tc_block_instance
</code>
column provide,
respectively, the
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-kernel-blocks-dblqh.html" target="_top">
<code class="literal">
DBLQH
</code>
</a>
and
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-kernel-blocks-dbtc.html" target="_top">
<code class="literal">
DBTC
</code>
</a>
block instance numbers.
You can use these along with the block names to obtain
information about specific threads from the
<a class="link" href="mysql-cluster-ndbinfo-threadblocks.html" title="25.6.17.62 The ndbinfo threadblocks Table">
<code class="literal">
threadblocks
</code>
</a>
table.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-user-summary-by-stages.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-user-summary-by-stages">
</a>
30.4.3.44 The user_summary_by_stages and x$user_summary_by_stages Views
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045061900112">
</a>
<a class="indexterm" name="idm46045061898656">
</a>
<a class="indexterm" name="idm46045061897152">
</a>
<a class="indexterm" name="idm46045061895648">
</a>
<p>
These views summarize stages, grouped by user. By default,
rows are sorted by user and descending total stage latency.
</p>
<p>
The
<a class="link" href="sys-user-summary-by-stages.html" title="30.4.3.44 The user_summary_by_stages and x$user_summary_by_stages Views">
<code class="literal">
user_summary_by_stages
</code>
</a>
and
<a class="link" href="sys-user-summary-by-stages.html" title="30.4.3.44 The user_summary_by_stages and x$user_summary_by_stages Views">
<code class="literal">
x$user_summary_by_stages
</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">
user
</code>
</p>
<p>
The client user name. Rows for which the
<code class="literal">
USER
</code>
column in the underlying
Performance Schema table is
<code class="literal">
NULL
</code>
are
assumed to be for background threads and are reported with
a host name of
<code class="literal">
background
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
event_name
</code>
</p>
<p>
The stage event name.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total
</code>
</p>
<p>
The total number of occurrences of the stage event for the
user.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total_latency
</code>
</p>
<p>
The total wait time of timed occurrences of the stage
event for the user.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
avg_latency
</code>
</p>
<p>
The average wait time per timed occurrence of the stage
event for the user.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-io-by-thread-by-latency.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-io-by-thread-by-latency">
</a>
30.4.3.10 The io_by_thread_by_latency and x$io_by_thread_by_latency Views
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045063055632">
</a>
<a class="indexterm" name="idm46045063054176">
</a>
<a class="indexterm" name="idm46045063052672">
</a>
<a class="indexterm" name="idm46045063051168">
</a>
<p>
These views summarize I/O consumers to display time waiting
for I/O, grouped by thread. By default, rows are sorted by
descending total I/O latency.
</p>
<p>
The
<a class="link" href="sys-io-by-thread-by-latency.html" title="30.4.3.10 The io_by_thread_by_latency and x$io_by_thread_by_latency Views">
<code class="literal">
io_by_thread_by_latency
</code>
</a>
and
<a class="link" href="sys-io-by-thread-by-latency.html" title="30.4.3.10 The io_by_thread_by_latency and x$io_by_thread_by_latency Views">
<code class="literal">
x$io_by_thread_by_latency
</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">
user
</code>
</p>
<p>
For foreground threads, the account associated with the
thread. For background threads, the thread name.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total
</code>
</p>
<p>
The total number of I/O events for the thread.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total_latency
</code>
</p>
<p>
The total wait time of timed I/O events for the thread.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
min_latency
</code>
</p>
<p>
The minimum single wait time of timed I/O events for the
thread.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
avg_latency
</code>
</p>
<p>
The average wait time per timed I/O event for the thread.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
max_latency
</code>
</p>
<p>
The maximum single wait time of timed I/O events for the
thread.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
thread_id
</code>
</p>
<p>
The thread ID.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
processlist_id
</code>
</p>
<p>
For foreground threads, the processlist ID of the thread.
For background threads,
<code class="literal">
NULL
</code>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-execute-prepared-stmt.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-execute-prepared-stmt">
</a>
30.4.4.3 The execute_prepared_stmt() Procedure
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045061568256">
</a>
<a class="indexterm" name="idm46045061566752">
</a>
<p>
Given an SQL statement as a string, executes it as a prepared
statement. The prepared statement is deallocated after
execution, so it is not subject to reuse. Thus, this procedure
is useful primarily for executing dynamic statements on a
one-time basis.
</p>
<p>
This procedure uses
<code class="literal">
sys_execute_prepared_stmt
</code>
as the prepared
statement name. If that statement name exists when the
procedure is called, its previous content is destroyed.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-execute-prepared-stmt-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_query LONGTEXT CHARACTER SET
utf8mb3
</code>
: The statement string to execute.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-execute-prepared-stmt-configuration-options">
</a>
Configuration Options
</h5>
</div>
</div>
</div>
<p>
<a class="link" href="sys-execute-prepared-stmt.html" title="30.4.4.3 The execute_prepared_stmt() Procedure">
<code class="literal">
execute_prepared_stmt()
</code>
</a>
operation can be modified using the following configuration
options or their corresponding user-defined variables (see
<a class="xref" href="sys-sys-config.html" title="30.4.2.1 The sys_config Table">
Section 30.4.2.1, “The sys_config Table”
</a>
):
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
debug
</code>
,
<code class="literal">
@sys.debug
</code>
</p>
<p>
If this option is
<code class="literal">
ON
</code>
, produce
debugging output. The default is
<code class="literal">
OFF
</code>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-execute-prepared-stmt-example">
</a>
Example
</h5>
</div>
</div>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa40821756"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CALL</span> sys<span class="token punctuation">.</span>execute_prepared_stmt<span class="token punctuation">(</span><span class="token string">'SELECT COUNT(*) FROM mysql.user'</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> COUNT(*) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 15 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/keyring-key-migration.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="keyring-key-migration">
</a>
8.4.4.11 Migrating Keys Between Keyring Keystores
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045239914896">
</a>
<a class="indexterm" name="idm46045239913856">
</a>
<p>
A keyring migration copies keys from one keystore to another,
enabling a DBA to switch a MySQL installation to a different
keystore. A successful migration operation has this result:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The destination keystore contains the keys it had prior to
the migration, plus the keys from the source keystore.
</p>
</li>
<li class="listitem">
<p>
The source keystore remains the same before and after the
migration (because keys are copied, not moved).
</p>
</li>
</ul>
</div>
<p>
If a key to be copied already exists in the destination
keystore, an error occurs and the destination keystore is
restored to its premigration state.
</p>
<p>
The keyring manages keystores using keyring components and
keyring plugins. This pertains to migration strategy because the
way in which the source and destination keystores are managed
determines the procedure for performing a given type of key
migration:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Migration from one keyring plugin to another: The MySQL
server has an operational mode that provides this
capability.
</p>
</li>
<li class="listitem">
<p>
Migration from a keyring plugin to a keyring component: The
MySQL server has an operational mode that provides this
capability.
</p>
</li>
<li class="listitem">
<p>
Migration from one keyring component to another: The
<a class="link" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
<span class="command">
<strong>
mysql_migrate_keyring
</strong>
</span>
</a>
utility provides
this capability.
</p>
</li>
<li class="listitem">
<p>
Migration from a keyring component to a keyring plugin: The
MySQL server has an operational mode that provides this
capability.
</p>
</li>
</ul>
</div>
<p>
The following sections discuss the characteristics of offline
and online migrations and describe how to perform migrations.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="keyring-key-migration.html#keyring-key-migration-offline-online" title="Offline and Online Key Migrations">
Offline and Online Key Migrations
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="keyring-key-migration.html#keyring-key-migration-using-migration-server" title="Key Migration Using a Migration Server">
Key Migration Using a Migration Server
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="keyring-key-migration.html#keyring-key-migration-using-mysql-migrate-keyring" title="Key Migration Using the mysql_migrate_keyring Utility">
Key Migration Using the mysql_migrate_keyring Utility
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="keyring-key-migration.html#keyring-key-migration-multiple-running-servers" title="Key Migration Involving Multiple Running Servers">
Key Migration Involving Multiple Running Servers
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="keyring-key-migration-offline-online">
</a>
Offline and Online Key Migrations
</h5>
</div>
</div>
</div>
<p>
A key migration is either offline or online:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Offline migration: For use when you are sure that no
running server on the local host is using the source or
destination keystore. In this case, the migration
operation can copy keys from the source keystore to the
destination without the possibility of a running server
modifying keystore content during the operation.
</p>
</li>
<li class="listitem">
<p>
Online migration: For use when a running server on the
local host is using the source keystore. In this case,
care must be taken to prevent that server from updating
keystores during the migration. This involves connecting
to the running server and instructing it to pause keyring
operations so that keys can be copied safely from the
source keystore to the destination. When key copying is
complete, the running server is permitted to resume
keyring operations.
</p>
</li>
</ul>
</div>
<p>
When you plan a key migration, use these points to decide
whether it should be offline or online:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Do not perform offline migration involving a keystore that
is in use by a running server.
</p>
</li>
<li class="listitem">
<p>
Pausing keyring operations during an online migration is
accomplished by connecting to the running server and
setting its global
<a class="link" href="keyring-system-variables.html#sysvar_keyring_operations">
<code class="literal">
keyring_operations
</code>
</a>
system
variable to
<code class="literal">
OFF
</code>
before key copying and
<code class="literal">
ON
</code>
after key copying. This has several
implications:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="keyring-system-variables.html#sysvar_keyring_operations">
<code class="literal">
keyring_operations
</code>
</a>
was introduced in MySQL 5.7.21, so online migration is
possible only if the running server is from MySQL
5.7.21 or higher. If the running server is older, you
must stop it, perform an offline migration, and
restart it. All migration instructions elsewhere that
refer to
<a class="link" href="keyring-system-variables.html#sysvar_keyring_operations">
<code class="literal">
keyring_operations
</code>
</a>
are subject to this condition.
</p>
</li>
<li class="listitem">
<p>
The account used to connect to the running server must
have the privileges required to modify
<a class="link" href="keyring-system-variables.html#sysvar_keyring_operations">
<code class="literal">
keyring_operations
</code>
</a>
.
These privileges are
<a class="link" href="privileges-provided.html#priv_encryption-key-admin">
<code class="literal">
ENCRYPTION_KEY_ADMIN
</code>
</a>
in
addition to either
<a class="link" href="privileges-provided.html#priv_system-variables-admin">
<code class="literal">
SYSTEM_VARIABLES_ADMIN
</code>
</a>
or the deprecated
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege.
</p>
</li>
<li class="listitem">
<p>
If an online migration operation exits abnormally (for
example, if it is forcibly terminated), it is possible
for
<a class="link" href="keyring-system-variables.html#sysvar_keyring_operations">
<code class="literal">
keyring_operations
</code>
</a>
to
remain disabled on the running server, leaving it
unable to perform keyring operations. In this case, it
may be necessary to connect to the running server and
enable
<a class="link" href="keyring-system-variables.html#sysvar_keyring_operations">
<code class="literal">
keyring_operations
</code>
</a>
manually using this statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa41891423"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> keyring_operations <span class="token operator">=</span> <span class="token keyword">ON</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Online key migration provides for pausing keyring
operations on a single running server. To perform a
migration if multiple running servers are using the
keystores involved, use the procedure described at
<a class="xref" href="keyring-key-migration.html#keyring-key-migration-multiple-running-servers" title="Key Migration Involving Multiple Running Servers">
Key Migration Involving Multiple Running Servers
</a>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="keyring-key-migration-using-migration-server">
</a>
Key Migration Using a Migration Server
</h5>
</div>
</div>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Online key migration using a migration server is only
supported if the running server allows socket connections or
TCP/IP connections using TLS; it is not supported when, for
example, the server is running on a Windows platform and
only allows shared memory connections.
</p>
</div>
<p>
A MySQL server becomes a migration server if invoked in a
special operational mode that supports key migration. A
migration server does not accept client connections. Instead,
it runs only long enough to migrate keys, then exits. A
migration server reports errors to the console (the standard
error output).
</p>
<p>
A migration server supports these migration types:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Migration from one keyring plugin to another.
</p>
</li>
<li class="listitem">
<p>
Migration from a keyring plugin to a keyring component.
</p>
</li>
<li class="listitem">
<p>
Migration from a keyring component to a keyring plugin.
</p>
</li>
</ul>
</div>
<p>
A migration server does not support migration from one keyring
component to another. For that type of migration, see
<a class="xref" href="keyring-key-migration.html#keyring-key-migration-using-mysql-migrate-keyring" title="Key Migration Using the mysql_migrate_keyring Utility">
Key Migration Using the mysql_migrate_keyring Utility
</a>
.
</p>
<p>
To perform a key migration operation using a migration server,
determine the key migration options required to specify which
keyring plugins or components are involved, and whether the
migration is offline or online:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
To indicate the source keyring plugin and the destination
keyring plugin or component, specify these options:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="keyring-options.html#option_mysqld_keyring-migration-source">
<code class="option">
--keyring-migration-source
</code>
</a>
:
The source keyring component or plugin that manages
the keys to be migrated.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="keyring-options.html#option_mysqld_keyring-migration-destination">
<code class="option">
--keyring-migration-destination
</code>
</a>
:
The destination keyring plugin or component to which
the migrated keys are to be copied.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="keyring-options.html#option_mysqld_keyring-migration-to-component">
<code class="option">
--keyring-migration-to-component
</code>
</a>
:
This option is required if the destination is a
keyring component.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="keyring-options.html#option_mysqld_keyring-migration-from-component">
<code class="option">
--keyring-migration-from-component
</code>
</a>
:
This option is required if the source is a keyring
component.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="keyring-options.html#option_mysqld_keyring-migration-source">
<code class="option">
--keyring-migration-source
</code>
</a>
and
<a class="link" href="keyring-options.html#option_mysqld_keyring-migration-destination">
<code class="option">
--keyring-migration-destination
</code>
</a>
options signify to the server that it should run in key
migration mode. For key migration operations, both options
are mandatory. Each plugin or component is specified using
the name of its library file, including any
platform-specific extension such as
<code class="filename">
.so
</code>
or
<code class="filename">
.dll
</code>
. The
source and destination must differ, and the migration
server must support them both.
</p>
</li>
<li class="listitem">
<p>
For an offline migration, no additional key migration
options are needed.
</p>
</li>
<li class="listitem">
<p>
For an online migration, some running server currently is
using the source or destination keystore. To invoke the
migration server, specify additional key migration options
that indicate how to connect to the running server. This
is necessary so that the migration server can connect to
the running server and tell it to pause keyring use during
the migration operation.
</p>
<p>
Use of any of the following options signifies an online
migration:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="keyring-options.html#option_mysqld_keyring-migration-host">
<code class="option">
--keyring-migration-host
</code>
</a>
:
The host where the running server is located. This is
always the local host because the migration server can
migrate keys only between keystores managed by local
plugins and components.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="keyring-options.html#option_mysqld_keyring-migration-user">
<code class="option">
--keyring-migration-user
</code>
</a>
,
<a class="link" href="keyring-options.html#option_mysqld_keyring-migration-password">
<code class="option">
--keyring-migration-password
</code>
</a>
:
The account credentials to use to connect to the
running server.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="keyring-options.html#option_mysqld_keyring-migration-port">
<code class="option">
--keyring-migration-port
</code>
</a>
:
For TCP/IP connections, the port number to connect to
on the running server.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="keyring-options.html#option_mysqld_keyring-migration-socket">
<code class="option">
--keyring-migration-socket
</code>
</a>
:
For Unix socket file or Windows named pipe
connections, the socket file or named pipe to connect
to on the running server.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
For additional details about the key migration options, see
<a class="xref" href="keyring-options.html" title="8.4.4.15 Keyring Command Options">
Section 8.4.4.15, “Keyring Command Options”
</a>
.
</p>
<p>
Start the migration server with key migration options
indicating the source and destination keystores and whether
the migration is offline or online, possibly with other
options. Keep the following considerations in mind:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Other server options might be required; other non-keyring
options may be required as well. One way to specify these
options is by using
<a class="link" href="option-file-options.html#option_general_defaults-file">
<code class="option">
--defaults-file
</code>
</a>
to name an
option file that contains the required options.
</p>
</li>
<li class="listitem">
<p>
The migration server expects path name option values to be
full paths. Relative path names may not be resolved as you
expect.
</p>
</li>
<li class="listitem">
<p>
The user who invokes a server in key-migration mode must
not be the
<code class="literal">
root
</code>
operating system user,
unless the
<a class="link" href="server-options.html#option_mysqld_user">
<code class="option">
--user
</code>
</a>
option is
specified with a non-
<code class="literal">
root
</code>
user name to
run the server as that user.
</p>
</li>
<li class="listitem">
<p>
The user a server in key-migration mode runs as must have
permission to read and write any local keyring files, such
as the data file for a file-based plugin.
</p>
<p>
If you invoke the migration server from a system account
different from that normally used to run MySQL, it might
create keyring directories or files that are inaccessible
to the server during normal operation. Suppose that
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
normally runs as the
<code class="literal">
mysql
</code>
operating system user, but you
invoke the migration server while logged in as
<code class="literal">
isabel
</code>
. Any new directories or files
created by the migration server are owned by
<code class="literal">
isabel
</code>
. Subsequent startup fails when a
server run as the
<code class="literal">
mysql
</code>
operating
system user attempts to access file system objects owned
by
<code class="literal">
isabel
</code>
.
</p>
<p>
To avoid this issue, start the migration server as the
<code class="literal">
root
</code>
operating system user and provide
a
<a class="link" href="server-options.html#option_mysqld_user">
<code class="option">
--user=
<em class="replaceable">
<code>
user_name
</code>
</em>
</code>
</a>
option, where
<em class="replaceable">
<code>
user_name
</code>
</em>
is the
system account normally used to run MySQL. Alternatively,
after the migration, examine the keyring-related file
system objects and change their ownership and permissions
if necessary using
<span class="command">
<strong>
chown
</strong>
</span>
,
<span class="command">
<strong>
chmod
</strong>
</span>
, or similar commands, so that the
objects are accessible to the running server.
</p>
</li>
</ul>
</div>
<p>
Example command line for offline migration between two keyring
plugins (enter the command on a single line):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa18111307"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysqld <span class="token constant">--defaults-file</span><span class="token attr-value"><span class="token punctuation">=</span>/usr/local/mysql/etc/my.cnf</span>
<span class="token constant">--keyring-migration-source</span><span class="token attr-value"><span class="token punctuation">=</span>keyring_okv.so</span>
<span class="token constant">--keyring-migration-destination</span><span class="token attr-value"><span class="token punctuation">=</span>keyring_aws.so</span></code></pre>
</div>
<p>
Example command line for online migration between two keyring
plugins:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa26937330"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysqld <span class="token constant">--defaults-file</span><span class="token attr-value"><span class="token punctuation">=</span>/usr/local/mysql/etc/my.cnf</span>
<span class="token constant">--keyring-migration-source</span><span class="token attr-value"><span class="token punctuation">=</span>keyring_okv.so</span>
<span class="token constant">--keyring-migration-destination</span><span class="token attr-value"><span class="token punctuation">=</span>keyring_aws.so</span>
<span class="token constant">--keyring-migration-host</span><span class="token attr-value"><span class="token punctuation">=</span>127.0.0.1</span>
<span class="token constant">--keyring-migration-user</span><span class="token attr-value"><span class="token punctuation">=</span>root</span>
<span class="token constant">--keyring-migration-password</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">root_password</em></span></code></pre>
</div>
<p>
To perform a migration when the destination is a keyring
component rather than a keyring plugin, specify the
<a class="link" href="keyring-options.html#option_mysqld_keyring-migration-to-component">
<code class="option">
--keyring-migration-to-component
</code>
</a>
option, and name the component as the value of the
<a class="link" href="keyring-options.html#option_mysqld_keyring-migration-destination">
<code class="option">
--keyring-migration-destination
</code>
</a>
option.
</p>
<p>
Example command line for offline migration from a keyring
plugin to a keyring component:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa10204476"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysqld <span class="token constant">--defaults-file</span><span class="token attr-value"><span class="token punctuation">=</span>/usr/local/mysql/etc/my.cnf</span>
<span class="token property">--keyring-migration-to-component</span>
<span class="token constant">--keyring-migration-source</span><span class="token attr-value"><span class="token punctuation">=</span>keyring_okv.so</span>
<span class="token constant">--keyring-migration-destination</span><span class="token attr-value"><span class="token punctuation">=</span>component_keyring_encrypted_file.so</span></code></pre>
</div>
<p>
Notice that in this case, no
<code class="literal">
keyring_encrypted_file_password
</code>
value is
specified. The password for the component data file is listed
in the component configuration file.
</p>
<p>
Example command line for online migration from a keyring
plugin to a keyring component:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa74083327"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysqld <span class="token constant">--defaults-file</span><span class="token attr-value"><span class="token punctuation">=</span>/usr/local/mysql/etc/my.cnf</span>
<span class="token property">--keyring-migration-to-component</span>
<span class="token constant">--keyring-migration-source</span><span class="token attr-value"><span class="token punctuation">=</span>keyring_okv.so</span>
<span class="token constant">--keyring-migration-destination</span><span class="token attr-value"><span class="token punctuation">=</span>component_keyring_encrypted_file.so</span>
<span class="token constant">--keyring-migration-host</span><span class="token attr-value"><span class="token punctuation">=</span>127.0.0.1</span>
<span class="token constant">--keyring-migration-user</span><span class="token attr-value"><span class="token punctuation">=</span>root</span>
<span class="token constant">--keyring-migration-password</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">root_password</em></span></code></pre>
</div>
<p>
To perform a migration when the source is a keyring component
rather than a keyring plugin, specify the
<a class="link" href="keyring-options.html#option_mysqld_keyring-migration-from-component">
<code class="option">
--keyring-migration-from-component
</code>
</a>
option, and name the component as the value of the
<a class="link" href="keyring-options.html#option_mysqld_keyring-migration-source">
<code class="option">
--keyring-migration-source
</code>
</a>
option.
</p>
<p>
Example command line for offline migration from a keyring
component to a keyring plugin:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa18643076"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysqld <span class="token constant">--defaults-file</span><span class="token attr-value"><span class="token punctuation">=</span>/usr/local/mysql/etc/my.cnf</span>
<span class="token property">--keyring-migration-from-component</span>
<span class="token constant">--keyring-migration-source</span><span class="token attr-value"><span class="token punctuation">=</span>component_keyring_file.so</span>
<span class="token constant">--keyring-migration-destination</span><span class="token attr-value"><span class="token punctuation">=</span>keyring_okv.so</span>
<span class="token constant">--keyring-okv-conf-dir</span><span class="token attr-value"><span class="token punctuation">=</span>/usr/local/mysql/mysql-keyring-okv</span></code></pre>
</div>
<p>
Example command line for online migration from a keyring
comonent to a keyring plugin:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa14316782"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysqld <span class="token constant">--defaults-file</span><span class="token attr-value"><span class="token punctuation">=</span>/usr/local/mysql/etc/my.cnf</span>
<span class="token property">--keyring-migration-from-component</span>
<span class="token constant">--keyring-migration-source</span><span class="token attr-value"><span class="token punctuation">=</span>component_keyring_file.so</span>
<span class="token constant">--keyring-migration-destination</span><span class="token attr-value"><span class="token punctuation">=</span>keyring_okv.so</span>
<span class="token constant">--keyring-okv-conf-dir</span><span class="token attr-value"><span class="token punctuation">=</span>/usr/local/mysql/mysql-keyring-okv</span>
<span class="token constant">--keyring-migration-host</span><span class="token attr-value"><span class="token punctuation">=</span>127.0.0.1</span>
<span class="token constant">--keyring-migration-user</span><span class="token attr-value"><span class="token punctuation">=</span>root</span>
<span class="token constant">--keyring-migration-password</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">root_password</em></span></code></pre>
</div>
<p>
The key migration server performs a migration operation as
follows:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
(Online migration only) Connect to the running server
using the connection options.
</p>
</li>
<li class="listitem">
<p>
(Online migration only) Disable
<a class="link" href="keyring-system-variables.html#sysvar_keyring_operations">
<code class="literal">
keyring_operations
</code>
</a>
on the
running server.
</p>
</li>
<li class="listitem">
<p>
Load the keyring plugin or component libraries for the
source and destination keystores.
</p>
</li>
<li class="listitem">
<p>
Copy keys from the source keystore to the destination.
</p>
</li>
<li class="listitem">
<p>
Unload the keyring plugin or component libraries for the
source and destination keystores.
</p>
</li>
<li class="listitem">
<p>
(Online migration only) Enable
<a class="link" href="keyring-system-variables.html#sysvar_keyring_operations">
<code class="literal">
keyring_operations
</code>
</a>
on the
running server.
</p>
</li>
<li class="listitem">
<p>
(Online migration only) Disconnect from the running
server.
</p>
</li>
</ol>
</div>
<p>
If an error occurs during key migration, the destination
keystore is restored to its premigration state.
</p>
<p>
After a successful online key migration operation, the running
server might need to be restarted:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the running server was using the source keystore before
the migration and should continue to use it after the
migration, it need not be restarted after the migration.
</p>
</li>
<li class="listitem">
<p>
If the running server was using the destination keystore
before the migration and should continue to use it after
the migration, it should be restarted after the migration
to load all keys migrated into the destination keystore.
</p>
</li>
<li class="listitem">
<p>
If the running server was using the source keystore before
the migration but should use the destination keystore
after the migration, it must be reconfigured to use the
destination keystore and restarted. In this case, be aware
that although the running server is paused from modifying
the source keystore during the migration itself, it is not
paused during the interval between the migration and the
subsequent restart. Care should be taken that the server
does not modify the source keystore during this interval
because any such changes will not be reflected in the
destination keystore.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="keyring-key-migration-using-mysql-migrate-keyring">
</a>
Key Migration Using the mysql_migrate_keyring Utility
</h5>
</div>
</div>
</div>
<p>
The
<a class="link" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
<span class="command">
<strong>
mysql_migrate_keyring
</strong>
</span>
</a>
utility migrates
keys from one keyring component to another. It does not
support migrations involving keyring plugins. For that type of
migration, use a MySQL server operating in key migration mode;
see
<a class="xref" href="keyring-key-migration.html#keyring-key-migration-using-migration-server" title="Key Migration Using a Migration Server">
Key Migration Using a Migration Server
</a>
.
</p>
<p>
To perform a key migration operation using
<a class="link" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
<span class="command">
<strong>
mysql_migrate_keyring
</strong>
</span>
</a>
, determine the key
migration options required to specify which keyring components
are involved, and whether the migration is offline or online:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
To indicate the source and destination keyring components
and their location, specify these options:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="mysql-migrate-keyring.html#option_mysql_migrate_keyring_source-keyring">
<code class="option">
--source-keyring
</code>
</a>
:
The source keyring component that manages the keys to
be migrated.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-migrate-keyring.html#option_mysql_migrate_keyring_destination-keyring">
<code class="option">
--destination-keyring
</code>
</a>
:
The destination keyring component to which the
migrated keys are to be copied.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-migrate-keyring.html#option_mysql_migrate_keyring_component-dir">
<code class="option">
--component-dir
</code>
</a>
:
The directory containing keyring component library
files. This is typically the value of the
<a class="link" href="server-system-variables.html#sysvar_plugin_dir">
<code class="literal">
plugin_dir
</code>
</a>
system
variable for the local MySQL server.
</p>
</li>
</ul>
</div>
<p>
All three options are mandatory. Each keyring component
name is a component library file name specified without
any platform-specific extension such as
<code class="filename">
.so
</code>
or
<code class="filename">
.dll
</code>
. For
example, to use the component for which the library file
is
<code class="filename">
component_keyring_file.so
</code>
, specify
the option as
<a class="link" href="mysql-migrate-keyring.html#option_mysql_migrate_keyring_source-keyring">
<code class="option">
--source-keyring=component_keyring_file
</code>
</a>
.
The source and destination must differ, and
<a class="link" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
<span class="command">
<strong>
mysql_migrate_keyring
</strong>
</span>
</a>
must support them
both.
</p>
</li>
<li class="listitem">
<p>
For an offline migration, no additional options are
needed.
</p>
</li>
<li class="listitem">
<p>
For an online migration, some running server currently is
using the source or destination keystore. In this case,
specify the
<a class="link" href="mysql-migrate-keyring.html#option_mysql_migrate_keyring_online-migration">
<code class="option">
--online-migration
</code>
</a>
option to signify an online migration. In addition,
specify connection options indicating how to connect to
the running server, so that
<a class="link" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
<span class="command">
<strong>
mysql_migrate_keyring
</strong>
</span>
</a>
can connect to it
and tell it to pause keyring use during the migration
operation.
</p>
<p>
The
<a class="link" href="mysql-migrate-keyring.html#option_mysql_migrate_keyring_online-migration">
<code class="option">
--online-migration
</code>
</a>
option is commonly used in conjunction with connection
options such as these:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="mysql-migrate-keyring.html#option_mysql_migrate_keyring_host">
<code class="option">
--host
</code>
</a>
:
The host where the running server is located. This is
always the local host because
<a class="link" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
<span class="command">
<strong>
mysql_migrate_keyring
</strong>
</span>
</a>
can migrate
keys only between keystores managed by local
components.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-migrate-keyring.html#option_mysql_migrate_keyring_user">
<code class="option">
--user
</code>
</a>
,
<a class="link" href="mysql-migrate-keyring.html#option_mysql_migrate_keyring_password">
<code class="option">
--password
</code>
</a>
:
The account credentials to use to connect to the
running server.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-migrate-keyring.html#option_mysql_migrate_keyring_port">
<code class="option">
--port
</code>
</a>
:
For TCP/IP connections, the port number to connect to
on the running server.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-migrate-keyring.html#option_mysql_migrate_keyring_socket">
<code class="option">
--socket
</code>
</a>
:
For Unix socket file or Windows named pipe
connections, the socket file or named pipe to connect
to on the running server.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
For descriptions of all available options, see
<a class="xref" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
Section 6.6.8, “mysql_migrate_keyring — Keyring Key Migration Utility”
</a>
.
</p>
<p>
Start
<a class="link" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
<span class="command">
<strong>
mysql_migrate_keyring
</strong>
</span>
</a>
with options
indicating the source and destination keystores and whether
the migration is offline or online, possibly with other
options. Keep the following considerations in mind:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The user who invokes
<a class="link" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
<span class="command">
<strong>
mysql_migrate_keyring
</strong>
</span>
</a>
must not be the
<code class="literal">
root
</code>
operating system user.
</p>
</li>
<li class="listitem">
<p>
The user who invokes
<a class="link" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
<span class="command">
<strong>
mysql_migrate_keyring
</strong>
</span>
</a>
must have
permission to read and write any local keyring files, such
as the data file for a file-based plugin.
</p>
<p>
If you invoke
<a class="link" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
<span class="command">
<strong>
mysql_migrate_keyring
</strong>
</span>
</a>
from a system account different from that normally used to
run MySQL, it might create keyring directories or files
that are inaccessible to the server during normal
operation. Suppose that
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
normally
runs as the
<code class="literal">
mysql
</code>
operating system
user, but you invoke
<a class="link" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
<span class="command">
<strong>
mysql_migrate_keyring
</strong>
</span>
</a>
while logged in
as
<code class="literal">
isabel
</code>
. Any new directories or files
created by
<a class="link" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
<span class="command">
<strong>
mysql_migrate_keyring
</strong>
</span>
</a>
are
owned by
<code class="literal">
isabel
</code>
. Subsequent startup
fails when a server run as the
<code class="literal">
mysql
</code>
operating system user attempts to access file system
objects owned by
<code class="literal">
isabel
</code>
.
</p>
<p>
To avoid this issue, invoke
<a class="link" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
<span class="command">
<strong>
mysql_migrate_keyring
</strong>
</span>
</a>
as the
<code class="literal">
mysql
</code>
operating system user.
Alternatively, after the migration, examine the
keyring-related file system objects and change their
ownership and permissions if necessary using
<span class="command">
<strong>
chown
</strong>
</span>
,
<span class="command">
<strong>
chmod
</strong>
</span>
, or
similar commands, so that the objects are accessible to
the running server.
</p>
</li>
</ul>
</div>
<p>
Suppose that you want to migrate keys from
<code class="literal">
component_keyring_file
</code>
to
<code class="literal">
component_keyring_encrypted_file
</code>
, and that
the local server stores its keyring component library files in
<code class="filename">
/usr/local/mysql/lib/plugin
</code>
.
</p>
<p>
If no running server is using the keyring, an offline
migration is permitted. Invoke
<a class="link" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
<span class="command">
<strong>
mysql_migrate_keyring
</strong>
</span>
</a>
like this (enter the
command on a single line):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa38383120"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysql_migrate_keyring
<span class="token constant">--component-dir</span><span class="token attr-value"><span class="token punctuation">=</span>/usr/local/mysql/lib/plugin</span>
<span class="token constant">--source-keyring</span><span class="token attr-value"><span class="token punctuation">=</span>component_keyring_file</span>
<span class="token constant">--destination-keyring</span><span class="token attr-value"><span class="token punctuation">=</span>component_keyring_encrypted_file</span></code></pre>
</div>
<p>
If a running server is using the keyring, you must perform an
online migration instead. In this case, the
<a class="link" href="mysql-migrate-keyring.html#option_mysql_migrate_keyring_online-migration">
<code class="option">
--online-migration
</code>
</a>
option must be given, along with any connection options
required to specify which server to connect to and the MySQL
account to use.
</p>
<p>
The following command performs an online migration. It
connects to the local server using a TCP/IP connection and the
<code class="literal">
admin
</code>
account. The command prompts for a
password, which you should enter when prompted:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa39555123"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysql_migrate_keyring
<span class="token constant">--component-dir</span><span class="token attr-value"><span class="token punctuation">=</span>/usr/local/mysql/lib/plugin</span>
<span class="token constant">--source-keyring</span><span class="token attr-value"><span class="token punctuation">=</span>component_keyring_file</span>
<span class="token constant">--destination-keyring</span><span class="token attr-value"><span class="token punctuation">=</span>component_keyring_encrypted_file</span>
<span class="token property">--online-migration</span> <span class="token constant">--host</span><span class="token attr-value"><span class="token punctuation">=</span>127.0.0.1</span> <span class="token constant">--user</span><span class="token attr-value"><span class="token punctuation">=</span>admin</span> <span class="token property">--password</span></code></pre>
</div>
<p>
<a class="link" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
<span class="command">
<strong>
mysql_migrate_keyring
</strong>
</span>
</a>
performs a migration
operation as follows:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
(Online migration only) Connect to the running server
using the connection options.
</p>
</li>
<li class="listitem">
<p>
(Online migration only) Disable
<a class="link" href="keyring-system-variables.html#sysvar_keyring_operations">
<code class="literal">
keyring_operations
</code>
</a>
on the
running server.
</p>
</li>
<li class="listitem">
<p>
Load the keyring component libraries for the source and
destination keystores.
</p>
</li>
<li class="listitem">
<p>
Copy keys from the source keystore to the destination.
</p>
</li>
<li class="listitem">
<p>
Unload the keyring component libraries for the source and
destination keystores.
</p>
</li>
<li class="listitem">
<p>
(Online migration only) Enable
<a class="link" href="keyring-system-variables.html#sysvar_keyring_operations">
<code class="literal">
keyring_operations
</code>
</a>
on the
running server.
</p>
</li>
<li class="listitem">
<p>
(Online migration only) Disconnect from the running
server.
</p>
</li>
</ol>
</div>
<p>
If an error occurs during key migration, the destination
keystore is restored to its premigration state.
</p>
<p>
After a successful online key migration operation, the running
server might need to be restarted:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the running server was using the source keystore before
the migration and should continue to use it after the
migration, it need not be restarted after the migration.
</p>
</li>
<li class="listitem">
<p>
If the running server was using the destination keystore
before the migration and should continue to use it after
the migration, it should be restarted after the migration
to load all keys migrated into the destination keystore.
</p>
</li>
<li class="listitem">
<p>
If the running server was using the source keystore before
the migration but should use the destination keystore
after the migration, it must be reconfigured to use the
destination keystore and restarted. In this case, be aware
that although the running server is paused from modifying
the source keystore during the migration itself, it is not
paused during the interval between the migration and the
subsequent restart. Care should be taken that the server
does not modify the source keystore during this interval
because any such changes will not be reflected in the
destination keystore.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="keyring-key-migration-multiple-running-servers">
</a>
Key Migration Involving Multiple Running Servers
</h5>
</div>
</div>
</div>
<p>
Online key migration provides for pausing keyring operations
on a single running server. To perform a migration if multiple
running servers are using the keystores involved, use this
procedure:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Connect to each running server manually and set
<a class="link" href="keyring-system-variables.html#sysvar_keyring_operations">
<code class="literal">
keyring_operations=OFF
</code>
</a>
.
This ensures that no running server is using the source or
destination keystore and satisfies the required condition
for offline migration.
</p>
</li>
<li class="listitem">
<p>
Use a migration server or
<a class="link" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
<span class="command">
<strong>
mysql_migrate_keyring
</strong>
</span>
</a>
to perform an
offline key migration for each paused server.
</p>
</li>
<li class="listitem">
<p>
Connect to each running server manually and set
<a class="link" href="keyring-system-variables.html#sysvar_keyring_operations">
<code class="literal">
keyring_operations=ON
</code>
</a>
.
</p>
</li>
</ol>
</div>
<p>
All running servers must support the
<a class="link" href="keyring-system-variables.html#sysvar_keyring_operations">
<code class="literal">
keyring_operations
</code>
</a>
system
variable. Any server that does not must be stopped before the
migration and restarted after.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-connection-security.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="group-replication-connection-security">
</a>
20.6.1 Communication Stack for Connection Security Management
</h3>
</div>
</div>
</div>
<p>
MySQL 8.4 Group Replication can secure group
communication connections between members by one of the following
methods:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Using its own implementation of the security protocols,
including TLS/SSL and the use of an allowlist for incoming
Group Communication System (GCS) connections.
</p>
</li>
<li class="listitem">
<p>
Using MySQL Server’s own connection security in place of
Group Replication’s implementation. Using the MySQL protocol
means that standard methods of user authentication can be used
for granting (or revoking) access to the group in place of the
allowlist, and the latest functionality of the server’s
protocol is always available on release.
</p>
</li>
</ul>
</div>
<p>
The choice is made by setting the system variable
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_communication_stack">
<code class="literal">
group_replication_communication_stack
</code>
</a>
to
<code class="literal">
XCOM
</code>
to use Group Replication's own
implementation (this is the default choice), or to
<code class="literal">
MYSQL
</code>
to use MySQL Server's connection
security.
</p>
<p>
The following additional configuration is required for a
replication group to use the MySQL communication stack. It is
especially important to make sure these requirements are all
fulfilled when you switch from using the XCom communication stack
to the MySQL communication stack for your group.
</p>
<div class="itemizedlist">
<a name="group-replication-configure-mysql-stack">
</a>
<p class="title">
<b>
Group Replication Requirements For The MySQL Communication Stack
</b>
</p>
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The network address configured by the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_local_address">
<code class="literal">
group_replication_local_address
</code>
</a>
system variable for each group member must be set to one of
the IP addresses and ports that MySQL Server is listening on,
as specified by the
<a class="link" href="server-system-variables.html#sysvar_bind_address">
<code class="literal">
bind_address
</code>
</a>
system variable
for the server. The combination of IP address and port for
each member must be unique in the group. It is recommended
that the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_group_seeds">
<code class="literal">
group_replication_group_seeds
</code>
</a>
system variable for each group member be configured to contain
all the local addresses for all the group members.
</p>
</li>
<li class="listitem">
<p>
The MySQL communication stack supports network namespaces,
which the XCom communication stack does not support. If
network namespaces are used with the Group Replication local
addresses for the group members
(
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_local_address">
<code class="literal">
group_replication_local_address
</code>
</a>
),
these must be configured for each group member using the
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE REPLICATION SOURCE TO
</code>
</a>
statement. Also, the
<a class="link" href="replication-options-replica.html#sysvar_report_host">
<code class="literal">
report_host
</code>
</a>
server system
variable for each group member must be set to report the
namespace. All group members must use the same namespace to
avoid possible issues with address resolution during
distributed recovery.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_ssl_mode">
<code class="literal">
group_replication_ssl_mode
</code>
</a>
system variable must be set to the required setting for group
communications. This system variable controls whether TLS/SSL
is enabled or disabled for group communications. When the
MySQL communication stack is used, the TLS/SSL configuration
is taken from Group Replication’s distributed recovery
settings. This setting should be the same on all the group
members, to avoid potential conflicts.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="server-system-variables.html#sysvar_require_secure_transport">
<code class="literal">
require_secure_transport
</code>
</a>
server system variable value should be the same on all the
group members, to avoid potential conflicts. If
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_ssl_mode">
<code class="literal">
group_replication_ssl_mode
</code>
</a>
is
set to
<code class="literal">
REQUIRED
</code>
,
<code class="literal">
VERIFY_CA
</code>
, or
<code class="literal">
VERIFY_IDENTITY
</code>
, use
<a class="link" href="server-system-variables.html#sysvar_require_secure_transport">
<code class="literal">
require_secure_transport=ON
</code>
</a>
.
If
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_ssl_mode">
<code class="literal">
group_replication_ssl_mode
</code>
</a>
is set to
<code class="literal">
DISABLED
</code>
,
use
<a class="link" href="server-system-variables.html#sysvar_require_secure_transport">
<code class="literal">
require_secure_transport=OFF
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
If TLS/SSL is enabled for group communications, Group
Replication’s settings for securing distributed recovery
must be configured if they are not already in place, or
validated if they already are. The MySQL communication stack
uses these settings not just for member-to-member distributed
recovery connections, but also for TLS/SSL configuration in
general group communications.
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_recovery_use_ssl">
<code class="literal">
group_replication_recovery_use_ssl
</code>
</a>
and the other
<code class="literal">
group_replication_recovery_*
</code>
system variables are explained in
<a class="xref" href="group-replication-configuring-ssl-for-recovery.html" title="20.6.3.2 Secure Socket Layer (SSL) Connections for Distributed Recovery">
Section 20.6.3.2, “Secure Socket Layer (SSL) Connections for Distributed Recovery”
</a>
.
</p>
</li>
<li class="listitem">
<p>
The Group Replication allowlist is not used when the group is
using the MySQL communication stack, so the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_ip_allowlist">
<code class="literal">
group_replication_ip_allowlist
</code>
</a>
system variable is ignored and need not be set.
</p>
</li>
<li class="listitem">
<p>
The replication user account that Group Replication uses for
distributed recovery, as configured using the
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE REPLICATION SOURCE TO
</code>
</a>
statement, is used for authentication by the MySQL
communication stack when setting up Group Replication
connections. This user account, which is the same on all group
members, must be given the following privileges:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="privileges-provided.html#priv_group-replication-stream">
<code class="literal">
GROUP_REPLICATION_STREAM
</code>
</a>
.
This privilege is required for the user account to be able
to establish connections for Group Replication using the
MySQL communication stack.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="privileges-provided.html#priv_connection-admin">
<code class="literal">
CONNECTION_ADMIN
</code>
</a>
. This
privilege is required so that Group Replication
connections are not terminated if one of the servers
involved is placed in offline mode. If the MySQL
communication stack is in use without this privilege, a
member that is placed in offline mode is expelled from the
group.
</p>
</li>
</ul>
</div>
<p>
These are in addition to the privileges
<a class="link" href="privileges-provided.html#priv_replication-slave">
<code class="literal">
REPLICATION SLAVE
</code>
</a>
and
<a class="link" href="privileges-provided.html#priv_backup-admin">
<code class="literal">
BACKUP_ADMIN
</code>
</a>
that all
replication user accounts must have (see
<a class="xref" href="group-replication-user-credentials.html" title="20.2.1.3 User Credentials For Distributed Recovery">
Section 20.2.1.3, “User Credentials For Distributed Recovery”
</a>
). When
you add the new privileges, ensure that you skip binary
logging on each group member by issuing
<code class="literal">
SET
SQL_LOG_BIN=0
</code>
before you issue the
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
statements, and
<code class="literal">
SET SQL_LOG_BIN=1
</code>
after them, so that the
local transaction does not interfere with restarting Group
Replication.
</p>
</li>
</ul>
</div>
<p>
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_communication_stack">
<code class="literal">
group_replication_communication_stack
</code>
</a>
is effectively a group-wide configuration setting, and the setting
must be the same on all group members. However, this is not
policed by Group Replication’s own checks for group-wide
configuration settings. A member with a different value from the
rest of the group cannot communicate with the other members at
all, because the communication protocols are incompatible, so it
cannot exchange information about its configuration settings.
</p>
<p>
This means that although the value of the system variable can be
changed while Group Replication is running, and takes effect after
you restart Group Replication on the group member, the member
still cannot rejoin the group until the setting has been changed
on all the members. You must therefore stop Group Replication on
all of the members and change the value of the system variable on
them all before you can restart the group. Because all of the
members are stopped, a full reboot of the group (a bootstrap by a
server with
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_bootstrap_group">
<code class="literal">
group_replication_bootstrap_group=ON
</code>
</a>
)
is required in order for the value change to take effect. You can
make the other required changes to settings on the group members
while they are stopped.
</p>
<p>
For a running group, follow this procedure to change the value of
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_communication_stack">
<code class="literal">
group_replication_communication_stack
</code>
</a>
and the other required settings to migrate a group from the XCom
communication stack to the MySQL communication stack, or from the
MySQL communication stack to the XCom communication stack:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Stop Group Replication on each of the group members, using a
<a class="link" href="stop-group-replication.html" title="15.4.3.2 STOP GROUP_REPLICATION Statement">
<code class="literal">
STOP GROUP_REPLICATION
</code>
</a>
statement. Stop the primary member last, so that you do not
trigger a new primary election and have to wait for that to
complete.
</p>
</li>
<li class="listitem">
<p>
On each of the group members, set the system variable
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_communication_stack">
<code class="literal">
group_replication_communication_stack
</code>
</a>
to the new communication stack,
<code class="literal">
MYSQL
</code>
or
<code class="literal">
XCOM
</code>
as appropriate. You can do this by
editing the MySQL Server configuration file (typically named
<code class="filename">
my.cnf
</code>
on Linux and Unix systems, or
<code class="filename">
my.ini
</code>
on Windows systems), or by using a
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
statement. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa23214574"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">PERSIST</span> group_replication_communication_stack<span class="token operator">=</span><span class="token string">"MYSQL"</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
If you are migrating the replication group from the XCom
communication stack (the default) to the MySQL communication
stack, on each of the group members, configure or reconfigure
the required system variables to appropriate settings, as
described in the listing above. For example, the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_local_address">
<code class="literal">
group_replication_local_address
</code>
</a>
system variable must be set to one of the IP addresses and
ports that MySQL Server is listening on. Also configure any
network namespaces using a
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE
REPLICATION SOURCE TO
</code>
</a>
statement.
</p>
</li>
<li class="listitem">
<p>
If you are migrating the replication group from the XCom
communication stack (the default) to the MySQL communication
stack, on each of the group members, issue
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
statements to give the
replication user account the
<a class="link" href="privileges-provided.html#priv_group-replication-stream">
<code class="literal">
GROUP_REPLICATION_STREAM
</code>
</a>
and
<a class="link" href="privileges-provided.html#priv_connection-admin">
<code class="literal">
CONNECTION_ADMIN
</code>
</a>
privileges.
You will need to take the group members out of the read-only
state that is applied when Group Replication is stopped. Also
ensure that you skip binary logging on each group member by
issuing
<code class="literal">
SET SQL_LOG_BIN=0
</code>
before you issue
the
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
statements, and
<code class="literal">
SET SQL_LOG_BIN=1
</code>
after them, so that the
local transaction does not interfere with restarting Group
Replication. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa12652494"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> SUPER_READ_ONLY<span class="token operator">=</span><span class="token keyword">OFF</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> SQL_LOG_BIN<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>
<span class="token keyword">GRANT</span> GROUP_REPLICATION_STREAM <span class="token keyword">ON</span> <span class="token operator">*</span><span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">TO</span> rpl_user@<span class="token string">'%'</span><span class="token punctuation">;</span>
<span class="token keyword">GRANT</span> CONNECTION_ADMIN <span class="token keyword">ON</span> <span class="token operator">*</span><span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">TO</span> rpl_user@<span class="token string">'%'</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> SQL_LOG_BIN<span class="token operator">=</span><span class="token number">1</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
If you are migrating the replication group from the MySQL
communication stack back to the XCom communication stack, on
each of the group members, reconfigure the system variables in
the requirements listing above to settings suitable for the
XCom communication stack.
<a class="xref" href="group-replication-options.html" title="20.9 Group Replication Variables">
Section 20.9, “Group Replication Variables”
</a>
lists the system
variables with their defaults and requirements for the XCom
communication stack.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The XCom communication stack does not support network
namespaces, so the Group Replication local address
(
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_local_address">
<code class="literal">
group_replication_local_address
</code>
</a>
system variable) cannot use these. Unset them by issuing
a
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE REPLICATION SOURCE
TO
</code>
</a>
statement.
</p>
</li>
<li class="listitem">
<p>
When you move back to the XCom communication stack, the
settings specified by
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_recovery_use_ssl">
<code class="literal">
group_replication_recovery_use_ssl
</code>
</a>
and the other
<code class="literal">
group_replication_recovery_*
</code>
system
variables are not used to secure group communications.
Instead, the Group Replication system variable
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_ssl_mode">
<code class="literal">
group_replication_ssl_mode
</code>
</a>
is used to activate the use of SSL for group
communication connections and specify the security mode
for the connections, and the remainder of the
configuration is taken from the server's SSL
configuration. For details, see
<a class="xref" href="group-replication-secure-socket-layer-support-ssl.html" title="20.6.2 Securing Group Communication Connections with Secure Socket Layer (SSL)">
Section 20.6.2, “Securing Group Communication Connections with Secure Socket Layer (SSL)”
</a>
.
</p>
</li>
</ul>
</div>
</div>
</li>
<li class="listitem">
<p>
To restart the group, follow the process in
<a class="xref" href="group-replication-restarting-group.html" title="20.5.2 Restarting a Group">
Section 20.5.2, “Restarting a Group”
</a>
, which
explains how to safely bootstrap a group where transactions
have been executed and certified. A bootstrap by a server with
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_bootstrap_group">
<code class="literal">
group_replication_bootstrap_group=ON
</code>
</a>
is necessary to change the communication stack, because all of
the members must be shut down.
</p>
</li>
<li class="listitem">
<p>
Members now connect to each other using the new communication
stack. Any server that has
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_communication_stack">
<code class="literal">
group_replication_communication_stack
</code>
</a>
set (or defaulted, in the case of XCom) to the previous
communication stack is no longer able to join the group. It is
important to note that because Group Replication cannot even
see the joining attempt, it does not check and reject the
joining member with an error message. Instead, the attempted
join fails silently when the previous communication stack
gives up trying to contact the new one.
</p>
</li>
</ol>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-replication-group-configuration-version-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-replication-group-configuration-version-table">
</a>
29.12.11.12 The replication_group_configuration_version Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045070909680">
</a>
<a class="indexterm" name="idm46045070908176">
</a>
<p>
This table displays the version of the member actions
configuration for replication group members. The table is
available only when Group Replication is installed. Whenever a
member action is enabled or disabled using the
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-enable-member-action">
<code class="literal">
group_replication_enable_member_action()
</code>
</a>
and
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-disable-member-action">
<code class="literal">
group_replication_disable_member_action()
</code>
</a>
functions, the version number is incremented. You can reset
the member actions configuration using the
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-reset-member-actions">
<code class="literal">
group_replication_reset_member_actions()
</code>
</a>
function, which resets the member actions configuration to the
default settings, and resets its version number to 1. For more
information, see
<a class="xref" href="group-replication-member-actions.html" title="20.5.1.5 Configuring Member Actions">
Section 20.5.1.5, “Configuring Member Actions”
</a>
.
</p>
<p>
The
<code class="literal">
replication_group_configuration_version
</code>
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 name of the configuration.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
VERSION
</code>
</p>
<p>
The version number of the configuration.
</p>
</li>
</ul>
</div>
<p>
The
<code class="literal">
replication_group_configuration_version
</code>
table has no indexes.
</p>
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
is not permitted
for the
<code class="literal">
replication_group_configuration_version
</code>
table.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-privilege-synchronization.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-privilege-synchronization">
</a>
25.6.13 Privilege Synchronization and NDB_STORED_USER
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045091344576">
</a>
<a class="indexterm" name="idm46045091343536">
</a>
<p>
Privilege synchronization is the mechanism used by NDB Cluster for
sharing and synchronizing users, roles, and privileges between SQL
nodes. This can be enabled by granting the
<a class="link" href="privileges-provided.html#priv_ndb-stored-user">
<code class="literal">
NDB_STORED_USER
</code>
</a>
privilege. See the
description of the privilege for usage information.
</p>
<p>
<code class="literal">
NDB_STORED_USER
</code>
is printed in the output of
<a class="link" href="show-grants.html" title="15.7.7.22 SHOW GRANTS Statement">
<code class="literal">
SHOW GRANTS
</code>
</a>
as with any other
privilege, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa89672665"><div class="copy-help left">Press ⌘+C to 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">mysql></span><span class="token command"> SHOW</span> GRANTS for <span class="token atrule">'jon'</span>@<span class="token atrule">'localhost'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Grants for jon@localhost <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT USAGE ON *.* TO `jon`@`localhost` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> GRANT NDB_STORED_USER ON *.* TO `jon`@`localhost` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
You can also verify that privileges are shared for this account
using the
<a class="link" href="mysql-cluster-programs-ndb-select-all.html" title="25.5.25 ndb_select_all — Print Rows from an NDB Table">
<span class="command">
<strong>
ndb_select_all
</strong>
</span>
</a>
utility supplied with
NDB Cluster, like this (some output wrapped to preserve
formatting):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa401141"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">ndb_select_all</span> <span class="token property">-d</span> mysql ndb_sql_metadata | grep <span class="token atrule">'`jon`@`localhost`'</span>
12 <span class="token atrule">"'jon'@'localhost'"</span> 0 <span class="token property"><span class="token punctuation">[</span>NULL<span class="token punctuation">]</span></span> <span class="token atrule">"GRANT USAGE ON *.* TO `jon`@`localhost`"</span>
11 <span class="token atrule">"'jon'@'localhost'"</span> 0 2 "CREATE USER `jon`@`localhost`
IDENTIFIED WITH <span class="token atrule">'caching_sha2_password'</span> AS
0x2441243030352466014340225A107D590E6E653B5D587922306102716D752E6656772F3038512F
6C5072776D30376D37347A384B557A4C564F70495158656A31382E45324E33
REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY DEFAULT
PASSWORD REUSE INTERVAL DEFAULT PASSWORD REQUIRE CURRENT DEFAULT"
12 <span class="token atrule">"'jon'@'localhost'"</span> 1 <span class="token property"><span class="token punctuation">[</span>NULL<span class="token punctuation">]</span></span> <span class="token atrule">"GRANT NDB_STORED_USER ON *.* TO `jon`@`localhost`"</span></code></pre>
</div>
<p>
<code class="literal">
ndb_sql_metadata
</code>
is a special
<code class="literal">
NDB
</code>
table that is not visible using the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
or other MySQL client.
</p>
<p>
A statement granting the
<a class="link" href="privileges-provided.html#priv_ndb-stored-user">
<code class="literal">
NDB_STORED_USER
</code>
</a>
privilege, such as
<code class="literal">
GRANT NDB_STORED_USER ON *.* TO
'cluster_app_user'@'localhost'
</code>
, works by directing
<code class="literal">
NDB
</code>
to create a snapshot using the queries
<code class="literal">
SHOW CREATE USER cluster_app_user@localhost
</code>
and
<code class="literal">
SHOW GRANTS FOR cluster_app_user@localhost
</code>
,
then storing the results in
<code class="literal">
ndb_sql_metadata
</code>
.
Any other SQL nodes are then requested to read and apply the
snapshot. Whenever a MySQL server starts up and joins the cluster
as an SQL node it executes these stored
<a class="link" href="create-user.html" title="15.7.1.3 CREATE USER Statement">
<code class="literal">
CREATE USER
</code>
</a>
and
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
statements as part of the
cluster schema synchronization process.
</p>
<p>
Whenever an SQL statement is executed on an SQL node other than
the one where it originated, the statement is run in a utility
thread of the
<code class="literal">
NDBCLUSTER
</code>
storage engine; this
is done within a security environment equivalent to that of the
MySQL replication replica applier thread.
</p>
<p>
An SQL node performing a change to user privileges takes a global
lock before doing so, which prevents deadlocks by concurrent ACL
operations on different SQL nodes.
</p>
<p>
You should keep in mind that, because shared schema change
operations are performed synchronously, the next shared schema
change following a change to any shared user or users serves as a
synchronization point. Any pending user changes run to completion
before the schema change distribution can begin; after this the
schema change itself runs synchronously. For example, if a
<a class="link" href="drop-database.html" title="15.1.24 DROP DATABASE Statement">
<code class="literal">
DROP DATABASE
</code>
</a>
statement follows a
<a class="link" href="drop-user.html" title="15.7.1.5 DROP USER Statement">
<code class="literal">
DROP USER
</code>
</a>
of a distributed user,
the drop of the database cannot take place until the drop of the
user has completed on all SQL nodes.
</p>
<p>
In the event that multiple
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
,
<a class="link" href="revoke.html" title="15.7.1.8 REVOKE Statement">
<code class="literal">
REVOKE
</code>
</a>
, or other user
administration statements from multiple SQL nodes cause privileges
for a given user to diverge on different SQL nodes, you can fix
this problem by issuing
<code class="literal">
GRANT NDB_STORED_USER
</code>
for this user on an SQL node where the privileges are known to be
correct; this causes a new snapshot of the privileges to be taken
and synchronized to the other SQL nodes.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
NDB Cluster 8.4 does not support distribution of
MySQL users and privileges across SQL nodes in an NDB Cluster by
altering the MySQL privilege tables such that they use the
<code class="literal">
NDB
</code>
storage engine as was done in older
releases (NDB 7.6 and earlier—see
<a class="ulink" href="/doc/refman/5.7/en/mysql-cluster-privilege-distribution.html" target="_top">
Distributed Privileges Using Shared Grant Tables
</a>
).
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-ndbinfo-events.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-ndbinfo-events">
</a>
25.6.17.35 The ndbinfo events Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045089271712">
</a>
<p>
This table provides information about event subscriptions in
<code class="literal">
NDB
</code>
. The columns of the
<code class="literal">
events
</code>
table are listed here, with short
descriptions of each:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
event_id
</code>
</p>
<p>
The event ID
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
name
</code>
</p>
<p>
The name of the event
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
table_id
</code>
</p>
<p>
The ID of the table on which the event occurred
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
reporting
</code>
</p>
<p>
One of
<code class="literal">
updated
</code>
,
<code class="literal">
all
</code>
,
<code class="literal">
subscribe
</code>
, or
<code class="literal">
DDL
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
columns
</code>
</p>
<p>
A comma-separated list of columns affected by the event
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
table_event
</code>
</p>
<p>
One or more of
<code class="literal">
INSERT
</code>
,
<code class="literal">
DELETE
</code>
,
<code class="literal">
UPDATE
</code>
,
<code class="literal">
SCAN
</code>
,
<code class="literal">
DROP
</code>
,
<code class="literal">
ALTER
</code>
,
<code class="literal">
CREATE
</code>
,
<code class="literal">
GCP_COMPLETE
</code>
,
<code class="literal">
CLUSTER_FAILURE
</code>
,
<code class="literal">
STOP
</code>
,
<code class="literal">
NODE_FAILURE
</code>
,
<code class="literal">
SUBSCRIBE
</code>
,
<code class="literal">
UNSUBSCRIBE
</code>
, and
<code class="literal">
ALL
</code>
(defined by
<a class="ulink" href="/doc/ndbapi/en/ndb-event.html#ndb-event-tableevent" target="_top">
<code class="literal">
Event::TableEvent
</code>
</a>
in the
NDB API)
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-events-statements-history-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-events-statements-history-table">
</a>
29.12.6.2 The events_statements_history Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045072669696">
</a>
<a class="indexterm" name="idm46045072668192">
</a>
<p>
The
<a class="link" href="performance-schema-events-statements-history-table.html" title="29.12.6.2 The events_statements_history Table">
<code class="literal">
events_statements_history
</code>
</a>
table contains the
<em class="replaceable">
<code>
N
</code>
</em>
most recent
statement events that have ended per thread. Statement events
are not added to the table until they have ended. When the
table contains the maximum number of rows for a given thread,
the oldest thread row is discarded when a new row for that
thread is added. When a thread ends, all its rows are
discarded.
</p>
<p>
The Performance Schema autosizes the value of
<em class="replaceable">
<code>
N
</code>
</em>
during server startup. To set the
number of rows per thread explicitly, set the
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_events_statements_history_size">
<code class="literal">
performance_schema_events_statements_history_size
</code>
</a>
system variable at server startup.
</p>
<p>
The
<a class="link" href="performance-schema-events-statements-history-table.html" title="29.12.6.2 The events_statements_history Table">
<code class="literal">
events_statements_history
</code>
</a>
table has the same columns and indexing as
<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>
. See
<a class="xref" href="performance-schema-events-statements-current-table.html" title="29.12.6.1 The events_statements_current Table">
Section 29.12.6.1, “The events_statements_current Table”
</a>
.
</p>
<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
the
<a class="link" href="performance-schema-events-statements-history-table.html" title="29.12.6.2 The events_statements_history Table">
<code class="literal">
events_statements_history
</code>
</a>
table. It removes the rows.
</p>
<p>
For more information about the relationship between the three
<code class="literal">
events_statements_
<em class="replaceable">
<code>
xxx
</code>
</em>
</code>
event tables, see
<a class="xref" href="performance-schema-event-tables.html" title="29.9 Performance Schema Tables for Current and Historical Events">
Section 29.9, “Performance Schema Tables for Current and Historical Events”
</a>
.
</p>
<p>
For information about configuring whether to collect statement
events, see
<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>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/checking-rpm-signature.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="checking-rpm-signature">
</a>
2.1.4.4 Signature Checking Using RPM
</h4>
</div>
</div>
</div>
<p>
For RPM packages, there is no separate signature. RPM packages
have a built-in GPG signature and MD5 checksum. You can verify a
package by running the following command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa81136774"><div class="copy-help left">Press ⌘+C to 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">rpm</span> <span class="token property">--checksig</span> <em class="replaceable">package_name</em><span class="token punctuation">.</span>rpm</code></pre>
</div>
<p>
Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa40753713"><div class="copy-help left">Press ⌘+C to 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">rpm</span> <span class="token property">--checksig</span> mysql-community-server-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>3-1<span class="token punctuation">.</span>el8<span class="token punctuation">.</span>x86_64<span class="token punctuation">.</span>rpm
mysql-community-server-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>3-1<span class="token punctuation">.</span>el8<span class="token punctuation">.</span>x86_64<span class="token punctuation">.</span>rpm<span class="token punctuation">:</span> digests signatures OK</code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If you are using RPM 4.1 and it complains about
<code class="literal">
(GPG)
NOT OK (MISSING KEYS: GPG#a8d3785c)
</code>
, even though you
have imported the MySQL public build key into your own GPG
keyring, you need to import the key into the RPM keyring
first. RPM 4.1 no longer uses your personal GPG keyring (or
GPG itself). Rather, RPM maintains a separate keyring because
it is a system-wide application and a user's GPG public
keyring is a user-specific file. To import the MySQL public
key into the RPM keyring, first obtain the key, then use
<span class="command">
<strong>
rpm --import
</strong>
</span>
to import the key. For
example:
</p>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa65151823"><div class="copy-help left">Press ⌘+C to 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">gpg</span> <span class="token property">--export</span> <span class="token property">-a</span> a8d3785c > a8d3785c<span class="token punctuation">.</span>asc
<span class="token prompt">$> </span><span class="token command">rpm</span> <span class="token property">--import</span> a8d3785c<span class="token punctuation">.</span>asc</code></pre>
</div>
<p>
Alternatively,
<span class="command">
<strong>
rpm
</strong>
</span>
also supports loading the
key directly from a URL:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa72004384"><div class="copy-help left">Press ⌘+C to 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">rpm</span> <span class="token property">--import</span> https<span class="token punctuation">:</span>//repo<span class="token punctuation">.</span>mysql<span class="token punctuation">.</span>com/RPM-GPG-KEY-mysql-2023</code></pre>
</div>
<p>
You can also obtain the MySQL public key from this manual page:
<a class="xref" href="checking-gpg-signature.html" title="2.1.4.2 Signature Checking Using GnuPG">
Section 2.1.4.2, “Signature Checking Using GnuPG”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/precision-math.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="precision-math">
</a>
14.24 Precision Math
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="precision-math-numbers.html">
14.24.1 Types of Numeric Values
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="precision-math-decimal-characteristics.html">
14.24.2 DECIMAL Data Type Characteristics
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="precision-math-expressions.html">
14.24.3 Expression Handling
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="precision-math-rounding.html">
14.24.4 Rounding Behavior
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="precision-math-examples.html">
14.24.5 Precision Math Examples
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045190531376">
</a>
<a class="indexterm" name="idm46045190530304">
</a>
<a class="indexterm" name="idm46045190529232">
</a>
<a class="indexterm" name="idm46045190528160">
</a>
<a class="indexterm" name="idm46045190527088">
</a>
<a class="indexterm" name="idm46045190526016">
</a>
<a class="indexterm" name="idm46045190524944">
</a>
<a class="indexterm" name="idm46045190523456">
</a>
<a class="indexterm" name="idm46045190521968">
</a>
<a class="indexterm" name="idm46045190520896">
</a>
<a class="indexterm" name="idm46045190519808">
</a>
<a class="indexterm" name="idm46045190518736">
</a>
<p>
MySQL provides support for precision math: numeric value handling
that results in extremely accurate results and a high degree control
over invalid values. Precision math is based on these two features:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
SQL modes that control how strict the server is about accepting
or rejecting invalid data.
</p>
</li>
<li class="listitem">
<p>
The MySQL library for fixed-point arithmetic.
</p>
</li>
</ul>
</div>
<p>
These features have several implications for numeric operations and
provide a high degree of compliance with standard SQL:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<span class="bold">
<strong>
Precise calculations
</strong>
</span>
: For
exact-value numbers, calculations do not introduce
floating-point errors. Instead, exact precision is used. For
example, MySQL treats a number such as
<code class="literal">
.0001
</code>
as an exact value rather than as an approximation, and summing
it 10,000 times produces a result of exactly
<code class="literal">
1
</code>
, not a value that is merely
<span class="quote">
“
<span class="quote">
close
</span>
”
</span>
to 1.
</p>
</li>
<li class="listitem">
<p>
<span class="bold">
<strong>
Well-defined rounding behavior
</strong>
</span>
:
For exact-value numbers, the result of
<a class="link" href="mathematical-functions.html#function_round">
<code class="literal">
ROUND()
</code>
</a>
depends on its argument,
not on environmental factors such as how the underlying C
library works.
</p>
</li>
<li class="listitem">
<p>
<span class="bold">
<strong>
Platform independence
</strong>
</span>
:
Operations on exact numeric values are the same across different
platforms such as Windows and Unix.
</p>
</li>
<li class="listitem">
<p>
<span class="bold">
<strong>
Control over handling of invalid
values
</strong>
</span>
: Overflow and division by zero are detectable
and can be treated as errors. For example, you can treat a value
that is too large for a column as an error rather than having
the value truncated to lie within the range of the column's data
type. Similarly, you can treat division by zero as an error
rather than as an operation that produces a result of
<code class="literal">
NULL
</code>
. The choice of which approach to take is
determined by the setting of the server SQL mode.
</p>
</li>
</ul>
</div>
<p>
The following discussion covers several aspects of how precision
math works, including possible incompatibilities with older
applications. At the end, some examples are given that demonstrate
how MySQL handles numeric operations precisely. For information
about controlling the SQL mode, see
<a class="xref" href="sql-mode.html" title="7.1.11 Server SQL Modes">
Section 7.1.11, “Server SQL Modes”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/deploy-mysql-nonlinux-docker.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="deploy-mysql-nonlinux-docker">
</a>
2.5.6.3 Deploying MySQL on Windows and Other Non-Linux Platforms with Docker
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045330078304">
</a>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
The MySQL Docker images provided by Oracle are built
specifically for Linux platforms. Other platforms are not
supported, and users running the MySQL Docker images from
Oracle on them are doing so at their own risk. This section
discusses some known issues for the images when used on
non-Linux platforms.
</p>
</div>
<p>
Known Issues for using the MySQL Server Docker images from
Oracle on Windows include:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If you are bind-mounting on the container's MySQL data
directory (see
<a class="xref" href="docker-mysql-more-topics.html#docker-persisting-data-configuration" title="Persisting Data and Configuration Changes">
Persisting Data and Configuration Changes
</a>
for
details), you have to set the location of the server socket
file with the
<a class="link" href="server-system-variables.html#sysvar_socket">
<code class="option">
--socket
</code>
</a>
option
to somewhere outside of the MySQL data directory; otherwise,
the server fails to start. This is because the way Docker
for Windows handles file mounting does not allow a host file
from being bind-mounted on the socket file.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/gis-class-multipolygon.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="gis-class-multipolygon">
</a>
13.4.2.13 MultiPolygon Class
</h4>
</div>
</div>
</div>
<p>
A
<code class="literal">
MultiPolygon
</code>
is a
<code class="literal">
MultiSurface
</code>
object composed of
<code class="literal">
Polygon
</code>
elements.
</p>
<p>
<span class="bold">
<strong>
<code class="literal">
MultiPolygon
</code>
Examples
</strong>
</span>
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
On a region map, a
<code class="literal">
MultiPolygon
</code>
could
represent a system of lakes.
</p>
</li>
</ul>
</div>
<p>
<span class="bold">
<strong>
<code class="literal">
MultiPolygon
</code>
Assertions
</strong>
</span>
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A
<code class="literal">
MultiPolygon
</code>
has no two
<code class="literal">
Polygon
</code>
elements with interiors that
intersect.
</p>
</li>
<li class="listitem">
<p>
A
<code class="literal">
MultiPolygon
</code>
has no two
<code class="literal">
Polygon
</code>
elements that cross (crossing
is also forbidden by the previous assertion), or that
touch at an infinite number of points.
</p>
</li>
<li class="listitem">
<p>
A
<code class="literal">
MultiPolygon
</code>
may not have cut lines,
spikes, or punctures. A
<code class="literal">
MultiPolygon
</code>
is
a regular, closed point set.
</p>
</li>
<li class="listitem">
<p>
A
<code class="literal">
MultiPolygon
</code>
that has more than one
<code class="literal">
Polygon
</code>
has an interior that is not
connected. The number of connected components of the
interior of a
<code class="literal">
MultiPolygon
</code>
is equal to
the number of
<code class="literal">
Polygon
</code>
values in the
<code class="literal">
MultiPolygon
</code>
.
</p>
</li>
</ul>
</div>
<p>
<span class="bold">
<strong>
<code class="literal">
MultiPolygon
</code>
Properties
</strong>
</span>
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A
<code class="literal">
MultiPolygon
</code>
is a two-dimensional
geometry.
</p>
</li>
<li class="listitem">
<p>
A
<code class="literal">
MultiPolygon
</code>
boundary is a set of
closed curves (
<code class="literal">
LineString
</code>
values)
corresponding to the boundaries of its
<code class="literal">
Polygon
</code>
elements.
</p>
</li>
<li class="listitem">
<p>
Each
<code class="literal">
Curve
</code>
in the boundary of the
<code class="literal">
MultiPolygon
</code>
is in the boundary of
exactly one
<code class="literal">
Polygon
</code>
element.
</p>
</li>
<li class="listitem">
<p>
Every
<code class="literal">
Curve
</code>
in the boundary of an
<code class="literal">
Polygon
</code>
element is in the boundary of
the
<code class="literal">
MultiPolygon
</code>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/windows-upgrading.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="windows-upgrading">
</a>
3.11 Upgrading MySQL on Windows
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045325928096">
</a>
<p>
To upgrade MySQL on Windows, either
<a class="link" href="windows-upgrading.html#windows-upgrading-msi" title="Upgrading MySQL with MSI">
download and execute the
latest MySQL Server MSI
</a>
or
<a class="link" href="windows-upgrading.html#windows-upgrading-zip-distribution" title="Upgrading MySQL Using the Windows ZIP Distribution">
use the Windows
ZIP archive distribution
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Unlike MySQL 8.4, MySQL 8.0 uses MySQL Installer to install
and upgrade MySQL Server along with most other MySQL products;
but MySQL Installer is not available with MySQL 8.1 and higher. However,
the configuration functionality used in MySQL Installer is available as of
MySQL 8.1 using
<a class="xref" href="mysql-configurator.html" title="2.3.2 Configuration: Using MySQL Configurator">
Section 2.3.2, “Configuration: Using MySQL Configurator”
</a>
that is
bundled with both the MSI and Zip archive.
</p>
</div>
<p>
The approach you select depends on how the existing installation
was performed. Before proceeding, review
<a class="xref" href="upgrading.html" title="Chapter 3 Upgrading MySQL">
Chapter 3,
<i>
Upgrading MySQL
</i>
</a>
for additional information on
upgrading MySQL that is not specific to Windows.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="windows-upgrading-msi">
</a>
Upgrading MySQL with MSI
</h3>
</div>
</div>
</div>
<p>
Download and execute the latest MSI. Although upgrading between
release series is not directly supported, the "Custom Setup"
option allows defining an installation location as otherwise the
MSI installs to the standard location, such as
<code class="filename">
C:\Program Files\MySQL\MySQL Server
8.4\
</code>
.
</p>
<p>
Execute
<a class="link" href="mysql-configurator.html" title="2.3.2 Configuration: Using MySQL Configurator">
MySQL
Configurator
</a>
to configure your installation.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="windows-upgrading-zip-distribution">
</a>
Upgrading MySQL Using the Windows ZIP Distribution
</h3>
</div>
</div>
</div>
<p>
To perform an upgrade using the Windows ZIP archive
distribution:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Download the latest Windows ZIP Archive distribution of
MySQL from
<a class="ulink" href="https://dev.mysql.com/downloads/" target="_top">
https://dev.mysql.com/downloads/
</a>
.
</p>
</li>
<li class="listitem">
<p>
If the server is running, stop it. If the server is
installed as a service, stop the service with the following
command from the command prompt:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa52674427"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\></span><span class="token command"> SC</span> STOP <em class="replaceable">mysqld_service_name</em></code></pre>
</div>
<p>
Alternatively, use
<span class="command">
<strong>
NET STOP
<em class="replaceable">
<code>
mysqld_service_name
</code>
</em>
</strong>
</span>
.
</p>
<p>
If you are not running the MySQL server as a service, use
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
</strong>
</span>
</a>
to stop it. For example,
before upgrading from MySQL 8.3 to
8.4, use
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
</strong>
</span>
</a>
from
MySQL 8.3 as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa46108012"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\></span> <span class="token atrule">"C:\Program Files\MySQL\MySQL Server 8.3\bin\mysqladmin"</span> <span class="token property">-u</span> root shutdown</code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If the MySQL
<code class="literal">
root
</code>
user account has a
password, invoke
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
</strong>
</span>
</a>
with the
<code class="option">
-p
</code>
option and enter the password when
prompted.
</p>
</div>
</li>
<li class="listitem">
<p>
Extract the ZIP archive. You may either overwrite your
existing MySQL installation (usually located at
<code class="filename">
C:\mysql
</code>
), or install it into a
different directory, such as
<code class="literal">
C:\mysql8
</code>
.
Overwriting the existing installation is recommended.
</p>
</li>
<li class="listitem">
<p>
Restart the server. For example, use the
<span class="command">
<strong>
SC START
<em class="replaceable">
<code>
mysqld_service_name
</code>
</em>
</strong>
</span>
or
<span class="command">
<strong>
NET START
<em class="replaceable">
<code>
mysqld_service_name
</code>
</em>
</strong>
</span>
command if you run MySQL as a service, or invoke
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
directly otherwise.
</p>
</li>
<li class="listitem">
<p>
If you encounter errors, see
<a class="xref" href="windows-troubleshooting.html" title="2.3.4 Troubleshooting a Microsoft Windows MySQL Server Installation">
Section 2.3.4, “Troubleshooting a Microsoft Windows MySQL Server Installation”
</a>
.
</p>
</li>
</ol>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/connection-control-information-schema-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="connection-control-information-schema-tables">
</a>
28.6 INFORMATION_SCHEMA Connection-Control Tables
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="information-schema-connection-control-table-reference.html">
28.6.1 INFORMATION_SCHEMA Connection-Control Table Reference
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-connection-control-failed-login-attempts-table.html">
28.6.2 The INFORMATION_SCHEMA CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS Table
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045076021968">
</a>
<p>
The following sections describe the
<code class="literal">
INFORMATION_SCHEMA
</code>
tables associated with the
<code class="literal">
CONNECTION_CONTROL
</code>
plugin.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/lateral-derived-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="lateral-derived-tables">
</a>
15.2.15.9 Lateral Derived Tables
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045179695792">
</a>
<a class="indexterm" name="idm46045179694304">
</a>
<p>
A derived table cannot normally refer to (depend on) columns of
preceding tables in the same
<code class="literal">
FROM
</code>
clause. A
derived table may be defined as a lateral derived table to
specify that such references are permitted.
</p>
<p>
Nonlateral derived tables are specified using the syntax
discussed in
<a class="xref" href="derived-tables.html" title="15.2.15.8 Derived Tables">
Section 15.2.15.8, “Derived Tables”
</a>
. The syntax for a
lateral derived table is the same as for a nonlateral derived
table except that the keyword
<code class="literal">
LATERAL
</code>
is
specified before the derived table specification. The
<code class="literal">
LATERAL
</code>
keyword must precede each table to be
used as a lateral derived table.
</p>
<p>
Lateral derived tables are subject to these restrictions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A lateral derived table can occur only in a
<code class="literal">
FROM
</code>
clause, either in a list of tables
separated with commas or in a join specification
(
<code class="literal">
JOIN
</code>
,
<code class="literal">
INNER JOIN
</code>
,
<code class="literal">
CROSS JOIN
</code>
,
<code class="literal">
LEFT [OUTER]
JOIN
</code>
, or
<code class="literal">
RIGHT [OUTER] JOIN
</code>
).
</p>
</li>
<li class="listitem">
<p>
If a lateral derived table is in the right operand of a join
clause and contains a reference to the left operand, the
join operation must be an
<code class="literal">
INNER JOIN
</code>
,
<code class="literal">
CROSS JOIN
</code>
, or
<code class="literal">
LEFT [OUTER]
JOIN
</code>
.
</p>
<p>
If the table is in the left operand and contains a reference
to the right operand, the join operation must be an
<code class="literal">
INNER JOIN
</code>
,
<code class="literal">
CROSS
JOIN
</code>
, or
<code class="literal">
RIGHT [OUTER] JOIN
</code>
.
</p>
</li>
<li class="listitem">
<p>
If a lateral derived table references an aggregate function,
the function's aggregation query cannot be the one that owns
the
<code class="literal">
FROM
</code>
clause in which the lateral
derived table occurs.
</p>
</li>
<li class="listitem">
<p>
In accordance with the SQL standard, MySQL always treats a
join with a table function such as
<a class="link" href="json-table-functions.html#function_json-table">
<code class="literal">
JSON_TABLE()
</code>
</a>
as though
<code class="literal">
LATERAL
</code>
had been used. Since the
<code class="literal">
LATERAL
</code>
keyword is implicit, it is not
allowed before
<code class="literal">
JSON_TABLE()
</code>
; this is also
according to the SQL standard.
</p>
</li>
</ul>
</div>
<p>
The following discussion shows how lateral derived tables make
possible certain SQL operations that cannot be done with
nonlateral derived tables or that require less-efficient
workarounds.
</p>
<p>
Suppose that we want to solve this problem: Given a table of
people in a sales force (where each row describes a member of
the sales force), and a table of all sales (where each row
describes a sale: salesperson, customer, amount, date),
determine the size and customer of the largest sale for each
salesperson. This problem can be approached two ways.
</p>
<p>
First approach to solving the problem: For each salesperson,
calculate the maximum sale size, and also find the customer who
provided this maximum. In MySQL, that can be done like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa71762374"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>
salesperson<span class="token punctuation">.</span><span class="token keyword">name</span><span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">-- find maximum sale size for this salesperson</span>
<span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token function">MAX</span><span class="token punctuation">(</span>amount<span class="token punctuation">)</span> <span class="token keyword">AS</span> amount
<span class="token keyword">FROM</span> all_sales
<span class="token keyword">WHERE</span> all_sales<span class="token punctuation">.</span>salesperson_id <span class="token operator">=</span> salesperson<span class="token punctuation">.</span>id<span class="token punctuation">)</span>
<span class="token keyword">AS</span> amount<span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">-- find customer for this maximum size</span>
<span class="token punctuation">(</span><span class="token keyword">SELECT</span> customer_name
<span class="token keyword">FROM</span> all_sales
<span class="token keyword">WHERE</span> all_sales<span class="token punctuation">.</span>salesperson_id <span class="token operator">=</span> salesperson<span class="token punctuation">.</span>id
<span class="token operator">AND</span> all_sales<span class="token punctuation">.</span>amount <span class="token operator">=</span>
<span class="token comment" spellcheck="true">-- find maximum size, again</span>
<span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token function">MAX</span><span class="token punctuation">(</span>amount<span class="token punctuation">)</span> <span class="token keyword">AS</span> amount
<span class="token keyword">FROM</span> all_sales
<span class="token keyword">WHERE</span> all_sales<span class="token punctuation">.</span>salesperson_id <span class="token operator">=</span> salesperson<span class="token punctuation">.</span>id<span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token keyword">AS</span> customer_name
<span class="token keyword">FROM</span>
salesperson<span class="token punctuation">;</span></code></pre>
</div>
<p>
That query is inefficient because it calculates the maximum size
twice per salesperson (once in the first subquery and once in
the second).
</p>
<p>
We can try to achieve an efficiency gain by calculating the
maximum once per salesperson and
<span class="quote">
“
<span class="quote">
caching
</span>
”
</span>
it in a
derived table, as shown by this modified query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa92367872"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>
salesperson<span class="token punctuation">.</span><span class="token keyword">name</span><span class="token punctuation">,</span>
max_sale<span class="token punctuation">.</span>amount<span class="token punctuation">,</span>
max_sale_customer<span class="token punctuation">.</span>customer_name
<span class="token keyword">FROM</span>
salesperson<span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">-- calculate maximum size, cache it in transient derived table max_sale</span>
<span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token function">MAX</span><span class="token punctuation">(</span>amount<span class="token punctuation">)</span> <span class="token keyword">AS</span> amount
<span class="token keyword">FROM</span> all_sales
<span class="token keyword">WHERE</span> all_sales<span class="token punctuation">.</span>salesperson_id <span class="token operator">=</span> salesperson<span class="token punctuation">.</span>id<span class="token punctuation">)</span>
<span class="token keyword">AS</span> max_sale<span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">-- find customer, reusing cached maximum size</span>
<span class="token punctuation">(</span><span class="token keyword">SELECT</span> customer_name
<span class="token keyword">FROM</span> all_sales
<span class="token keyword">WHERE</span> all_sales<span class="token punctuation">.</span>salesperson_id <span class="token operator">=</span> salesperson<span class="token punctuation">.</span>id
<span class="token operator">AND</span> all_sales<span class="token punctuation">.</span>amount <span class="token operator">=</span>
<span class="token comment" spellcheck="true">-- the cached maximum size</span>
max_sale<span class="token punctuation">.</span>amount<span class="token punctuation">)</span>
<span class="token keyword">AS</span> max_sale_customer<span class="token punctuation">;</span></code></pre>
</div>
<p>
However, the query is illegal in SQL-92 because derived tables
cannot depend on other tables in the same
<code class="literal">
FROM
</code>
clause. Derived tables must be constant
over the query's duration, not contain references to columns of
other
<code class="literal">
FROM
</code>
clause tables. As written, the
query produces this error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa88614592"><div class="copy-help left">Press ⌘+C to 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 1054 (42S22): Unknown column 'salesperson.id' in 'where clause'</code></pre>
</div>
<p>
In SQL:1999, the query becomes legal if the derived tables are
preceded by the
<code class="literal">
LATERAL
</code>
keyword (which means
<span class="quote">
“
<span class="quote">
this derived table depends on previous tables on its left
side
</span>
”
</span>
):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24628487"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>
salesperson<span class="token punctuation">.</span><span class="token keyword">name</span><span class="token punctuation">,</span>
max_sale<span class="token punctuation">.</span>amount<span class="token punctuation">,</span>
max_sale_customer<span class="token punctuation">.</span>customer_name
<span class="token keyword">FROM</span>
salesperson<span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">-- calculate maximum size, cache it in transient derived table max_sale</span>
<span class="token keyword">LATERAL</span>
<span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token function">MAX</span><span class="token punctuation">(</span>amount<span class="token punctuation">)</span> <span class="token keyword">AS</span> amount
<span class="token keyword">FROM</span> all_sales
<span class="token keyword">WHERE</span> all_sales<span class="token punctuation">.</span>salesperson_id <span class="token operator">=</span> salesperson<span class="token punctuation">.</span>id<span class="token punctuation">)</span>
<span class="token keyword">AS</span> max_sale<span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">-- find customer, reusing cached maximum size</span>
<span class="token keyword">LATERAL</span>
<span class="token punctuation">(</span><span class="token keyword">SELECT</span> customer_name
<span class="token keyword">FROM</span> all_sales
<span class="token keyword">WHERE</span> all_sales<span class="token punctuation">.</span>salesperson_id <span class="token operator">=</span> salesperson<span class="token punctuation">.</span>id
<span class="token operator">AND</span> all_sales<span class="token punctuation">.</span>amount <span class="token operator">=</span>
<span class="token comment" spellcheck="true">-- the cached maximum size</span>
max_sale<span class="token punctuation">.</span>amount<span class="token punctuation">)</span>
<span class="token keyword">AS</span> max_sale_customer<span class="token punctuation">;</span></code></pre>
</div>
<p>
A lateral derived table need not be constant and is brought up
to date each time a new row from a preceding table on which it
depends is processed by the top query.
</p>
<p>
Second approach to solving the problem: A different solution
could be used if a subquery in the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
list could return multiple
columns:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa66160852"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>
salesperson<span class="token punctuation">.</span><span class="token keyword">name</span><span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">-- find maximum size and customer at same time</span>
<span class="token punctuation">(</span><span class="token keyword">SELECT</span> amount<span class="token punctuation">,</span> customer_name
<span class="token keyword">FROM</span> all_sales
<span class="token keyword">WHERE</span> all_sales<span class="token punctuation">.</span>salesperson_id <span class="token operator">=</span> salesperson<span class="token punctuation">.</span>id
<span class="token keyword">ORDER</span> <span class="token keyword">BY</span> amount <span class="token keyword">DESC</span> <span class="token keyword">LIMIT</span> <span class="token number">1</span><span class="token punctuation">)</span>
<span class="token keyword">FROM</span>
salesperson<span class="token punctuation">;</span></code></pre>
</div>
<p>
That is efficient but illegal. It does not work because such
subqueries can return only a single column:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa74049893"><div class="copy-help left">Press ⌘+C to 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 1241 (21000): Operand should contain 1 column(s)</code></pre>
</div>
<p>
One attempt at rewriting the query is to select multiple columns
from a derived table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69865235"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>
salesperson<span class="token punctuation">.</span><span class="token keyword">name</span><span class="token punctuation">,</span>
max_sale<span class="token punctuation">.</span>amount<span class="token punctuation">,</span>
max_sale<span class="token punctuation">.</span>customer_name
<span class="token keyword">FROM</span>
salesperson<span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">-- find maximum size and customer at same time</span>
<span class="token punctuation">(</span><span class="token keyword">SELECT</span> amount<span class="token punctuation">,</span> customer_name
<span class="token keyword">FROM</span> all_sales
<span class="token keyword">WHERE</span> all_sales<span class="token punctuation">.</span>salesperson_id <span class="token operator">=</span> salesperson<span class="token punctuation">.</span>id
<span class="token keyword">ORDER</span> <span class="token keyword">BY</span> amount <span class="token keyword">DESC</span> <span class="token keyword">LIMIT</span> <span class="token number">1</span><span class="token punctuation">)</span>
<span class="token keyword">AS</span> max_sale<span class="token punctuation">;</span></code></pre>
</div>
<p>
However, that also does not work. The derived table is dependent
on the
<code class="literal">
salesperson
</code>
table and thus fails
without
<code class="literal">
LATERAL
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa22250643"><div class="copy-help left">Press ⌘+C to 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 1054 (42S22): Unknown column 'salesperson.id' in 'where clause'</code></pre>
</div>
<p>
Adding the
<code class="literal">
LATERAL
</code>
keyword makes the query
legal:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa71756068"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>
salesperson<span class="token punctuation">.</span><span class="token keyword">name</span><span class="token punctuation">,</span>
max_sale<span class="token punctuation">.</span>amount<span class="token punctuation">,</span>
max_sale<span class="token punctuation">.</span>customer_name
<span class="token keyword">FROM</span>
salesperson<span class="token punctuation">,</span>
<span class="token comment" spellcheck="true">-- find maximum size and customer at same time</span>
<span class="token keyword">LATERAL</span>
<span class="token punctuation">(</span><span class="token keyword">SELECT</span> amount<span class="token punctuation">,</span> customer_name
<span class="token keyword">FROM</span> all_sales
<span class="token keyword">WHERE</span> all_sales<span class="token punctuation">.</span>salesperson_id <span class="token operator">=</span> salesperson<span class="token punctuation">.</span>id
<span class="token keyword">ORDER</span> <span class="token keyword">BY</span> amount <span class="token keyword">DESC</span> <span class="token keyword">LIMIT</span> <span class="token number">1</span><span class="token punctuation">)</span>
<span class="token keyword">AS</span> max_sale<span class="token punctuation">;</span></code></pre>
</div>
<p>
In short,
<code class="literal">
LATERAL
</code>
is the efficient solution
to all drawbacks in the two approaches just discussed.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-logging.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-logging">
</a>
6.5.1.3 mysql Client Logging
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045317485376">
</a>
<a class="indexterm" name="idm46045317484288">
</a>
<a class="indexterm" name="idm46045317482800">
</a>
<a class="indexterm" name="idm46045317481712">
</a>
<a class="indexterm" name="idm46045317480224">
</a>
<a class="indexterm" name="idm46045317479136">
</a>
<a class="indexterm" name="idm46045317477648">
</a>
<a class="indexterm" name="idm46045317476576">
</a>
<a class="indexterm" name="idm46045317475088">
</a>
<p>
The
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client can do these types of
logging for statements executed interactively:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
On Unix,
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
writes the statements to a
history file. By default, this file is named
<code class="filename">
.mysql_history
</code>
in your home directory.
To specify a different file, set the value of the
<code class="literal">
MYSQL_HISTFILE
</code>
environment variable.
</p>
</li>
<li class="listitem">
<p>
On all platforms, if the
<code class="option">
--syslog
</code>
option is
given,
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
writes the statements to the
system logging facility. On Unix, this is
<code class="literal">
syslog
</code>
; on Windows, it is the Windows
Event Log. The destination where logged messages appear is
system dependent. On Linux, the destination is often the
<code class="filename">
/var/log/messages
</code>
file.
</p>
</li>
</ul>
</div>
<p>
The following discussion describes characteristics that apply to
all logging types and provides information specific to each
logging type.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="mysql-logging.html#mysql-logging-how-logging-occurs" title="How Logging Occurs">
How Logging Occurs
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="mysql-logging.html#mysql-logging-history-file" title="Controlling the History File">
Controlling the History File
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="mysql-logging.html#mysql-logging-syslog" title="syslog Logging Characteristics">
syslog Logging Characteristics
</a>
</p>
</li>
</ul>
</div>
<h5>
<a name="mysql-logging-how-logging-occurs">
</a>
How Logging Occurs
</h5>
<p>
For each enabled logging destination, statement logging occurs
as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Statements are logged only when executed interactively.
Statements are noninteractive, for example, when read from a
file or a pipe. It is also possible to suppress statement
logging by using the
<a class="link" href="mysql-command-options.html#option_mysql_batch">
<code class="option">
--batch
</code>
</a>
or
<a class="link" href="mysql-command-options.html#option_mysql_execute">
<code class="option">
--execute
</code>
</a>
option.
</p>
</li>
<li class="listitem">
<p>
Statements are ignored and not logged if they match any
pattern in the
<span class="quote">
“
<span class="quote">
ignore
</span>
”
</span>
list. This list is
described later.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
logs each nonignored, nonempty
statement line individually.
</p>
</li>
<li class="listitem">
<p>
If a nonignored statement spans multiple lines (not
including the terminating delimiter),
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
concatenates the lines to form the
complete statement, maps newlines to spaces, and logs the
result, plus a delimiter.
</p>
</li>
</ul>
</div>
<p>
Consequently, an input statement that spans multiple lines can
be logged twice. Consider this input:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa91029123"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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 string">'Today is'</span>
<span class="token prompt"> -></span> <span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">CURDATE</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token punctuation">;</span></code></pre>
</div>
<p>
In this case,
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
logs the
<span class="quote">
“
<span class="quote">
SELECT
</span>
”
</span>
,
<span class="quote">
“
<span class="quote">
'Today is'
</span>
”
</span>
,
<span class="quote">
“
<span class="quote">
,
</span>
”
</span>
,
<span class="quote">
“
<span class="quote">
CURDATE()
</span>
”
</span>
, and
<span class="quote">
“
<span class="quote">
;
</span>
”
</span>
lines as it reads them. It also logs the complete statement,
after mapping
<code class="literal">
SELECT\n'Today
is'\n,\nCURDATE()
</code>
to
<code class="literal">
SELECT 'Today is' ,
CURDATE()
</code>
, plus a delimiter. Thus, these lines appear
in logged output:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa27217445"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span>
<span class="token string">'Today is'</span>
<span class="token punctuation">,</span>
<span class="token function">CURDATE</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token string">'Today is'</span> <span class="token punctuation">,</span> <span class="token function">CURDATE</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
ignores for logging purposes statements
that match any pattern in the
<span class="quote">
“
<span class="quote">
ignore
</span>
”
</span>
list. By
default, the pattern list is
<code class="literal">
"*IDENTIFIED*:*PASSWORD*"
</code>
, to ignore
statements that refer to passwords. Pattern matching is not
case-sensitive. Within patterns, two characters are special:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
?
</code>
matches any single character.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
*
</code>
matches any sequence of zero or more
characters.
</p>
</li>
</ul>
</div>
<p>
To specify additional patterns, use the
<a class="link" href="mysql-command-options.html#option_mysql_histignore">
<code class="option">
--histignore
</code>
</a>
option or set the
<code class="literal">
MYSQL_HISTIGNORE
</code>
environment variable. (If
both are specified, the option value takes precedence.) The
value should be a list of one or more colon-separated patterns,
which are appended to the default pattern list.
</p>
<p>
Patterns specified on the command line might need to be quoted
or escaped to prevent your command interpreter from treating
them specially. For example, to suppress logging for
<code class="literal">
UPDATE
</code>
and
<code class="literal">
DELETE
</code>
statements in addition to statements that refer to passwords,
invoke
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa96948568"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysql <span class="token constant">--histignore</span>=<span class="token atrule">"*UPDATE*:*DELETE*"</span></code></pre>
</div>
<h5>
<a name="mysql-logging-history-file">
</a>
Controlling the History File
</h5>
<p>
The
<code class="filename">
.mysql_history
</code>
file should be protected
with a restrictive access mode because sensitive information
might be written to it, such as the text of SQL statements that
contain passwords. See
<a class="xref" href="password-security-user.html" title="8.1.2.1 End-User Guidelines for Password Security">
Section 8.1.2.1, “End-User Guidelines for Password Security”
</a>
.
Statements in the file are accessible from the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client when the
<span class="keycap">
<strong>
up-arrow
</strong>
</span>
key is used to recall the history. See
<a class="xref" href="mysql-tips.html#mysql-history" title="Disabling Interactive History">
Disabling Interactive History
</a>
.
</p>
<p>
If you do not want to maintain a history file, first remove
<code class="filename">
.mysql_history
</code>
if it exists. Then use
either of the following techniques to prevent it from being
created again:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Set the
<code class="literal">
MYSQL_HISTFILE
</code>
environment
variable to
<code class="filename">
/dev/null
</code>
. To cause this
setting to take effect each time you log in, put it in one
of your shell's startup files.
</p>
</li>
<li class="listitem">
<p>
Create
<code class="filename">
.mysql_history
</code>
as a symbolic
link to
<code class="filename">
/dev/null
</code>
; this need be done
only once:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa90384572"><div class="copy-help left">Press ⌘+C to 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">ln <span class="token property">-s</span> /dev/null $HOME/<span class="token punctuation">.</span>mysql_history</code></pre>
</div>
</li>
</ul>
</div>
<h5>
<a name="mysql-logging-syslog">
</a>
syslog Logging Characteristics
</h5>
<p>
If the
<code class="option">
--syslog
</code>
option is given,
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
writes interactive statements to the
system logging facility. Message logging has the following
characteristics.
</p>
<p>
Logging occurs at the
<span class="quote">
“
<span class="quote">
information
</span>
”
</span>
level. This
corresponds to the
<code class="literal">
LOG_INFO
</code>
priority for
<code class="literal">
syslog
</code>
on Unix/Linux
<code class="literal">
syslog
</code>
capability and to
<code class="literal">
EVENTLOG_INFORMATION_TYPE
</code>
for the Windows
Event Log. Consult your system documentation for configuration
of your logging capability.
</p>
<p>
Message size is limited to 1024 bytes.
</p>
<p>
Messages consist of the identifier
<code class="literal">
MysqlClient
</code>
followed by these values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
SYSTEM_USER
</code>
</p>
<p>
The operating system user name (login name) or
<code class="literal">
--
</code>
if the user is unknown.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MYSQL_USER
</code>
</p>
<p>
The MySQL user name (specified with the
<a class="link" href="mysql-command-options.html#option_mysql_user">
<code class="option">
--user
</code>
</a>
option) or
<code class="literal">
--
</code>
if the user is unknown.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
CONNECTION_ID
</code>
:
</p>
<p>
The client connection identifier. This is the same as the
<a class="link" href="information-functions.html#function_connection-id">
<code class="literal">
CONNECTION_ID()
</code>
</a>
function
value within the session.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DB_SERVER
</code>
</p>
<p>
The server host or
<code class="literal">
--
</code>
if the host is
unknown.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DB
</code>
</p>
<p>
The default database or
<code class="literal">
--
</code>
if no database
has been selected.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
QUERY
</code>
</p>
<p>
The text of the logged statement.
</p>
</li>
</ul>
</div>
<p>
Here is a sample of output generated on Linux by using
<code class="option">
--syslog
</code>
. This output is formatted for
readability; each logged message actually takes a single line.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa93889284"><div class="copy-help left">Press ⌘+C to 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">Mar 7 12:39:25 myhost MysqlClient[20824]:
SYSTEM_USER:'oscar', MYSQL_USER:'my_oscar', CONNECTION_ID:23,
DB_SERVER:'127.0.0.1', DB:'--', QUERY:'USE test;'
Mar 7 12:39:28 myhost MysqlClient[20824]:
SYSTEM_USER:'oscar', MYSQL_USER:'my_oscar', CONNECTION_ID:23,
DB_SERVER:'127.0.0.1', DB:'test', QUERY:'SHOW TABLES;'</code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/choosing-types.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="choosing-types">
</a>
13.8 Choosing the Right Type for a Column
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045210391008">
</a>
<a class="indexterm" name="idm46045210389552">
</a>
<p>
For optimum storage, you should try to use the most precise type
in all cases. For example, if an integer column is used for values
in the range from
<code class="literal">
1
</code>
to
<code class="literal">
99999
</code>
,
<code class="literal">
MEDIUMINT UNSIGNED
</code>
is
the best type. Of the types that represent all the required
values, this type uses the least amount of storage.
</p>
<p>
All basic calculations (
<code class="literal">
+
</code>
,
<code class="literal">
-
</code>
,
<code class="literal">
*
</code>
, and
<code class="literal">
/
</code>
) with
<a class="link" href="fixed-point-types.html" title="13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC">
<code class="literal">
DECIMAL
</code>
</a>
columns are done with precision of 65 decimal (base 10) digits.
See
<a class="xref" href="numeric-type-syntax.html" title="13.1.1 Numeric Data Type Syntax">
Section 13.1.1, “Numeric Data Type Syntax”
</a>
.
</p>
<p>
If accuracy is not too important or if speed is the highest
priority, the
<a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
<code class="literal">
DOUBLE
</code>
</a>
type may be
good enough. For high precision, you can always convert to a
fixed-point type stored in a
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
. This enables you to do all
calculations with 64-bit integers and then convert results back to
floating-point values as necessary.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/error-log-syslog.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="error-log-syslog">
</a>
7.4.2.8 Error Logging to the System Log
</h4>
</div>
</div>
</div>
<p>
It is possible to have
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
write the error
log to the system log (the Event Log on Windows, and
<code class="literal">
syslog
</code>
on Unix and Unix-like systems).
</p>
<p>
This section describes how to configure error logging using the
built-in filter,
<code class="literal">
log_filter_internal
</code>
, and the
system log sink,
<code class="literal">
log_sink_syseventlog
</code>
, to
take effect immediately and for subsequent server startups. For
general information about configuring error logging, see
<a class="xref" href="error-log-configuration.html" title="7.4.2.1 Error Log Configuration">
Section 7.4.2.1, “Error Log Configuration”
</a>
.
</p>
<p>
To enable the system log sink, first load the sink component,
then modify the
<a class="link" href="server-system-variables.html#sysvar_log_error_services">
<code class="literal">
log_error_services
</code>
</a>
value:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34413556"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">INSTALL</span> <span class="token keyword">COMPONENT</span> <span class="token string">'file://component_log_sink_syseventlog'</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token keyword">PERSIST</span> log_error_services <span class="token operator">=</span> <span class="token string">'log_filter_internal; log_sink_syseventlog'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
To set
<a class="link" href="server-system-variables.html#sysvar_log_error_services">
<code class="literal">
log_error_services
</code>
</a>
to
take effect at server startup, use the instructions at
<a class="xref" href="error-log-configuration.html" title="7.4.2.1 Error Log Configuration">
Section 7.4.2.1, “Error Log Configuration”
</a>
. Those instructions
apply to other error-logging system variables as well.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Error logging to the system log may require additional system
configuration. Consult the system log documentation for your
platform.
</p>
</div>
<p>
On Windows, error messages written to the Event Log within the
Application log have these characteristics:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Entries marked as
<code class="literal">
Error
</code>
,
<code class="literal">
Warning
</code>
, and
<code class="literal">
Note
</code>
are
written to the Event Log, but not messages such as
information statements from individual storage engines.
</p>
</li>
<li class="listitem">
<p>
Event Log entries have a source of
<code class="literal">
MySQL
</code>
(or
<code class="literal">
MySQL-
<em class="replaceable">
<code>
tag
</code>
</em>
</code>
if
<a class="link" href="server-system-variables.html#sysvar_syseventlog.tag">
<code class="literal">
syseventlog.tag
</code>
</a>
is
defined as
<em class="replaceable">
<code>
tag
</code>
</em>
).
</p>
</li>
</ul>
</div>
<p>
On Unix and Unix-like systems, logging to the system log uses
<code class="literal">
syslog
</code>
. The following system variables affect
<code class="literal">
syslog
</code>
messages:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_syseventlog.facility">
<code class="literal">
syseventlog.facility
</code>
</a>
: The
default facility for
<code class="literal">
syslog
</code>
messages is
<code class="literal">
daemon
</code>
. Set this variable to specify a
different facility.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_syseventlog.include_pid">
<code class="literal">
syseventlog.include_pid
</code>
</a>
:
Whether to include the server process ID in each line of
<code class="literal">
syslog
</code>
output.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_syseventlog.tag">
<code class="literal">
syseventlog.tag
</code>
</a>
: This
variable defines a tag to add to the server identifier
(
<code class="literal">
mysqld
</code>
) in
<code class="literal">
syslog
</code>
messages. If defined, the tag is appended to the identifier
with a leading hyphen.
</p>
</li>
</ul>
</div>
<p>
MySQL uses the custom label
<span class="quote">
“
<span class="quote">
System
</span>
”
</span>
for important
system messages about non-error situations, such as startup,
shutdown, and some significant changes to settings. In logs that
do not support custom labels, including the Event Log on
Windows, and
<code class="literal">
syslog
</code>
on Unix and Unix-like
systems, system messages are assigned the label used for the
information priority level. However, these messages are printed
to the log even if the MySQL
<a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
<code class="literal">
log_error_verbosity
</code>
</a>
setting
normally excludes messages at the information level.
</p>
<p>
When a log sink must fall back to a label of
<span class="quote">
“
<span class="quote">
Information
</span>
”
</span>
instead of
<span class="quote">
“
<span class="quote">
System
</span>
”
</span>
in
this way, and the log event is further processed outside of the
MySQL server (for example, filtered or forwarded by a
<code class="literal">
syslog
</code>
configuration), these events may by
default be processed by the secondary application as being of
<span class="quote">
“
<span class="quote">
Information
</span>
”
</span>
priority rather than
<span class="quote">
“
<span class="quote">
System
</span>
”
</span>
priority.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/show-create-view.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="show-create-view">
</a>
15.7.7.14 SHOW CREATE VIEW Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045170770096">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa45864858"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CREATE</span> <span class="token keyword">VIEW</span> <em class="replaceable">view_name</em></code></pre>
</div>
<p>
This statement shows the
<a class="link" href="create-view.html" title="15.1.23 CREATE VIEW Statement">
<code class="literal">
CREATE
VIEW
</code>
</a>
statement that creates the named view.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63683954"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">VIEW</span> v\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>
View<span class="token punctuation">:</span> v
Create View<span class="token punctuation">:</span> CREATE ALGORITHM=UNDEFINED
DEFINER=`bob`@`localhost`
SQL SECURITY DEFINER VIEW
`v` AS select 1 AS `a`,2 AS `b`
character_set_client<span class="token punctuation">:</span> utf8mb4
collation_connection<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 view 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 view was created.
</p>
<p>
Use of
<a class="link" href="show-create-view.html" title="15.7.7.14 SHOW CREATE VIEW Statement">
<code class="literal">
SHOW CREATE VIEW
</code>
</a>
requires
the
<a class="link" href="privileges-provided.html#priv_show-view">
<code class="literal">
SHOW VIEW
</code>
</a>
privilege, and the
<a class="link" href="privileges-provided.html#priv_select">
<code class="literal">
SELECT
</code>
</a>
privilege for the view in
question.
</p>
<p>
View information is also available from the
<code class="literal">
INFORMATION_SCHEMA
</code>
<a class="link" href="information-schema-views-table.html" title="28.3.47 The INFORMATION_SCHEMA VIEWS Table">
<code class="literal">
VIEWS
</code>
</a>
table. See
<a class="xref" href="information-schema-views-table.html" title="28.3.47 The INFORMATION_SCHEMA VIEWS Table">
Section 28.3.47, “The INFORMATION_SCHEMA VIEWS Table”
</a>
.
</p>
<p>
MySQL lets you use different
<a class="link" href="server-system-variables.html#sysvar_sql_mode">
<code class="literal">
sql_mode
</code>
</a>
settings to tell the
server the type of SQL syntax to support. For example, you might
use the
<a class="link" href="sql-mode.html#sqlmode_ansi">
<code class="literal">
ANSI
</code>
</a>
SQL mode to
ensure MySQL correctly interprets the standard SQL concatenation
operator, the double bar (
<code class="literal">
||
</code>
), in your
queries. If you then create a view that concatenates items, you
might worry that changing the
<a class="link" href="server-system-variables.html#sysvar_sql_mode">
<code class="literal">
sql_mode
</code>
</a>
setting to a value
different from
<a class="link" href="sql-mode.html#sqlmode_ansi">
<code class="literal">
ANSI
</code>
</a>
could
cause the view to become invalid. But this is not the case. No
matter how you write out a view definition, MySQL always stores
it the same way, in a canonical form. Here is an example that
shows how the server changes a double bar concatenation operator
to a
<a class="link" href="string-functions.html#function_concat">
<code class="literal">
CONCAT()
</code>
</a>
function:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa3247904"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> sql_mode <span class="token operator">=</span> <span class="token string">'ANSI'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">VIEW</span> test<span class="token punctuation">.</span>v <span class="token keyword">AS</span> <span class="token keyword">SELECT</span> <span class="token string">'a'</span> <span class="token operator">||</span> <span class="token string">'b'</span> <span class="token keyword">as</span> col1<span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.01 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">CREATE</span> <span class="token keyword">VIEW</span> test<span class="token punctuation">.</span>v\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>
View<span class="token punctuation">:</span> v
Create View<span class="token punctuation">:</span> CREATE VIEW "v" AS select concat('a','b') AS "col1"
...
</span><span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
The advantage of storing a view definition in canonical form is
that changes made later to the value of
<a class="link" href="server-system-variables.html#sysvar_sql_mode">
<code class="literal">
sql_mode
</code>
</a>
do not affect the
results from the view. However an additional consequence is that
comments prior to
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
are
stripped from the definition by the server.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-getting-started.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="group-replication-getting-started">
</a>
20.2 Getting Started
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="group-replication-deploying-in-single-primary-mode.html">
20.2.1 Deploying Group Replication in Single-Primary Mode
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-deploying-locally.html">
20.2.2 Deploying Group Replication Locally
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045134299280">
</a>
<p>
MySQL Group Replication is provided as a plugin for the MySQL
server; each server in a group requires configuration and
installation of the plugin. This section provides a detailed
tutorial with the steps required to create a replication group with
at least three members.
</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Tip
</div>
<p>
To deploy multiple instances of MySQL, you can use
<a class="ulink" href="/doc/mysql-shell/8.4/en/mysql-innodb-cluster.html" target="_top">
InnoDB Cluster
</a>
which enables you to easily administer a group of MySQL server instances in
<a class="ulink" href="/doc/mysql-shell/8.4/en/" target="_top">
MySQL Shell
</a>
. InnoDB Cluster wraps MySQL Group Replication in a programmatic environment that enables you easily deploy a cluster of MySQL instances to achieve high availability. In addition, InnoDB Cluster interfaces seamlessly with
<a class="ulink" href="/doc/mysql-router/8.4/en/" target="_top">
MySQL Router
</a>
, which enables your applications to connect to the cluster without writing your own failover process. For similar use cases that do not require high availability, however, you can use
<a class="ulink" href="/doc/mysql-shell/8.4/en/mysql-innodb-replicaset.html" target="_top">
InnoDB ReplicaSet
</a>
. Installation instructions for MySQL Shell can be found
<a class="ulink" href="/doc/mysql-shell/8.4/en/mysql-shell-install.html" target="_top">
here
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/federated-storage-engine.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="federated-storage-engine">
</a>
18.8 The FEDERATED Storage Engine
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="federated-description.html">
18.8.1 FEDERATED Storage Engine Overview
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="federated-create.html">
18.8.2 How to Create FEDERATED Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="federated-usagenotes.html">
18.8.3 FEDERATED Storage Engine Notes and Tips
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="federated-storage-engine-resources.html">
18.8.4 FEDERATED Storage Engine Resources
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045147213952">
</a>
<a class="indexterm" name="idm46045147212864">
</a>
<p>
The
<code class="literal">
FEDERATED
</code>
storage engine lets you access data
from a remote MySQL database without using replication or cluster
technology. Querying a local
<code class="literal">
FEDERATED
</code>
table
automatically pulls the data from the remote (federated) tables. No
data is stored on the local tables.
</p>
<p>
To include the
<code class="literal">
FEDERATED
</code>
storage engine if you
build MySQL from source, invoke
<span class="command">
<strong>
CMake
</strong>
</span>
with the
<a class="link" href="source-configuration-options.html#option_cmake_storage_engine_options" title="Storage Engine Options">
<code class="option">
-DWITH_FEDERATED_STORAGE_ENGINE
</code>
</a>
option.
</p>
<p>
The
<code class="literal">
FEDERATED
</code>
storage engine is not enabled by
default in the running server; to enable
<code class="literal">
FEDERATED
</code>
, you must start the MySQL server binary
using the
<code class="option">
--federated
</code>
option.
</p>
<p>
To examine the source for the
<code class="literal">
FEDERATED
</code>
engine,
look in the
<code class="filename">
storage/federated
</code>
directory of a
MySQL source distribution.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/insert-delayed.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="insert-delayed">
</a>
15.2.7.3 INSERT DELAYED Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045182050400">
</a>
<a class="indexterm" name="idm46045182049360">
</a>
<a class="indexterm" name="idm46045182048288">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa14702674"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">INSERT</span> <span class="token keyword">DELAYED</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
</div>
<p>
The
<code class="literal">
DELAYED
</code>
option for the
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statement is a MySQL
extension to standard SQL. In previous versions of MySQL, it can
be used for certain kinds of tables (such as
<code class="literal">
MyISAM
</code>
), such that when a client uses
<a class="link" href="insert-delayed.html" title="15.2.7.3 INSERT DELAYED Statement">
<code class="literal">
INSERT DELAYED
</code>
</a>
, it gets an okay
from the server at once, and the row is queued to be inserted
when the table is not in use by any other thread.
</p>
<p>
<code class="literal">
DELAYED
</code>
inserts and replaces were deprecated
in MySQL 5.6. In MySQL 8.4,
<code class="literal">
DELAYED
</code>
is not supported. The server
recognizes but ignores the
<code class="literal">
DELAYED
</code>
keyword,
handles the insert as a nondelayed insert, and generates an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_warn_legacy_syntax_converted" target="_top">
<code class="literal">
ER_WARN_LEGACY_SYNTAX_CONVERTED
</code>
</a>
warning:
<span class="errortext">
INSERT DELAYED is no longer supported. The
statement was converted to INSERT
</span>
. The
<code class="literal">
DELAYED
</code>
keyword is scheduled for removal in a
future release.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/monitoring-performance-schema.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="monitoring-performance-schema">
</a>
10.13.3 Measuring Performance with performance_schema
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045222060256">
</a>
<p>
You can query the tables in the
<code class="literal">
performance_schema
</code>
database to see real-time
information about the performance characteristics of your server
and the applications it is running. See
<a class="xref" href="performance-schema.html" title="Chapter 29 MySQL Performance Schema">
Chapter 29,
<i>
MySQL Performance Schema
</i>
</a>
for details.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-solutions-unexpected-replica-halt.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="replication-solutions-unexpected-replica-halt">
</a>
19.4.2 Handling an Unexpected Halt of a Replica
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045136674160">
</a>
<a class="indexterm" name="idm46045136673088">
</a>
<a class="indexterm" name="idm46045136671600">
</a>
<p>
In order for replication to be resilient to unexpected halts of
the server (sometimes described as crash-safe) it must be possible
for the replica to recover its state before halting. This section
describes the impact of an unexpected halt of a replica during
replication, and how to configure a replica for the best chance of
recovery to continue replication.
</p>
<p>
After an unexpected halt of a replica, upon restart the
replication SQL thread must recover information about which
transactions have been executed already. The information required
for recovery is stored in the replica's applier metadata
repository. This repository is created by default as an
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
table named
<code class="literal">
mysql.slave_relay_log_info
</code>
. By using this
transactional storage engine the information is always recoverable
upon restart. Updates to the applier metadata repository are
committed together with the transactions, meaning that the
replica's progress information recorded in that repository is
always consistent with what has been applied to the database, even
in the event of an unexpected server halt. For more information on
the applier metadata repository, see
<a class="xref" href="replica-logs.html" title="19.2.4 Relay Log and Replication Metadata Repositories">
Section 19.2.4, “Relay Log and Replication Metadata Repositories”
</a>
.
</p>
<p>
DML transactions and also atomic DDL update the replication
positions in the replica's applier metadata repository in the
<code class="literal">
mysql.slave_relay_log_info
</code>
table together with
applying the changes to the database, as an atomic operation. In
all other cases, including DDL statements that are not fully
atomic, and exempted storage engines that do not support atomic
DDL, the
<code class="literal">
mysql.slave_relay_log_info
</code>
table might
be missing updates associated with replicated data if the server
halts unexpectedly. Restoring updates in this case is a manual
process. For details on atomic DDL support in MySQL
8.4, and the resulting behavior for the replication
of certain statements, see
<a class="xref" href="atomic-ddl.html" title="15.1.1 Atomic Data Definition Statement Support">
Section 15.1.1, “Atomic Data Definition Statement Support”
</a>
.
</p>
<p>
The recovery process by which a replica recovers from an
unexpected halt varies depending on the configuration of the
replica. The details of the recovery process are influenced by the
chosen method of replication, whether the replica is
single-threaded or multithreaded, and the setting of relevant
system variables. The overall aim of the recovery process is to
identify what transactions had already been applied on the
replica's database before the unexpected halt occurred, and
retrieve and apply the transactions that the replica missed
following the unexpected halt.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For GTID-based replication, the recovery process needs the
GTIDs of the transactions that were already received or
committed by the replica. The missing transactions can be
retrieved from the source using GTID auto-positioning, which
automatically compares the source's transactions to the
replica's transactions and identifies the missing
transactions.
</p>
</li>
<li class="listitem">
<p>
For file position based replication, the recovery process
needs an accurate replication SQL thread (applier) position
showing the last transaction that was applied on the replica.
Based on that position, the replication I/O thread (receiver)
retrieves from the source's binary log all of the transactions
that should be applied on the replica from that point on.
</p>
</li>
</ul>
</div>
<p>
Using GTID-based replication makes it easiest to configure
replication to be resilient to unexpected halts. GTID
auto-positioning means the replica can reliably identify and
retrieve missing transactions, even if there are gaps in the
sequence of applied transactions.
</p>
<p>
The following information provides combinations of settings that
are appropriate for different types of replica to guarantee
recovery as far as this is under the control of replication.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
Some factors outside the control of replication can have an
impact on the replication recovery process and the overall state
of replication after the recovery process. In particular, the
settings that influence the recovery process for individual
storage engines might result in transactions being lost in the
event of an unexpected halt of a replica, and therefore
unavailable to the replication recovery process. The
<a class="link" href="innodb-parameters.html#sysvar_innodb_flush_log_at_trx_commit">
<code class="literal">
innodb_flush_log_at_trx_commit=1
</code>
</a>
setting mentioned in the list below is a key setting for a
replication setup that uses
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
with transactions. However, other settings specific to
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
or to other storage engines,
especially those relating to flushing or synchronization, can
also have an impact. Always check for and apply recommendations
made by your chosen storage engines about crash-safe settings.
</p>
</div>
<p>
The following combination of settings on a replica is the most
resilient to unexpected halts:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
When GTID-based replication is in use
(
<a class="link" href="replication-options-gtids.html#sysvar_gtid_mode">
<code class="literal">
gtid_mode=ON
</code>
</a>
), set
<code class="literal">
SOURCE_AUTO_POSITION=1
</code>
, which activates
GTID auto-positioning for the connection to the source to
automatically identify and retrieve missing transactions. This
option is set using a
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE REPLICATION
SOURCE TO
</code>
</a>
statement. If the replica has multiple
replication channels, you need to set this option for each
channel individually. For details of how GTID auto-positioning
works, see
<a class="xref" href="replication-gtids-auto-positioning.html" title="19.1.3.3 GTID Auto-Positioning">
Section 19.1.3.3, “GTID Auto-Positioning”
</a>
. When
file position based replication is in use,
<code class="literal">
SOURCE_AUTO_POSITION=1
</code>
is not used, and
instead the binary log position or relay log position is used
to control where replication starts.
</p>
</li>
<li class="listitem">
<p>
When GTID-based replication is in use
(
<a class="link" href="replication-options-gtids.html#sysvar_gtid_mode">
<code class="literal">
gtid_mode=ON
</code>
</a>
), set
<code class="literal">
GTID_ONLY=1
</code>
, which makes the replica use
only GTIDs in the recovery process, and stop persisting binary
log and relay log file names and file positions in the
replication metadata repositories. This option is set using a
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE REPLICATION SOURCE TO
</code>
</a>
statement. If the replica has multiple replication channels,
you need to set this option for each channel individually.
With
<code class="literal">
GTID_ONLY=1
</code>
, during recovery, the file
position information is ignored and GTID auto-skip is used to
skip transactions that have already been supplied, rather than
identifying the correct file position. This strategy is more
efficient provided that you purge relay logs using the default
setting for
<a class="link" href="replication-options-replica.html#sysvar_relay_log_purge">
<code class="literal">
relay_log_purge
</code>
</a>
,
which means only one relay log file needs to be inspected.
</p>
</li>
<li class="listitem">
<p>
Set
<a class="link" href="replication-options-replica.html#sysvar_sync_relay_log">
<code class="literal">
sync_relay_log=1
</code>
</a>
, which
instructs the replication receiver thread to synchronize the
relay log to disk after each received transaction is written
to it. This means the replica's record of the current position
read from the source's binary log (in the applier metadata
repository) is never ahead of the record of transactions saved
in the relay log. Note that although this setting is the
safest, it is also the slowest due to the number of disk
writes involved. With
<code class="literal">
sync_relay_log > 1
</code>
,
or
<code class="literal">
sync_relay_log=0
</code>
(where synchronization
is handled by the operating system), in the event of an
unexpected halt of a replica there might be committed
transactions that have not been synchronized to disk. Such
transactions can cause the recovery process to fail if the
recovering replica, based on the information it has in the
relay log as last synchronized to disk, tries to retrieve and
apply the transactions again instead of skipping them. Setting
<code class="literal">
sync_relay_log=1
</code>
is particularly important
for a multi-threaded replica, where the recovery process fails
if gaps in the sequence of transactions cannot be filled using
the information in the relay log. For a single-threaded
replica, the recovery process only needs to use the relay log
if the relevant information is not available in the applier
metadata repository.
</p>
</li>
<li class="listitem">
<p>
Set
<a class="link" href="innodb-parameters.html#sysvar_innodb_flush_log_at_trx_commit">
<code class="literal">
innodb_flush_log_at_trx_commit=1
</code>
</a>
,
which synchronizes the
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
logs to disk before each transaction is committed. This
setting, which is the default, ensures that
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
tables and the
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
logs are saved on disk so
that there is no longer a requirement for the information in
the relay log regarding the transaction. Combined with the
setting
<a class="link" href="replication-options-replica.html#sysvar_sync_relay_log">
<code class="literal">
sync_relay_log=1
</code>
</a>
,
this setting further ensures that the content of the
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
tables and the
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
logs is consistent with
the content of the relay log at all times, so that purging the
relay log files cannot cause unfillable gaps in the replica's
history of transactions in the event of an unexpected halt.
</p>
</li>
<li class="listitem">
<p>
Set
<a class="ulink" href="/doc/refman/8.0/en/replication-options-replica.html#sysvar_relay_log_info_repository" target="_top">
<code class="literal">
relay_log_info_repository =
TABLE
</code>
</a>
, which stores the replication SQL thread
position in the
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
table
<code class="literal">
mysql.slave_relay_log_info
</code>
, and updates it
together with the transaction commit to ensure a record that
is always accurate. This setting is the default;
<code class="literal">
FILE
</code>
is deprecated. The system variable
itself is also deprecated, so omit it and allow it to assume
the default. If
<code class="literal">
FILE
</code>
is used, the
information is stored in a file in the data directory that is
updated after the transaction has been applied. This creates a
risk of losing synchrony with the source depending at which
stage of processing a transaction the replica halts at, or
even corruption of the file itself. With
<a class="ulink" href="/doc/refman/8.0/en/replication-options-replica.html#sysvar_relay_log_info_repository" target="_top">
<code class="literal">
relay_log_info_repository =
FILE
</code>
</a>
, recovery is not guaranteed.
</p>
</li>
<li class="listitem">
<p>
Set
<a class="link" href="replication-options-replica.html#sysvar_relay_log_recovery">
<code class="literal">
relay_log_recovery = ON
</code>
</a>
,
which enables automatic relay log recovery immediately
following server startup. This global variable defaults to
<code class="literal">
OFF
</code>
and is read-only at runtime, but you
can set it to
<code class="literal">
ON
</code>
with the
<a class="link" href="replication-options-replica.html#sysvar_relay_log_recovery">
<code class="option">
--relay-log-recovery
</code>
</a>
option at
replica startup following an unexpected halt of a replica.
Note that this setting ignores the existing relay log files,
in case they are corrupted or inconsistent. The relay log
recovery process starts a new relay log file and fetches
transactions from the source beginning at the replication SQL
thread position recorded in the applier metadata repository.
The previous relay log files are removed over time by the
replica's normal purge mechanism.
</p>
</li>
</ul>
</div>
<p>
For a multithreaded replica, setting
<a class="link" href="replication-options-replica.html#sysvar_relay_log_recovery">
<code class="literal">
relay_log_recovery = ON
</code>
</a>
automatically handles any inconsistencies and gaps in the sequence
of transactions that have been executed from the relay log. These
gaps can occur when file position based replication is in use.
(For more details, see
<a class="xref" href="replication-features-transaction-inconsistencies.html" title="19.5.1.34 Replication and Transaction Inconsistencies">
Section 19.5.1.34, “Replication and Transaction Inconsistencies”
</a>
.)
The relay log recovery process deals with gaps using the same
method as the
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START
REPLICA UNTIL SQL_AFTER_MTS_GAPS
</code>
</a>
statement would. When
the replica reaches a consistent gap-free state, the relay log
recovery process goes on to fetch further transactions from the
source beginning at the replication SQL thread position. When
GTID-based replication is in use, a multithreaded replica checks
first whether
<code class="literal">
SOURCE_AUTO_POSITION
</code>
is set to
<code class="literal">
ON
</code>
, and if it is, omits the step of calculating
the transactions that should be skipped or not skipped, so that
the old relay logs are not required for the recovery process.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-statements-replica.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="replication-statements-replica">
</a>
15.4.2 SQL Statements for Controlling Replica Servers
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="change-replication-filter.html">
15.4.2.1 CHANGE REPLICATION FILTER Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="change-replication-source-to.html">
15.4.2.2 CHANGE REPLICATION SOURCE TO Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="reset-replica.html">
15.4.2.3 RESET REPLICA Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="start-replica.html">
15.4.2.4 START REPLICA Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="stop-replica.html">
15.4.2.5 STOP REPLICA Statement
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045177772656">
</a>
<a class="indexterm" name="idm46045177771168">
</a>
<a class="indexterm" name="idm46045177769680">
</a>
<p>
This section discusses statements for managing replica servers.
<a class="xref" href="replication-statements-source.html" title="15.4.1 SQL Statements for Controlling Source Servers">
Section 15.4.1, “SQL Statements for Controlling Source Servers”
</a>
, discusses
statements for managing source servers.
</p>
<p>
In addition to the statements described here,
<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
<a class="link" href="show-relaylog-events.html" title="15.7.7.34 SHOW RELAYLOG EVENTS Statement">
<code class="literal">
SHOW RELAYLOG
EVENTS
</code>
</a>
are also used with replicas. For information
about these statements, see
<a class="xref" href="show-replica-status.html" title="15.7.7.35 SHOW REPLICA STATUS Statement">
Section 15.7.7.35, “SHOW REPLICA STATUS Statement”
</a>
,
and
<a class="xref" href="show-relaylog-events.html" title="15.7.7.34 SHOW RELAYLOG EVENTS Statement">
Section 15.7.7.34, “SHOW RELAYLOG EVENTS Statement”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-tp-thread-state-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-tp-thread-state-table">
</a>
28.5.4 The INFORMATION_SCHEMA TP_THREAD_STATE Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045076035008">
</a>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<code class="literal">
INFORMATION_SCHEMA
</code>
thread pool tables are
deprecated, and subject to removal in a future version of MySQL.
You should use the versions available as Performance Schema
tables instead. 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>
.
Applications should transition away from the old tables to the
new 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="sa414742"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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="sa64416509"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>
</div>
<p>
The
<code class="literal">
TP_THREAD_STATE
</code>
table has one row per
thread created by the thread pool to handle connections.
</p>
<p>
For descriptions of the columns in the
<code class="literal">
INFORMATION_SCHEMA
</code>
<code class="literal">
TP_THREAD_STATE
</code>
table, see
<a class="xref" href="performance-schema-tp-thread-state-table.html" title="29.12.16.4 The tp_thread_state Table">
Section 29.12.16.4, “The tp_thread_state Table”
</a>
. The
Performance Schema
<a class="link" href="performance-schema-tp-thread-state-table.html" title="29.12.16.4 The tp_thread_state Table">
<code class="literal">
tp_thread_state
</code>
</a>
table has equivalent columns.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-programs-ndb-select-count.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-programs-ndb-select-count">
</a>
25.5.26 ndb_select_count — Print Row Counts for NDB Tables
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045097476608">
</a>
<p>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html" title="25.5.26 ndb_select_count — Print Row Counts for NDB Tables">
<span class="command">
<strong>
ndb_select_count
</strong>
</span>
</a>
prints the number of rows in
one or more
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables. With a
single table, the result is equivalent to that obtained by using
the MySQL statement
<code class="literal">
SELECT COUNT(*) FROM
<em class="replaceable">
<code>
tbl_name
</code>
</em>
</code>
.
</p>
<h4>
<a name="idm46045097471520">
</a>
Usage
</h4>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa88719491"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">ndb_select_count <span class="token punctuation">[</span><span class="token property">-c</span> <em class="replaceable">connection_string</em><span class="token punctuation">]</span> <span class="token property">-d<em class="replaceable">db_name</em></span> <em class="replaceable">tbl_name</em><span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">tbl_name2</em><span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">]</span><span class="token punctuation">]</span></code></pre>
</div>
<p>
Options that can be used with
<a class="link" href="mysql-cluster-programs-ndb-select-count.html" title="25.5.26 ndb_select_count — Print Row Counts for NDB Tables">
<span class="command">
<strong>
ndb_select_count
</strong>
</span>
</a>
are shown in the following
table. Additional descriptions follow the table.
</p>
<p>
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="option_ndb_select_count_character-sets-dir">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_character-sets-dir">
<code class="option">
--character-sets-dir
</code>
</a>
</p>
<a class="indexterm" name="idm46045097463296">
</a>
<a class="indexterm" name="idm46045097461792">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for character-sets-dir">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--character-sets-dir=path
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Directory containing character sets.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_connect-retries">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_connect-retries">
<code class="option">
--connect-retries
</code>
</a>
</p>
<a class="indexterm" name="idm46045097452064">
</a>
<a class="indexterm" name="idm46045097450576">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for connect-retries">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--connect-retries=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
12
</code>
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
0
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
12
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Number of times to retry connection before giving up.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_connect-retry-delay">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_connect-retry-delay">
<code class="option">
--connect-retry-delay
</code>
</a>
</p>
<a class="indexterm" name="idm46045097431344">
</a>
<a class="indexterm" name="idm46045097429840">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for connect-retry-delay">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--connect-retry-delay=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
5
</code>
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
0
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
5
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Number of seconds to wait between attempts to contact
management server.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_connect-string">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_connect-string">
<code class="option">
--connect-string
</code>
</a>
</p>
<a class="indexterm" name="idm46045097410720">
</a>
<a class="indexterm" name="idm46045097409232">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for connect-string">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--connect-string=connection_string
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Same as
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_core-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_core-file">
<code class="option">
--core-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045097393840">
</a>
<a class="indexterm" name="idm46045097392352">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for core-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--core-file
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Write core file on error; used in debugging.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_defaults-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_defaults-file">
<code class="option">
--defaults-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045097382576">
</a>
<a class="indexterm" name="idm46045097381088">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for defaults-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--defaults-file=path
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Read default options from given file only.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_defaults-extra-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_defaults-extra-file">
<code class="option">
--defaults-extra-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045097366736">
</a>
<a class="indexterm" name="idm46045097365232">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for defaults-extra-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--defaults-extra-file=path
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Read given file after global files are read.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_defaults-group-suffix">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_defaults-group-suffix">
<code class="option">
--defaults-group-suffix
</code>
</a>
</p>
<a class="indexterm" name="idm46045097350864">
</a>
<a class="indexterm" name="idm46045097349360">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for defaults-group-suffix">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--defaults-group-suffix=string
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Also read groups with concat(group, suffix).
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_login-path">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_login-path">
<code class="option">
--login-path
</code>
</a>
</p>
<a class="indexterm" name="idm46045097335136">
</a>
<a class="indexterm" name="idm46045097333648">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for login-path">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--login-path=path
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Read given path from login file.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_no-login-paths">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_no-login-paths">
<code class="option">
--no-login-paths
</code>
</a>
</p>
<a class="indexterm" name="idm46045097319376">
</a>
<a class="indexterm" name="idm46045097317888">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for no-login-paths">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--no-login-paths
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Skips reading options from the login path file.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_help">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_help">
<code class="option">
--help
</code>
</a>
</p>
<a class="indexterm" name="idm46045097308112">
</a>
<a class="indexterm" name="idm46045097306624">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for help">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--help
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Display help text and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_ndb-connectstring">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
</p>
<a class="indexterm" name="idm46045097296976">
</a>
<a class="indexterm" name="idm46045097295472">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-connectstring">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-connectstring=connection_string
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Set connection string for connecting to
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
<span class="command">
<strong>
ndb_mgmd
</strong>
</span>
</a>
. Syntax:
<code class="literal">
[nodeid=
<em class="replaceable">
<code>
id
</code>
</em>
;][host=]
<em class="replaceable">
<code>
hostname
</code>
</em>
[:
<em class="replaceable">
<code>
port
</code>
</em>
]
</code>
.
Overrides entries in
<code class="literal">
NDB_CONNECTSTRING
</code>
and
<code class="filename">
my.cnf
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_ndb-mgm-tls">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_ndb-mgm-tls">
<code class="option">
--ndb-mgm-tls
</code>
</a>
</p>
<a class="indexterm" name="idm46045097276496">
</a>
<a class="indexterm" name="idm46045097275008">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-mgm-tls">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-mgm-tls=level
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Enumeration
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
relaxed
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
relaxed
</code>
</p>
<p class="valid-value">
<code class="literal">
strict
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Sets the level of TLS support required to connect to the
management server; one of
<code class="literal">
relaxed
</code>
or
<code class="literal">
strict
</code>
.
<code class="literal">
relaxed
</code>
(the
default) means that a TLS connection is attempted, but
success is not required;
<code class="literal">
strict
</code>
means
that TLS is required to connect.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_ndb-mgmd-host">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_ndb-mgmd-host">
<code class="option">
--ndb-mgmd-host
</code>
</a>
</p>
<a class="indexterm" name="idm46045097253952">
</a>
<a class="indexterm" name="idm46045097252464">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-mgmd-host">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-mgmd-host=connection_string
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Same as
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_ndb-nodeid">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_ndb-nodeid">
<code class="option">
--ndb-nodeid
</code>
</a>
</p>
<a class="indexterm" name="idm46045097237248">
</a>
<a class="indexterm" name="idm46045097235760">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-nodeid">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-nodeid=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Set node ID for this node, overriding any ID set by
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_ndb-optimized-node-selection">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_ndb-optimized-node-selection">
<code class="option">
--ndb-optimized-node-selection
</code>
</a>
</p>
<a class="indexterm" name="idm46045097220352">
</a>
<a class="indexterm" name="idm46045097218848">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-optimized-node-selection">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-optimized-node-selection
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Enable optimizations for selection of nodes for
transactions. Enabled by default; use
<code class="option">
--skip-ndb-optimized-node-selection
</code>
to
disable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_ndb-tls-search-path">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_ndb-tls-search-path">
<code class="option">
--ndb-tls-search-path
</code>
</a>
</p>
<a class="indexterm" name="idm46045097208528">
</a>
<a class="indexterm" name="idm46045097207024">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-tls-search-path">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-tls-search-path=list
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Path name
</td>
</tr>
<tr>
<th>
Default Value (Unix)
</th>
<td>
<code class="literal">
$HOME/ndb-tls
</code>
</td>
</tr>
<tr>
<th>
Default Value (Windows)
</th>
<td>
<code class="literal">
$HOMEDIR/ndb-tls
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Specify a list of directories to search for a CA file. On
Unix platforms, the directory names are separated by colons
(
<code class="literal">
:
</code>
); on Windows systems, the semicolon
character (
<code class="literal">
;
</code>
) is used as the separator. A
directory reference may be relative or absolute; it may
contain one or more environment variables, each denoted by a
prefixed dollar sign (
<code class="literal">
$
</code>
), and expanded
prior to use.
</p>
<p>
Searching begins with the leftmost named directory and
proceeds from left to right until a file is found. An empty
string denotes an empty search path, which causes all
searches to fail. A string consisting of a single dot
(
<code class="literal">
.
</code>
) indicates that the search path
limited to the current working directory.
</p>
<p>
If no search path is supplied, the compiled-in default value
is used. This value depends on the platform used: On
Windows, this is
<code class="literal">
\ndb-tls
</code>
; on other
platforms (including Linux), it is
<code class="literal">
$HOME/ndb-tls
</code>
. This can be overridden by
compiling NDB Cluster using
<a class="link" href="source-configuration-options.html#option_cmake_with_ndb_tls_search_path">
<code class="option">
-DWITH_NDB_TLS_SEARCH_PATH
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_no-defaults">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
</p>
<a class="indexterm" name="idm46045097183200">
</a>
<a class="indexterm" name="idm46045097181712">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for no-defaults">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--no-defaults
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Do not read default options from any option file other than
login file.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_print-defaults">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_print-defaults">
<code class="option">
--print-defaults
</code>
</a>
</p>
<a class="indexterm" name="idm46045097171952">
</a>
<a class="indexterm" name="idm46045097170464">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for print-defaults">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--print-defaults
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Print program argument list and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_usage">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_usage">
<code class="option">
--usage
</code>
</a>
</p>
<a class="indexterm" name="idm46045097160752">
</a>
<a class="indexterm" name="idm46045097159264">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for usage">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--usage
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Display help text and exit; same as
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_help">
<code class="option">
--help
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_count_version">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-count.html#option_ndb_select_count_version">
<code class="option">
--version
</code>
</a>
</p>
<a class="indexterm" name="idm46045097148512">
</a>
<a class="indexterm" name="idm46045097147024">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for version">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--version
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Display version information and exit.
</p>
</li>
</ul>
</div>
<p>
You can obtain row counts from multiple tables in the same
database by listing the table names separated by spaces when
invoking this command, as shown under
<span class="bold">
<strong>
Sample Output
</strong>
</span>
.
</p>
<h4>
<a name="idm46045097138000">
</a>
Sample Output
</h4>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa23153302"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">./ndb_select_count</span> <span class="token property">-c</span> localhost <span class="token property">-d</span> ctest1 fish dogs
6 records in table fish
4 records in table dogs</code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-setup-replicas.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-setup-replicas">
</a>
19.1.2.6 Setting Up Replicas
</h4>
</div>
</div>
</div>
<p>
The following sections describe how to set up replicas. Before
you proceed, ensure that you have:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Configured the source with the necessary configuration
properties. See
<a class="xref" href="replication-howto-masterbaseconfig.html" title="19.1.2.1 Setting the Replication Source Configuration">
Section 19.1.2.1, “Setting the Replication Source Configuration”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Obtained the source status information, or a copy of the
source's binary log index file made during a shutdown for
the data snapshot. See
<a class="xref" href="replication-howto-masterstatus.html" title="19.1.2.4 Obtaining the Replication Source Binary Log Coordinates">
Section 19.1.2.4, “Obtaining the Replication Source Binary Log Coordinates”
</a>
.
</p>
</li>
<li class="listitem">
<p>
On the source, released the read lock:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa84430847"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">UNLOCK</span> <span class="token keyword">TABLES</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
On the replica, edited the MySQL configuration. See
<a class="xref" href="replication-howto-slavebaseconfig.html" title="19.1.2.2 Setting the Replica Configuration">
Section 19.1.2.2, “Setting the Replica Configuration”
</a>
.
</p>
</li>
</ul>
</div>
<p>
The next steps depend on whether you have existing data to
import to the replica or not. See
<a class="xref" href="replication-snapshot-method.html" title="19.1.2.5 Choosing a Method for Data Snapshots">
Section 19.1.2.5, “Choosing a Method for Data Snapshots”
</a>
for more
information. Choose one of the following:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If you do not have a snapshot of a database to import, see
<a class="xref" href="replication-setup-replicas.html#replication-howto-newservers" title="19.1.2.6.1 Setting Up Replication with New Source and Replicas">
Section 19.1.2.6.1, “Setting Up Replication with New Source and Replicas”
</a>
.
</p>
</li>
<li class="listitem">
<p>
If you have a snapshot of a database to import, see
<a class="xref" href="replication-setup-replicas.html#replication-howto-existingdata" title="19.1.2.6.2 Setting Up Replication with Existing Data">
Section 19.1.2.6.2, “Setting Up Replication with Existing Data”
</a>
.
</p>
</li>
</ul>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="replication-howto-newservers">
</a>
19.1.2.6.1 Setting Up Replication with New Source and Replicas
</h5>
</div>
</div>
</div>
<p>
When there is no snapshot of a previous database to import,
configure the replica to start replication from the new
source.
</p>
<p>
To set up replication between a source and a new replica:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Start up the replica.
</p>
</li>
<li class="listitem">
<p>
Execute a
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE REPLICATION SOURCE
TO
</code>
</a>
statement on the replica to set the source
configuration. See
<a class="xref" href="replication-howto-slaveinit.html" title="19.1.2.7 Setting the Source Configuration on the Replica">
Section 19.1.2.7, “Setting the Source Configuration on the Replica”
</a>
.
</p>
</li>
</ol>
</div>
<p>
Perform these replica setup steps on each replica.
</p>
<p>
This method can also be used if you are setting up new servers
but have an existing dump of the databases from a different
server that you want to load into your replication
configuration. By loading the data into a new source, the data
is automatically replicated to the replicas.
</p>
<p>
If you are setting up a new replication environment using the
data from a different existing database server to create a new
source, run the dump file generated from that server on the
new source. The database updates are automatically propagated
to the replicas:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa90382026"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span> <span class="token property">-h</span> source < fulldb<span class="token punctuation">.</span>dump</code></pre>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="replication-howto-existingdata">
</a>
19.1.2.6.2 Setting Up Replication with Existing Data
</h5>
</div>
</div>
</div>
<p>
When setting up replication with existing data, transfer the
snapshot from the source to the replica before starting
replication. The process for importing data to the replica
depends on how you created the snapshot of data on the source.
</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Tip
</div>
<p>
To deploy multiple instances of MySQL, you can use
<a class="ulink" href="/doc/mysql-shell/8.4/en/mysql-innodb-cluster.html" target="_top">
InnoDB Cluster
</a>
which enables you to easily administer a group of MySQL server instances in
<a class="ulink" href="/doc/mysql-shell/8.4/en/" target="_top">
MySQL Shell
</a>
. InnoDB Cluster wraps MySQL Group Replication in a programmatic environment that enables you easily deploy a cluster of MySQL instances to achieve high availability. In addition, InnoDB Cluster interfaces seamlessly with
<a class="ulink" href="/doc/mysql-router/8.4/en/" target="_top">
MySQL Router
</a>
, which enables your applications to connect to the cluster without writing your own failover process. For similar use cases that do not require high availability, however, you can use
<a class="ulink" href="/doc/mysql-shell/8.4/en/mysql-innodb-replicaset.html" target="_top">
InnoDB ReplicaSet
</a>
. Installation instructions for MySQL Shell can be found
<a class="ulink" href="/doc/mysql-shell/8.4/en/mysql-shell-install.html" target="_top">
here
</a>
.
</p>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If the replication source server or existing replica that
you are copying to create the new replica has any scheduled
events, ensure that these are disabled on the new replica
before you start it. If an event runs on the new replica
that has already run on the source, the duplicated operation
causes an error. The Event Scheduler is controlled by the
<a class="link" href="server-system-variables.html#sysvar_event_scheduler">
<code class="literal">
event_scheduler
</code>
</a>
system
variable (default
<code class="literal">
ON
</code>
), so events that are
active on the original server run by default when the new
replica starts up. To stop all events from running on the
new replica, set the
<a class="link" href="server-system-variables.html#sysvar_event_scheduler">
<code class="literal">
event_scheduler
</code>
</a>
system
variable to
<code class="literal">
OFF
</code>
or
<code class="literal">
DISABLED
</code>
on the new replica.
Alternatively, you can use the
<a class="link" href="alter-event.html" title="15.1.3 ALTER EVENT Statement">
<code class="literal">
ALTER
EVENT
</code>
</a>
statement to set individual events to
<code class="literal">
DISABLE
</code>
or
<code class="literal">
DISABLE ON
REPLICA
</code>
to prevent them from running on the new
replica. You can list the events on a server using the
<a class="link" href="show.html" title="15.7.7 SHOW Statements">
<code class="literal">
SHOW
</code>
</a>
statement or the
Information Schema
<a class="link" href="information-schema-events-table.html" title="28.3.14 The INFORMATION_SCHEMA EVENTS Table">
<code class="literal">
EVENTS
</code>
</a>
table. For more information, see
<a class="xref" href="replication-features-invoked.html" title="19.5.1.16 Replication of Invoked Features">
Section 19.5.1.16, “Replication of Invoked Features”
</a>
.
</p>
</div>
<p>
As an alternative to creating a new replica in this way, MySQL
Server's clone plugin can be used to transfer all the data and
replication settings from an existing replica to a clone. For
instructions to use this method, see
<a class="xref" href="clone-plugin-replication.html" title="7.6.7.7 Cloning for Replication">
Section 7.6.7.7, “Cloning for Replication”
</a>
.
</p>
<p>
Follow this procedure to set up replication with existing
data:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
If you used MySQL Server's clone plugin to create a clone
from an existing replica (see
<a class="xref" href="clone-plugin-replication.html" title="7.6.7.7 Cloning for Replication">
Section 7.6.7.7, “Cloning for Replication”
</a>
), the data is
already transferred. Otherwise, import the data to the
replica using one of the following methods.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="a">
<li class="listitem">
<p>
If you used
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
, start the
replica server, ensuring that replication does not
start by starting the server with
<a class="link" href="replication-options-replica.html#option_mysqld_skip-replica-start">
<code class="option">
--skip-replica-start
</code>
</a>
.
Then import the dump file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa87554537"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span> < fulldb<span class="token punctuation">.</span>dump</code></pre>
</div>
</li>
<li class="listitem">
<p>
If you created a snapshot using the raw data files,
extract the data files into your replica's data
directory. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa21303907"><div class="copy-help left">Press ⌘+C to 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">tar</span> xvf dbdump<span class="token punctuation">.</span>tar</code></pre>
</div>
<p>
You may need to set permissions and ownership on the
files so that the replica server can access and modify
them. Then start the replica server, ensuring that
replication does not start by using
<a class="link" href="replication-options-replica.html#option_mysqld_skip-replica-start">
<code class="option">
--skip-replica-start
</code>
</a>
.
</p>
</li>
</ol>
</div>
</li>
<li class="listitem">
<p>
Configure the replica with the replication coordinates
from the source. This tells the replica the binary log
file and position within the file where replication needs
to start. Also, configure the replica with the login
credentials and host name of the source. For more
information on the
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE REPLICATION
SOURCE TO
</code>
</a>
statement required, see
<a class="xref" href="replication-howto-slaveinit.html" title="19.1.2.7 Setting the Source Configuration on the Replica">
Section 19.1.2.7, “Setting the Source Configuration on the Replica”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Start the replication threads by issuing a
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START REPLICA
</code>
</a>
statement.
</p>
</li>
</ol>
</div>
<p>
After you have performed this procedure, the replica connects
to the source and replicates any updates that have occurred on
the source since the snapshot was taken. Error messages are
issued to the replica's error log if it is not able to
replicate for any reason.
</p>
<p>
The replica uses information logged in its connection metadata
repository and applier metadata repository to keep track of
how much of the source's binary log it has processed. By
default, these repositories are tables named
<code class="literal">
slave_master_info
</code>
and
<code class="literal">
slave_relay_log_info
</code>
in the
<code class="literal">
mysql
</code>
database. Do
<span class="emphasis">
<em>
not
</em>
</span>
remove or edit these tables unless you know exactly what you
are doing and fully understand the implications. Even in that
case, it is preferred that you use the
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE REPLICATION SOURCE TO
</code>
</a>
statement to change replication parameters. The replica uses
the values specified in the statement to update the
replication metadata repositories automatically. See
<a class="xref" href="replica-logs.html" title="19.2.4 Relay Log and Replication Metadata Repositories">
Section 19.2.4, “Relay Log and Replication Metadata Repositories”
</a>
, for more information.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The contents of the replica's connection metadata repository
override some of the server options specified on the command
line or in
<code class="filename">
my.cnf
</code>
. 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>
, for more details.
</p>
</div>
<p>
A single snapshot of the source suffices for multiple
replicas. To set up additional replicas, use the same source
snapshot and follow the replica portion of the procedure just
described.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/keyring-component-plugin-comparison.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="keyring-component-plugin-comparison">
</a>
8.4.4.1 Keyring Components Versus Keyring Plugins
</h4>
</div>
</div>
</div>
<p>
The MySQL Keyring originally implemented keystore capabilities
using server plugins, but began transitioning to use the
component infrastructure. This section briefly compares keyring
components and plugins to provide an overview of their
differences. It may assist you in making the transition from
plugins to components, or, if you are just beginning to use the
keyring, assist you in choosing whether to use a component
versus using a plugin.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Keyring plugin loading uses the
<a class="link" href="server-options.html#option_mysqld_early-plugin-load">
<code class="option">
--early-plugin-load
</code>
</a>
option.
Keyring component loading uses a manifest.
</p>
</li>
<li class="listitem">
<p>
Keyring plugin configuration is based on plugin-specific
system variables. For keyring components, no system
variables are used. Instead, each component has its own
configuration file.
</p>
</li>
<li class="listitem">
<p>
Keyring components have fewer restrictions than keyring
plugins with respect to key types and lengths. See
<a class="xref" href="keyring-key-types.html" title="8.4.4.10 Supported Keyring Key Types and Lengths">
Section 8.4.4.10, “Supported Keyring Key Types and Lengths”
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<code class="literal">
component_keyring_oci
</code>
can generate keys
of type
<code class="literal">
AES
</code>
with a size of 16, 24, or
32 bytes only.
</p>
</div>
</li>
<li class="listitem">
<p>
Keyring components support secure storage for persisted
system variable values, whereas keyring plugins do not
support the function.
</p>
<p>
A keyring component must be enabled on the MySQL server
instance to support secure storage for persisted system
variable values. The sensitive data that can be protected in
this way includes items such as private keys and passwords
that appear in the values of system variables. In the
operating system file where persisted system variables are
stored, the names and values of sensitive system variables
are stored in an encrypted format, along with a generated
file key to decrypt them. The generated file key is in turn
encrypted using a master key that is stored in a keyring.
See
<a class="xref" href="persisted-system-variables.html#persisted-system-variables-sensitive" title="Persisting Sensitive System Variables">
Persisting Sensitive System Variables
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/spatial-function-reference.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="spatial-function-reference">
</a>
14.16.1 Spatial Function Reference
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045198362752">
</a>
<p>
The following table lists each spatial function and provides a
short description of each one.
</p>
<div class="table">
<a name="idm46045198361168">
</a>
<p class="title">
<b>
Table 14.21 Spatial Functions
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="A reference that lists all spatial functions.">
<colgroup>
<col style="width: 28%"/>
<col style="width: 71%"/>
</colgroup>
<thead>
<tr>
<th>
Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="gis-mysql-specific-functions.html#function_geomcollection">
<code class="literal">
GeomCollection()
</code>
</a>
</td>
<td>
Construct geometry collection from geometries
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-mysql-specific-functions.html#function_geometrycollection">
<code class="literal">
GeometryCollection()
</code>
</a>
</td>
<td>
Construct geometry collection from geometries
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-mysql-specific-functions.html#function_linestring">
<code class="literal">
LineString()
</code>
</a>
</td>
<td>
Construct LineString from Point values
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-mbr.html#function_mbrcontains">
<code class="literal">
MBRContains()
</code>
</a>
</td>
<td>
Whether MBR of one geometry contains MBR of another
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-mbr.html#function_mbrcoveredby">
<code class="literal">
MBRCoveredBy()
</code>
</a>
</td>
<td>
Whether one MBR is covered by another
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-mbr.html#function_mbrcovers">
<code class="literal">
MBRCovers()
</code>
</a>
</td>
<td>
Whether one MBR covers another
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-mbr.html#function_mbrdisjoint">
<code class="literal">
MBRDisjoint()
</code>
</a>
</td>
<td>
Whether MBRs of two geometries are disjoint
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-mbr.html#function_mbrequals">
<code class="literal">
MBREquals()
</code>
</a>
</td>
<td>
Whether MBRs of two geometries are equal
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-mbr.html#function_mbrintersects">
<code class="literal">
MBRIntersects()
</code>
</a>
</td>
<td>
Whether MBRs of two geometries intersect
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-mbr.html#function_mbroverlaps">
<code class="literal">
MBROverlaps()
</code>
</a>
</td>
<td>
Whether MBRs of two geometries overlap
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-mbr.html#function_mbrtouches">
<code class="literal">
MBRTouches()
</code>
</a>
</td>
<td>
Whether MBRs of two geometries touch
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-mbr.html#function_mbrwithin">
<code class="literal">
MBRWithin()
</code>
</a>
</td>
<td>
Whether MBR of one geometry is within MBR of another
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-mysql-specific-functions.html#function_multilinestring">
<code class="literal">
MultiLineString()
</code>
</a>
</td>
<td>
Contruct MultiLineString from LineString values
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-mysql-specific-functions.html#function_multipoint">
<code class="literal">
MultiPoint()
</code>
</a>
</td>
<td>
Construct MultiPoint from Point values
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-mysql-specific-functions.html#function_multipolygon">
<code class="literal">
MultiPolygon()
</code>
</a>
</td>
<td>
Construct MultiPolygon from Polygon values
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-mysql-specific-functions.html#function_point">
<code class="literal">
Point()
</code>
</a>
</td>
<td>
Construct Point from coordinates
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-mysql-specific-functions.html#function_polygon">
<code class="literal">
Polygon()
</code>
</a>
</td>
<td>
Construct Polygon from LineString arguments
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-polygon-property-functions.html#function_st-area">
<code class="literal">
ST_Area()
</code>
</a>
</td>
<td>
Return Polygon or MultiPolygon area
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-format-conversion-functions.html#function_st-asbinary">
<code class="literal">
ST_AsBinary()
</code>
,
<code class="literal">
ST_AsWKB()
</code>
</a>
</td>
<td>
Convert from internal geometry format to WKB
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-geojson-functions.html#function_st-asgeojson">
<code class="literal">
ST_AsGeoJSON()
</code>
</a>
</td>
<td>
Generate GeoJSON object from geometry
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-format-conversion-functions.html#function_st-astext">
<code class="literal">
ST_AsText()
</code>
,
<code class="literal">
ST_AsWKT()
</code>
</a>
</td>
<td>
Convert from internal geometry format to WKT
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-operator-functions.html#function_st-buffer">
<code class="literal">
ST_Buffer()
</code>
</a>
</td>
<td>
Return geometry of points within given distance from geometry
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-operator-functions.html#function_st-buffer-strategy">
<code class="literal">
ST_Buffer_Strategy()
</code>
</a>
</td>
<td>
Produce strategy option for ST_Buffer()
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-polygon-property-functions.html#function_st-centroid">
<code class="literal">
ST_Centroid()
</code>
</a>
</td>
<td>
Return centroid as a point
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-aggregate-functions.html#function_st-collect">
<code class="literal">
ST_Collect()
</code>
</a>
</td>
<td>
Aggregate spatial values into collection
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-contains">
<code class="literal">
ST_Contains()
</code>
</a>
</td>
<td>
Whether one geometry contains another
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-operator-functions.html#function_st-convexhull">
<code class="literal">
ST_ConvexHull()
</code>
</a>
</td>
<td>
Return convex hull of geometry
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-crosses">
<code class="literal">
ST_Crosses()
</code>
</a>
</td>
<td>
Whether one geometry crosses another
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-operator-functions.html#function_st-difference">
<code class="literal">
ST_Difference()
</code>
</a>
</td>
<td>
Return point set difference of two geometries
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-general-property-functions.html#function_st-dimension">
<code class="literal">
ST_Dimension()
</code>
</a>
</td>
<td>
Dimension of geometry
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-disjoint">
<code class="literal">
ST_Disjoint()
</code>
</a>
</td>
<td>
Whether one geometry is disjoint from another
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-distance">
<code class="literal">
ST_Distance()
</code>
</a>
</td>
<td>
The distance of one geometry from another
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-convenience-functions.html#function_st-distance-sphere">
<code class="literal">
ST_Distance_Sphere()
</code>
</a>
</td>
<td>
Minimum distance on earth between two geometries
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-linestring-property-functions.html#function_st-endpoint">
<code class="literal">
ST_EndPoint()
</code>
</a>
</td>
<td>
End Point of LineString
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-general-property-functions.html#function_st-envelope">
<code class="literal">
ST_Envelope()
</code>
</a>
</td>
<td>
Return MBR of geometry
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-equals">
<code class="literal">
ST_Equals()
</code>
</a>
</td>
<td>
Whether one geometry is equal to another
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-polygon-property-functions.html#function_st-exteriorring">
<code class="literal">
ST_ExteriorRing()
</code>
</a>
</td>
<td>
Return exterior ring of Polygon
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-frechetdistance">
<code class="literal">
ST_FrechetDistance()
</code>
</a>
</td>
<td>
The discrete Fréchet distance of one geometry from another
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-geohash-functions.html#function_st-geohash">
<code class="literal">
ST_GeoHash()
</code>
</a>
</td>
<td>
Produce a geohash value
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-wkt-functions.html#function_st-geomcollfromtext">
<code class="literal">
ST_GeomCollFromText()
</code>
,
<code class="literal">
ST_GeometryCollectionFromText()
</code>
,
<code class="literal">
ST_GeomCollFromTxt()
</code>
</a>
</td>
<td>
Return geometry collection from WKT
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-wkb-functions.html#function_st-geomcollfromwkb">
<code class="literal">
ST_GeomCollFromWKB()
</code>
,
<code class="literal">
ST_GeometryCollectionFromWKB()
</code>
</a>
</td>
<td>
Return geometry collection from WKB
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-geometrycollection-property-functions.html#function_st-geometryn">
<code class="literal">
ST_GeometryN()
</code>
</a>
</td>
<td>
Return N-th geometry from geometry collection
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-general-property-functions.html#function_st-geometrytype">
<code class="literal">
ST_GeometryType()
</code>
</a>
</td>
<td>
Return name of geometry type
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-geojson-functions.html#function_st-geomfromgeojson">
<code class="literal">
ST_GeomFromGeoJSON()
</code>
</a>
</td>
<td>
Generate geometry from GeoJSON object
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-wkt-functions.html#function_st-geomfromtext">
<code class="literal">
ST_GeomFromText()
</code>
,
<code class="literal">
ST_GeometryFromText()
</code>
</a>
</td>
<td>
Return geometry from WKT
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-wkb-functions.html#function_st-geomfromwkb">
<code class="literal">
ST_GeomFromWKB()
</code>
,
<code class="literal">
ST_GeometryFromWKB()
</code>
</a>
</td>
<td>
Return geometry from WKB
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-hausdorffdistance">
<code class="literal">
ST_HausdorffDistance()
</code>
</a>
</td>
<td>
The discrete Hausdorff distance of one geometry from another
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-polygon-property-functions.html#function_st-interiorringn">
<code class="literal">
ST_InteriorRingN()
</code>
</a>
</td>
<td>
Return N-th interior ring of Polygon
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-operator-functions.html#function_st-intersection">
<code class="literal">
ST_Intersection()
</code>
</a>
</td>
<td>
Return point set intersection of two geometries
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-intersects">
<code class="literal">
ST_Intersects()
</code>
</a>
</td>
<td>
Whether one geometry intersects another
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-linestring-property-functions.html#function_st-isclosed">
<code class="literal">
ST_IsClosed()
</code>
</a>
</td>
<td>
Whether a geometry is closed and simple
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-general-property-functions.html#function_st-isempty">
<code class="literal">
ST_IsEmpty()
</code>
</a>
</td>
<td>
Whether a geometry is empty
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-general-property-functions.html#function_st-issimple">
<code class="literal">
ST_IsSimple()
</code>
</a>
</td>
<td>
Whether a geometry is simple
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-convenience-functions.html#function_st-isvalid">
<code class="literal">
ST_IsValid()
</code>
</a>
</td>
<td>
Whether a geometry is valid
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-geohash-functions.html#function_st-latfromgeohash">
<code class="literal">
ST_LatFromGeoHash()
</code>
</a>
</td>
<td>
Return latitude from geohash value
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-point-property-functions.html#function_st-latitude">
<code class="literal">
ST_Latitude()
</code>
</a>
</td>
<td>
Return latitude of Point
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-linestring-property-functions.html#function_st-length">
<code class="literal">
ST_Length()
</code>
</a>
</td>
<td>
Return length of LineString
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-wkt-functions.html#function_st-linefromtext">
<code class="literal">
ST_LineFromText()
</code>
,
<code class="literal">
ST_LineStringFromText()
</code>
</a>
</td>
<td>
Construct LineString from WKT
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-wkb-functions.html#function_st-linefromwkb">
<code class="literal">
ST_LineFromWKB()
</code>
,
<code class="literal">
ST_LineStringFromWKB()
</code>
</a>
</td>
<td>
Construct LineString from WKB
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-operator-functions.html#function_st-lineinterpolatepoint">
<code class="literal">
ST_LineInterpolatePoint()
</code>
</a>
</td>
<td>
The point a given percentage along a LineString
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-operator-functions.html#function_st-lineinterpolatepoints">
<code class="literal">
ST_LineInterpolatePoints()
</code>
</a>
</td>
<td>
The points a given percentage along a LineString
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-geohash-functions.html#function_st-longfromgeohash">
<code class="literal">
ST_LongFromGeoHash()
</code>
</a>
</td>
<td>
Return longitude from geohash value
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-point-property-functions.html#function_st-longitude">
<code class="literal">
ST_Longitude()
</code>
</a>
</td>
<td>
Return longitude of Point
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-convenience-functions.html#function_st-makeenvelope">
<code class="literal">
ST_MakeEnvelope()
</code>
</a>
</td>
<td>
Rectangle around two points
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-wkt-functions.html#function_st-mlinefromtext">
<code class="literal">
ST_MLineFromText()
</code>
,
<code class="literal">
ST_MultiLineStringFromText()
</code>
</a>
</td>
<td>
Construct MultiLineString from WKT
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-wkb-functions.html#function_st-mlinefromwkb">
<code class="literal">
ST_MLineFromWKB()
</code>
,
<code class="literal">
ST_MultiLineStringFromWKB()
</code>
</a>
</td>
<td>
Construct MultiLineString from WKB
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-wkt-functions.html#function_st-mpointfromtext">
<code class="literal">
ST_MPointFromText()
</code>
,
<code class="literal">
ST_MultiPointFromText()
</code>
</a>
</td>
<td>
Construct MultiPoint from WKT
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-wkb-functions.html#function_st-mpointfromwkb">
<code class="literal">
ST_MPointFromWKB()
</code>
,
<code class="literal">
ST_MultiPointFromWKB()
</code>
</a>
</td>
<td>
Construct MultiPoint from WKB
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-wkt-functions.html#function_st-mpolyfromtext">
<code class="literal">
ST_MPolyFromText()
</code>
,
<code class="literal">
ST_MultiPolygonFromText()
</code>
</a>
</td>
<td>
Construct MultiPolygon from WKT
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-wkb-functions.html#function_st-mpolyfromwkb">
<code class="literal">
ST_MPolyFromWKB()
</code>
,
<code class="literal">
ST_MultiPolygonFromWKB()
</code>
</a>
</td>
<td>
Construct MultiPolygon from WKB
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-geometrycollection-property-functions.html#function_st-numgeometries">
<code class="literal">
ST_NumGeometries()
</code>
</a>
</td>
<td>
Return number of geometries in geometry collection
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-polygon-property-functions.html#function_st-numinteriorrings">
<code class="literal">
ST_NumInteriorRing()
</code>
,
<code class="literal">
ST_NumInteriorRings()
</code>
</a>
</td>
<td>
Return number of interior rings in Polygon
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-linestring-property-functions.html#function_st-numpoints">
<code class="literal">
ST_NumPoints()
</code>
</a>
</td>
<td>
Return number of points in LineString
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-overlaps">
<code class="literal">
ST_Overlaps()
</code>
</a>
</td>
<td>
Whether one geometry overlaps another
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-operator-functions.html#function_st-pointatdistance">
<code class="literal">
ST_PointAtDistance()
</code>
</a>
</td>
<td>
The point a given distance along a LineString
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-geohash-functions.html#function_st-pointfromgeohash">
<code class="literal">
ST_PointFromGeoHash()
</code>
</a>
</td>
<td>
Convert geohash value to POINT value
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-wkt-functions.html#function_st-pointfromtext">
<code class="literal">
ST_PointFromText()
</code>
</a>
</td>
<td>
Construct Point from WKT
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-wkb-functions.html#function_st-pointfromwkb">
<code class="literal">
ST_PointFromWKB()
</code>
</a>
</td>
<td>
Construct Point from WKB
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-linestring-property-functions.html#function_st-pointn">
<code class="literal">
ST_PointN()
</code>
</a>
</td>
<td>
Return N-th point from LineString
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-wkt-functions.html#function_st-polyfromtext">
<code class="literal">
ST_PolyFromText()
</code>
,
<code class="literal">
ST_PolygonFromText()
</code>
</a>
</td>
<td>
Construct Polygon from WKT
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-wkb-functions.html#function_st-polyfromwkb">
<code class="literal">
ST_PolyFromWKB()
</code>
,
<code class="literal">
ST_PolygonFromWKB()
</code>
</a>
</td>
<td>
Construct Polygon from WKB
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-convenience-functions.html#function_st-simplify">
<code class="literal">
ST_Simplify()
</code>
</a>
</td>
<td>
Return simplified geometry
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-general-property-functions.html#function_st-srid">
<code class="literal">
ST_SRID()
</code>
</a>
</td>
<td>
Return spatial reference system ID for geometry
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-linestring-property-functions.html#function_st-startpoint">
<code class="literal">
ST_StartPoint()
</code>
</a>
</td>
<td>
Start Point of LineString
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-format-conversion-functions.html#function_st-swapxy">
<code class="literal">
ST_SwapXY()
</code>
</a>
</td>
<td>
Return argument with X/Y coordinates swapped
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-operator-functions.html#function_st-symdifference">
<code class="literal">
ST_SymDifference()
</code>
</a>
</td>
<td>
Return point set symmetric difference of two geometries
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-touches">
<code class="literal">
ST_Touches()
</code>
</a>
</td>
<td>
Whether one geometry touches another
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-operator-functions.html#function_st-transform">
<code class="literal">
ST_Transform()
</code>
</a>
</td>
<td>
Transform coordinates of geometry
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-operator-functions.html#function_st-union">
<code class="literal">
ST_Union()
</code>
</a>
</td>
<td>
Return point set union of two geometries
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-convenience-functions.html#function_st-validate">
<code class="literal">
ST_Validate()
</code>
</a>
</td>
<td>
Return validated geometry
</td>
</tr>
<tr>
<td>
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-within">
<code class="literal">
ST_Within()
</code>
</a>
</td>
<td>
Whether one geometry is within another
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-point-property-functions.html#function_st-x">
<code class="literal">
ST_X()
</code>
</a>
</td>
<td>
Return X coordinate of Point
</td>
</tr>
<tr>
<td>
<a class="link" href="gis-point-property-functions.html#function_st-y">
<code class="literal">
ST_Y()
</code>
</a>
</td>
<td>
Return Y coordinate of Point
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 739px;">
<thead>
<tr>
<th style="width: 262.219px;">
Name
</th>
<th style="width: 475.781px;">
Description
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-obtaining-parent-events.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="performance-schema-obtaining-parent-events">
</a>
29.19.2 Obtaining Parent Event Information
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045064190224">
</a>
<a class="indexterm" name="idm46045064188736">
</a>
<a class="indexterm" name="idm46045064187248">
</a>
<a class="indexterm" name="idm46045064185760">
</a>
<p>
The
<a class="link" href="performance-schema-data-locks-table.html" title="29.12.13.1 The data_locks Table">
<code class="literal">
data_locks
</code>
</a>
table shows data
locks held and requested. Rows of this table have a
<code class="literal">
THREAD_ID
</code>
column indicating the thread ID of
the session that owns the lock, and an
<code class="literal">
EVENT_ID
</code>
column indicating the Performance
Schema event that caused the lock. Tuples of
(
<code class="literal">
THREAD_ID
</code>
,
<code class="literal">
EVENT_ID
</code>
)
values implicitly identify a parent event in other Performance
Schema tables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The parent wait event in the
<code class="literal">
events_waits_
<em class="replaceable">
<code>
xxx
</code>
</em>
</code>
tables
</p>
</li>
<li class="listitem">
<p>
The parent stage event in the
<code class="literal">
events_stages_
<em class="replaceable">
<code>
xxx
</code>
</em>
</code>
tables
</p>
</li>
<li class="listitem">
<p>
The parent statement event in the
<code class="literal">
events_statements_
<em class="replaceable">
<code>
xxx
</code>
</em>
</code>
tables
</p>
</li>
<li class="listitem">
<p>
The parent transaction event in the
<a class="link" href="performance-schema-events-transactions-current-table.html" title="29.12.7.1 The events_transactions_current Table">
<code class="literal">
events_transactions_current
</code>
</a>
table
</p>
</li>
</ul>
</div>
<p>
To obtain details about the parent event, join the
<code class="literal">
THREAD_ID
</code>
and
<code class="literal">
EVENT_ID
</code>
columns with the columns of like name in the appropriate parent
event table. The relation is based on a nested set data model,
so the join has several clauses. Given parent and child tables
represented by
<code class="literal">
parent
</code>
and
<code class="literal">
child
</code>
, respectively, the join looks like
this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa90011211"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">WHERE</span>
parent<span class="token punctuation">.</span>THREAD_ID <span class="token operator">=</span> child<span class="token punctuation">.</span>THREAD_ID <span class="token comment" spellcheck="true">/* 1 */</span>
<span class="token operator">AND</span> parent<span class="token punctuation">.</span>EVENT_ID <span class="token operator"><</span> child<span class="token punctuation">.</span>EVENT_ID <span class="token comment" spellcheck="true">/* 2 */</span>
<span class="token operator">AND</span> <span class="token punctuation">(</span>
child<span class="token punctuation">.</span>EVENT_ID <span class="token operator"><=</span> parent<span class="token punctuation">.</span>END_EVENT_ID <span class="token comment" spellcheck="true">/* 3a */</span>
<span class="token operator">OR</span> parent<span class="token punctuation">.</span>END_EVENT_ID <span class="token operator">IS</span> <span class="token boolean">NULL</span> <span class="token comment" spellcheck="true">/* 3b */</span>
<span class="token punctuation">)</span></code></pre>
</div>
<p>
The conditions for the join are:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
The parent and child events are in the same thread.
</p>
</li>
<li class="listitem">
<p>
The child event begins after the parent event, so its
<code class="literal">
EVENT_ID
</code>
value is greater than that of
the parent.
</p>
</li>
<li class="listitem">
<p>
The parent event has either completed or is still running.
</p>
</li>
</ol>
</div>
<p>
To find lock information,
<a class="link" href="performance-schema-data-locks-table.html" title="29.12.13.1 The data_locks Table">
<code class="literal">
data_locks
</code>
</a>
is the table containing
child events.
</p>
<p>
The
<a class="link" href="performance-schema-data-locks-table.html" title="29.12.13.1 The data_locks Table">
<code class="literal">
data_locks
</code>
</a>
table shows only
existing locks, so these considerations apply regarding which
table contains the parent event:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For transactions, the only choice is
<a class="link" href="performance-schema-events-transactions-current-table.html" title="29.12.7.1 The events_transactions_current Table">
<code class="literal">
events_transactions_current
</code>
</a>
. If
a transaction is completed, it may be in the transaction
history tables, but the locks are gone already.
</p>
</li>
<li class="listitem">
<p>
For statements, it all depends on whether the statement that
took a lock is a statement in a transaction that has already
completed (use
<a class="link" href="performance-schema-events-statements-history-table.html" title="29.12.6.2 The events_statements_history Table">
<code class="literal">
events_statements_history
</code>
</a>
) or
the statement is still running (use
<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>
).
</p>
</li>
<li class="listitem">
<p>
For stages, the logic is similar to that for statements; use
<a class="link" href="performance-schema-events-stages-history-table.html" title="29.12.5.2 The events_stages_history Table">
<code class="literal">
events_stages_history
</code>
</a>
or
<a class="link" href="performance-schema-events-stages-current-table.html" title="29.12.5.1 The events_stages_current Table">
<code class="literal">
events_stages_current
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
For waits, the logic is similar to that for statements; use
<a class="link" href="performance-schema-events-waits-history-table.html" title="29.12.4.2 The events_waits_history Table">
<code class="literal">
events_waits_history
</code>
</a>
or
<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>
. However,
so many waits are recorded that the wait that caused a lock
is most likely gone from the history tables already.
</p>
</li>
</ul>
</div>
<p>
Wait, stage, and statement events disappear quickly from the
history. If a statement that executed a long time ago took a
lock but is in a still-open transaction, it might not be
possible to find the statement, but it is possible to find the
transaction.
</p>
<p>
This is why the nested set data model works better for locating
parent events. Following links in a parent/child relationship
(data lock -> parent wait -> parent stage -> parent
transaction) does not work well when intermediate nodes are
already gone from the history tables.
</p>
<p>
The following scenario illustrates how to find the parent
transaction of a statement in which a lock was taken:
</p>
<p>
Session A:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa36830290"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span> <span class="token keyword">START</span> <span class="token keyword">TRANSACTION</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 keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> pk <span class="token operator">=</span> <span class="token number">1</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 keyword">SELECT</span> <span class="token string">'Hello, world'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Session B:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa33575034"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>events_transactions_current <span class="token keyword">AS</span> parent
<span class="token keyword">INNER</span> <span class="token keyword">JOIN</span> performance_schema<span class="token punctuation">.</span>data_locks <span class="token keyword">AS</span> child
<span class="token keyword">WHERE</span>
parent<span class="token punctuation">.</span>THREAD_ID <span class="token operator">=</span> child<span class="token punctuation">.</span>THREAD_ID
<span class="token operator">AND</span> parent<span class="token punctuation">.</span>EVENT_ID <span class="token operator"><</span> child<span class="token punctuation">.</span>EVENT_ID
<span class="token operator">AND</span> <span class="token punctuation">(</span>
child<span class="token punctuation">.</span>EVENT_ID <span class="token operator"><=</span> parent<span class="token punctuation">.</span>END_EVENT_ID
<span class="token operator">OR</span> parent<span class="token punctuation">.</span>END_EVENT_ID <span class="token operator">IS</span> <span class="token boolean">NULL</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The query for session B should show statement [2] as owning a
data lock on the record with
<code class="literal">
pk=1
</code>
.
</p>
<p>
If session A executes more statements, [2] fades out of the
history table.
</p>
<p>
The query should show the transaction that started in [1],
regardless of how many statements, stages, or waits were
executed.
</p>
<p>
To see more data, you can also use the
<code class="literal">
events_
<em class="replaceable">
<code>
xxx
</code>
</em>
_history_long
</code>
tables, except for transactions, assuming no other query runs in
the server (so that history is preserved).
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/index.html | <div class="docs-auto-hide-page-toc" id="docs-body">
<div class="book" lang="en">
<div class="titlepage">
<div>
<div>
<h1 class="title">
<a name="refman">
</a>
MySQL 8.4 Reference Manual
</h1>
</div>
<div>
<h2 class="subtitle">
Including MySQL NDB Cluster 8.4
</h2>
</div>
<div>
<div class="abstract">
<p class="title">
<b>
Abstract
</b>
</p>
<p>
This is the MySQL Reference Manual. It documents MySQL
8.4 through 8.4.4, as well as NDB
Cluster 8.4 through 8.4.4,
respectively. It may include documentation of features of MySQL
versions that have not yet been released. For information about
which versions have been released, see the
<a class="ulink" href="/doc/relnotes/mysql/8.4/en/" target="_top">
MySQL
8.4 Release Notes
</a>
.
</p>
<p>
<b>
MySQL 8.4 features.
</b>
This manual describes features that are not included in every
edition of MySQL 8.4; such features may not be
included in the edition of MySQL 8.4 licensed to
you. If you have any questions about the features included in
your edition of MySQL 8.4, refer to your MySQL
8.4 license agreement or contact your Oracle
sales representative.
</p>
<p>
For notes detailing the changes in each release, see the
<a class="ulink" href="/doc/relnotes/mysql/8.4/en/" target="_top">
MySQL
8.4 Release Notes
</a>
.
</p>
<p>
For legal information, including licensing information, see the
<a class="xref" href="preface.html" title="Preface and Legal Notices">
Preface and Legal Notices
</a>
.
</p>
<p>
For help with using MySQL, please visit the
<a class="ulink" href="http://forums.mysql.com" target="_blank">
MySQL Forums
</a>
, where you
can discuss your issues with other MySQL users.
</p>
<p>
Document generated on:
2024-11-12
(revision: 80245)
</p>
</div>
</div>
</div>
<hr/>
</div>
<div class="toc">
<p>
<b>
Table of Contents
</b>
</p>
<dl class="toc">
<dt>
<span class="preface">
<a href="preface.html">
Preface and Legal Notices
</a>
</span>
</dt>
<dt>
<span class="chapter">
<a href="introduction.html">
1 General Information
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="manual-info.html">
1.1 About This Manual
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="what-is.html">
1.2 Overview of the MySQL Database Management System
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="what-is-mysql.html">
1.2.1 What is MySQL?
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="features.html">
1.2.2 The Main Features of MySQL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="history.html">
1.2.3 History of MySQL
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="mysql-releases.html">
1.3 MySQL Releases: Innovation and LTS
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-nutshell.html">
1.4 What Is New in MySQL 8.4 since MySQL 8.0
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="added-deprecated-removed.html">
1.5 Server and Status Variables and Options Added, Deprecated, or Removed in
MySQL 8.4 since 8.0
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="bug-reports.html">
1.6 How to Report Bugs or Problems
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="compatibility.html">
1.7 MySQL Standards Compliance
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="extensions-to-ansi.html">
1.7.1 MySQL Extensions to Standard SQL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="differences-from-ansi.html">
1.7.2 MySQL Differences from Standard SQL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="constraints.html">
1.7.3 How MySQL Deals with Constraints
</a>
</span>
</dt>
</dl>
</dd>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="installing.html">
2 Installing MySQL
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="general-installation-issues.html">
2.1 General Installation Guidance
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="platform-support.html">
2.1.1 Supported Platforms
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="which-version.html">
2.1.2 Which MySQL Version and Distribution to Install
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="getting-mysql.html">
2.1.3 How to Get MySQL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="verifying-package-integrity.html">
2.1.4 Verifying Package Integrity Using MD5 Checksums or GnuPG
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="installation-layouts.html">
2.1.5 Installation Layouts
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="compiler-characteristics.html">
2.1.6 Compiler-Specific Build Characteristics
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="binary-installation.html">
2.2 Installing MySQL on Unix/Linux Using Generic Binaries
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="windows-installation.html">
2.3 Installing MySQL on Microsoft Windows
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="windows-choosing-package.html">
2.3.1 Choosing an Installation Package
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-configurator.html">
2.3.2 Configuration: Using MySQL Configurator
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="windows-install-archive.html">
2.3.3 Configuration: Manually
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="windows-troubleshooting.html">
2.3.4 Troubleshooting a Microsoft Windows MySQL Server Installation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="windows-postinstallation.html">
2.3.5 Windows Postinstallation Procedures
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="windows-restrictions.html">
2.3.6 Windows Platform Restrictions
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="macos-installation.html">
2.4 Installing MySQL on macOS
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="macos-installation-notes.html">
2.4.1 General Notes on Installing MySQL on macOS
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="macos-installation-pkg.html">
2.4.2 Installing MySQL on macOS Using Native Packages
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="macos-installation-launchd.html">
2.4.3 Installing and Using the MySQL Launch Daemon
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="macos-installation-prefpane.html">
2.4.4 Installing and Using the MySQL Preference Pane
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="linux-installation.html">
2.5 Installing MySQL on Linux
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="linux-installation-yum-repo.html">
2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="linux-installation-apt-repo.html">
2.5.2 Installing MySQL on Linux Using the MySQL APT Repository
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="linux-installation-sles-repo.html">
2.5.3 Using the MySQL SLES Repository
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="linux-installation-rpm.html">
2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="linux-installation-debian.html">
2.5.5 Installing MySQL on Linux Using Debian Packages from Oracle
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="linux-installation-docker.html">
2.5.6 Deploying MySQL on Linux with Docker Containers
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="linux-installation-native.html">
2.5.7 Installing MySQL on Linux from the Native Software Repositories
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="linux-installation-juju.html">
2.5.8 Installing MySQL on Linux with Juju
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="using-systemd.html">
2.5.9 Managing MySQL Server with systemd
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="uln-installation.html">
2.6 Installing MySQL Using Unbreakable Linux Network (ULN)
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="solaris-installation.html">
2.7 Installing MySQL on Solaris
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="solaris-installation-pkg.html">
2.7.1 Installing MySQL on Solaris Using a Solaris PKG
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="source-installation.html">
2.8 Installing MySQL from Source
</a>
</span>
</dt>
<dd>
<dl>
<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>
</dd>
<dt>
<span class="section">
<a href="postinstallation.html">
2.9 Postinstallation Setup and Testing
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="data-directory-initialization.html">
2.9.1 Initializing the Data Directory
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="starting-server.html">
2.9.2 Starting the Server
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="testing-server.html">
2.9.3 Testing the Server
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="default-privileges.html">
2.9.4 Securing the Initial MySQL Account
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="automatic-start.html">
2.9.5 Starting and Stopping MySQL Automatically
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="perl-support.html">
2.10 Perl Installation Notes
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="perl-installation.html">
2.10.1 Installing Perl on Unix
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="activestate-perl.html">
2.10.2 Installing ActiveState Perl on Windows
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="perl-support-problems.html">
2.10.3 Problems Using the Perl DBI/DBD Interface
</a>
</span>
</dt>
</dl>
</dd>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="upgrading.html">
3 Upgrading MySQL
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="upgrade-before-you-begin.html">
3.1 Before You Begin
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="upgrade-paths.html">
3.2 Upgrade Paths
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="upgrade-best-practices.html">
3.3 Upgrade Best Practices
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="upgrading-what-is-upgraded.html">
3.4 What the MySQL Upgrade Process Upgrades
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="upgrading-from-previous-series.html">
3.5 Changes in MySQL 8.4
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="upgrade-prerequisites.html">
3.6 Preparing Your Installation for Upgrade
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="upgrade-binary-package.html">
3.7 Upgrading MySQL Binary or Package-based Installations on Unix/Linux
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="updating-yum-repo.html">
3.8 Upgrading MySQL with the MySQL Yum Repository
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="updating-apt-repo.html">
3.9 Upgrading MySQL with the MySQL APT Repository
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="updating-sles-repo.html">
3.10 Upgrading MySQL with the MySQL SLES Repository
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="windows-upgrading.html">
3.11 Upgrading MySQL on Windows
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="upgrade-docker-mysql.html">
3.12 Upgrading a Docker Installation of MySQL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="upgrade-troubleshooting.html">
3.13 Upgrade Troubleshooting
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="rebuilding-tables.html">
3.14 Rebuilding or Repairing Tables or Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="copying-databases.html">
3.15 Copying MySQL Databases to Another Machine
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="downgrading.html">
4 Downgrading MySQL
</a>
</span>
</dt>
<dt>
<span class="chapter">
<a href="tutorial.html">
5 Tutorial
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="connecting-disconnecting.html">
5.1 Connecting to and Disconnecting from the Server
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="entering-queries.html">
5.2 Entering Queries
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="database-use.html">
5.3 Creating and Using a Database
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="creating-database.html">
5.3.1 Creating and Selecting a Database
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="creating-tables.html">
5.3.2 Creating a Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="loading-tables.html">
5.3.3 Loading Data into a Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="retrieving-data.html">
5.3.4 Retrieving Information from a Table
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="getting-information.html">
5.4 Getting Information About Databases and Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="batch-mode.html">
5.5 Using mysql in Batch Mode
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="examples.html">
5.6 Examples of Common Queries
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="example-maximum-column.html">
5.6.1 The Maximum Value for a Column
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="example-maximum-row.html">
5.6.2 The Row Holding the Maximum of a Certain Column
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="example-maximum-column-group.html">
5.6.3 Maximum of Column per Group
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="example-maximum-column-group-row.html">
5.6.4 The Rows Holding the Group-wise Maximum of a Certain Column
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="example-user-variables.html">
5.6.5 Using User-Defined Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="example-foreign-keys.html">
5.6.6 Using Foreign Keys
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="searching-on-two-keys.html">
5.6.7 Searching on Two Keys
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="calculating-days.html">
5.6.8 Calculating Visits Per Day
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="example-auto-increment.html">
5.6.9 Using AUTO_INCREMENT
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="apache.html">
5.7 Using MySQL with Apache
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="programs.html">
6 MySQL Programs
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="programs-overview.html">
6.1 Overview of MySQL Programs
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="programs-using.html">
6.2 Using MySQL Programs
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="invoking-programs.html">
6.2.1 Invoking MySQL Programs
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="program-options.html">
6.2.2 Specifying Program Options
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connection-options.html">
6.2.3 Command Options for Connecting to the Server
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connecting.html">
6.2.4 Connecting to the MySQL Server Using Command Options
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connecting-using-uri-or-key-value-pairs.html">
6.2.5 Connecting to the Server Using URI-Like Strings or Key-Value Pairs
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connecting-using-dns-srv.html">
6.2.6 Connecting to the Server Using DNS SRV Records
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="transport-protocols.html">
6.2.7 Connection Transport Protocols
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connection-compression-control.html">
6.2.8 Connection Compression Control
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="setting-environment-variables.html">
6.2.9 Setting Environment Variables
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="programs-server.html">
6.3 Server and Server-Startup Programs
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysqld.html">
6.3.1 mysqld — The MySQL Server
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqld-safe.html">
6.3.2 mysqld_safe — MySQL Server Startup Script
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-server.html">
6.3.3 mysql.server — MySQL Server Startup Script
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqld-multi.html">
6.3.4 mysqld_multi — Manage Multiple MySQL Servers
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="programs-installation.html">
6.4 Installation-Related Programs
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="comp-err.html">
6.4.1 comp_err — Compile MySQL Error Message File
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-secure-installation.html">
6.4.2 mysql_secure_installation — Improve MySQL Installation Security
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-tzinfo-to-sql.html">
6.4.3 mysql_tzinfo_to_sql — Load the Time Zone Tables
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="programs-client.html">
6.5 Client Programs
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysql.html">
6.5.1 mysql — The MySQL Command-Line Client
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqladmin.html">
6.5.2 mysqladmin — A MySQL Server Administration Program
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqlcheck.html">
6.5.3 mysqlcheck — A Table Maintenance Program
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqldump.html">
6.5.4 mysqldump — A Database Backup Program
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqlimport.html">
6.5.5 mysqlimport — A Data Import Program
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqlshow.html">
6.5.6 mysqlshow — Display Database, Table, and Column Information
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqlslap.html">
6.5.7 mysqlslap — A Load Emulation Client
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="programs-admin-utils.html">
6.6 Administrative and Utility Programs
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="ibd2sdi.html">
6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innochecksum.html">
6.6.2 innochecksum — Offline InnoDB File Checksum Utility
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisam-ftdump.html">
6.6.3 myisam_ftdump — Display Full-Text Index information
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisamchk.html">
6.6.4 myisamchk — MyISAM Table-Maintenance Utility
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisamlog.html">
6.6.5 myisamlog — Display MyISAM Log File Contents
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisampack.html">
6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-config-editor.html">
6.6.7 mysql_config_editor — MySQL Configuration Utility
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-migrate-keyring.html">
6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqlbinlog.html">
6.6.9 mysqlbinlog — Utility for Processing Binary Log Files
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqldumpslow.html">
6.6.10 mysqldumpslow — Summarize Slow Query Log Files
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="programs-development.html">
6.7 Program Development Utilities
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysql-config.html">
6.7.1 mysql_config — Display Options for Compiling Clients
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="my-print-defaults.html">
6.7.2 my_print_defaults — Display Options from Option Files
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="programs-miscellaneous.html">
6.8 Miscellaneous Programs
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="perror.html">
6.8.1 perror — Display MySQL Error Message Information
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="environment-variables.html">
6.9 Environment Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="unix-signal-response.html">
6.10 Unix Signal Handling in MySQL
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="server-administration.html">
7 MySQL Server Administration
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysqld-server.html">
7.1 The MySQL Server
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="server-configuration.html">
7.1.1 Configuring the Server
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="server-configuration-defaults.html">
7.1.2 Server Configuration Defaults
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="server-configuration-validation.html">
7.1.3 Server Configuration Validation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="server-option-variable-reference.html">
7.1.4 Server Option, System Variable, and Status Variable Reference
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="server-system-variable-reference.html">
7.1.5 Server System Variable Reference
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="server-status-variable-reference.html">
7.1.6 Server Status Variable Reference
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="server-options.html">
7.1.7 Server Command Options
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="server-system-variables.html">
7.1.8 Server System Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="using-system-variables.html">
7.1.9 Using System Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="server-status-variables.html">
7.1.10 Server Status Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sql-mode.html">
7.1.11 Server SQL Modes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connection-management.html">
7.1.12 Connection Management
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ipv6-support.html">
7.1.13 IPv6 Support
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="network-namespace-support.html">
7.1.14 Network Namespace Support
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="time-zone-support.html">
7.1.15 MySQL Server Time Zone Support
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="resource-groups.html">
7.1.16 Resource Groups
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="server-side-help-support.html">
7.1.17 Server-Side Help Support
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="session-state-tracking.html">
7.1.18 Server Tracking of Client Session State
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="server-shutdown.html">
7.1.19 The Server Shutdown Process
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="data-directory.html">
7.2 The MySQL Data Directory
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="system-schema.html">
7.3 The mysql System Schema
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="server-logs.html">
7.4 MySQL Server Logs
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="log-destinations.html">
7.4.1 Selecting General Query Log and Slow Query Log Output Destinations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="error-log.html">
7.4.2 The Error Log
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="query-log.html">
7.4.3 The General Query Log
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="binary-log.html">
7.4.4 The Binary Log
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="slow-query-log.html">
7.4.5 The Slow Query Log
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="log-file-maintenance.html">
7.4.6 Server Log Maintenance
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="components.html">
7.5 MySQL Components
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="component-loading.html">
7.5.1 Installing and Uninstalling Components
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="obtaining-component-information.html">
7.5.2 Obtaining Component Information
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="error-log-components.html">
7.5.3 Error Log Components
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="query-attribute-components.html">
7.5.4 Query Attribute Components
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="scheduler-component.html">
7.5.5 Scheduler Component
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="server-plugins.html">
7.6 MySQL Server Plugins
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="plugin-loading.html">
7.6.1 Installing and Uninstalling Plugins
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="obtaining-plugin-information.html">
7.6.2 Obtaining Server Plugin Information
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="thread-pool.html">
7.6.3 MySQL Enterprise Thread Pool
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="rewriter-query-rewrite-plugin.html">
7.6.4 The Rewriter Query Rewrite Plugin
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ddl-rewriter.html">
7.6.5 The ddl_rewriter Plugin
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="version-tokens.html">
7.6.6 Version Tokens
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="clone-plugin.html">
7.6.7 The Clone Plugin
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="daemon-keyring-proxy-plugin.html">
7.6.8 The Keyring Proxy Bridge Plugin
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="plugin-services.html">
7.6.9 MySQL Plugin Services
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="server-loadable-functions.html">
7.7 MySQL Server Loadable Functions
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="function-loading.html">
7.7.1 Installing and Uninstalling Loadable Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="obtaining-loadable-function-information.html">
7.7.2 Obtaining Information About Loadable Functions
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="multiple-servers.html">
7.8 Running Multiple MySQL Instances on One Machine
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="multiple-data-directories.html">
7.8.1 Setting Up Multiple Data Directories
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="multiple-windows-servers.html">
7.8.2 Running Multiple MySQL Instances on Windows
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="multiple-unix-servers.html">
7.8.3 Running Multiple MySQL Instances on Unix
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="multiple-server-clients.html">
7.8.4 Using Client Programs in a Multiple-Server Environment
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="debugging-mysql.html">
7.9 Debugging MySQL
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="debugging-server.html">
7.9.1 Debugging a MySQL Server
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="debugging-client.html">
7.9.2 Debugging a MySQL Client
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="lock-order-tool.html">
7.9.3 The LOCK_ORDER Tool
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="dbug-package.html">
7.9.4 The DBUG Package
</a>
</span>
</dt>
</dl>
</dd>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="security.html">
8 Security
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="general-security-issues.html">
8.1 General Security Issues
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="security-guidelines.html">
8.1.1 Security Guidelines
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="password-security.html">
8.1.2 Keeping Passwords Secure
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="security-against-attack.html">
8.1.3 Making MySQL Secure Against Attackers
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="security-options.html">
8.1.4 Security-Related mysqld Options and Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="changing-mysql-user.html">
8.1.5 How to Run MySQL as a Normal User
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="load-data-local-security.html">
8.1.6 Security Considerations for LOAD DATA LOCAL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="secure-client-programming.html">
8.1.7 Client Programming Security Guidelines
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="access-control.html">
8.2 Access Control and Account Management
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="user-names.html">
8.2.1 Account User Names and Passwords
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="privileges-provided.html">
8.2.2 Privileges Provided by MySQL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="grant-tables.html">
8.2.3 Grant Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="account-names.html">
8.2.4 Specifying Account Names
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="role-names.html">
8.2.5 Specifying Role Names
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connection-access.html">
8.2.6 Access Control, Stage 1: Connection Verification
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="request-access.html">
8.2.7 Access Control, Stage 2: Request Verification
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="creating-accounts.html">
8.2.8 Adding Accounts, Assigning Privileges, and Dropping Accounts
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="reserved-accounts.html">
8.2.9 Reserved Accounts
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="roles.html">
8.2.10 Using Roles
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="account-categories.html">
8.2.11 Account Categories
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="partial-revokes.html">
8.2.12 Privilege Restriction Using Partial Revokes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="privilege-changes.html">
8.2.13 When Privilege Changes Take Effect
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="assigning-passwords.html">
8.2.14 Assigning Account Passwords
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="password-management.html">
8.2.15 Password Management
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="expired-password-handling.html">
8.2.16 Server Handling of Expired Passwords
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="pluggable-authentication.html">
8.2.17 Pluggable Authentication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="multifactor-authentication.html">
8.2.18 Multifactor Authentication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="proxy-users.html">
8.2.19 Proxy Users
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="account-locking.html">
8.2.20 Account Locking
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="user-resources.html">
8.2.21 Setting Account Resource Limits
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="problems-connecting.html">
8.2.22 Troubleshooting Problems Connecting to MySQL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="account-activity-auditing.html">
8.2.23 SQL-Based Account Activity Auditing
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="encrypted-connections.html">
8.3 Using Encrypted Connections
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="using-encrypted-connections.html">
8.3.1 Configuring MySQL to Use Encrypted Connections
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="encrypted-connection-protocols-ciphers.html">
8.3.2 Encrypted Connection TLS Protocols and Ciphers
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="creating-ssl-rsa-files.html">
8.3.3 Creating SSL and RSA Certificates and Keys
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="windows-and-ssh.html">
8.3.4 Connecting to MySQL Remotely from Windows with SSH
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="reusing-ssl-sessions.html">
8.3.5 Reusing SSL Sessions
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="security-plugins.html">
8.4 Security Components and Plugins
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="authentication-plugins.html">
8.4.1 Authentication Plugins
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connection-control.html">
8.4.2 The Connection-Control Plugins
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="validate-password.html">
8.4.3 The Password Validation Component
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="keyring.html">
8.4.4 The MySQL Keyring
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="audit-log.html">
8.4.5 MySQL Enterprise Audit
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="audit-api-message-emit.html">
8.4.6 The Audit Message Component
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="firewall.html">
8.4.7 MySQL Enterprise Firewall
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="data-masking.html">
8.5 MySQL Enterprise Data Masking and De-Identification
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="data-masking-components-vs-plugin.html">
8.5.1 Data-Masking Components Versus the Data-Masking Plugin
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="data-masking-components.html">
8.5.2 MySQL Enterprise Data Masking and De-Identification Components
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="data-masking-plugin.html">
8.5.3 MySQL Enterprise Data Masking and De-Identification Plugin
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="enterprise-encryption.html">
8.6 MySQL Enterprise Encryption
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="enterprise-encryption-installation.html">
8.6.1 MySQL Enterprise Encryption Installation and Upgrading
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="enterprise-encryption-configuring.html">
8.6.2 Configuring MySQL Enterprise Encryption
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="enterprise-encryption-usage.html">
8.6.3 MySQL Enterprise Encryption Usage and Examples
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="enterprise-encryption-function-reference.html">
8.6.4 MySQL Enterprise Encryption Function Reference
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="enterprise-encryption-functions.html">
8.6.5 MySQL Enterprise Encryption Component Function Descriptions
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="selinux.html">
8.7 SELinux
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="selinux-checking.html">
8.7.1 Check if SELinux is Enabled
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="selinux-mode.html">
8.7.2 Changing the SELinux Mode
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="selinux-policies.html">
8.7.3 MySQL Server SELinux Policies
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="selinux-file-context.html">
8.7.4 SELinux File Context
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="selinux-context-tcp-port.html">
8.7.5 SELinux TCP Port Context
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="selinux-troubleshooting.html">
8.7.6 Troubleshooting SELinux
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="fips-mode.html">
8.8 FIPS Support
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="backup-and-recovery.html">
9 Backup and Recovery
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="backup-types.html">
9.1 Backup and Recovery Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="backup-methods.html">
9.2 Database Backup Methods
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="backup-strategy-example.html">
9.3 Example Backup and Recovery Strategy
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="backup-policy.html">
9.3.1 Establishing a Backup Policy
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="recovery-from-backups.html">
9.3.2 Using Backups for Recovery
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="backup-strategy-summary.html">
9.3.3 Backup Strategy Summary
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="using-mysqldump.html">
9.4 Using mysqldump for Backups
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysqldump-sql-format.html">
9.4.1 Dumping Data in SQL Format with mysqldump
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="reloading-sql-format-dumps.html">
9.4.2 Reloading SQL-Format Backups
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqldump-delimited-text.html">
9.4.3 Dumping Data in Delimited-Text Format with mysqldump
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="reloading-delimited-text-dumps.html">
9.4.4 Reloading Delimited-Text Format Backups
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysqldump-tips.html">
9.4.5 mysqldump Tips
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="point-in-time-recovery.html">
9.5 Point-in-Time (Incremental) Recovery
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="point-in-time-recovery-binlog.html">
9.5.1 Point-in-Time Recovery Using Binary Log
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="point-in-time-recovery-positions.html">
9.5.2 Point-in-Time Recovery Using Event Positions
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="myisam-table-maintenance.html">
9.6 MyISAM Table Maintenance and Crash Recovery
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="myisam-crash-recovery.html">
9.6.1 Using myisamchk for Crash Recovery
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisam-check.html">
9.6.2 How to Check MyISAM Tables for Errors
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisam-repair.html">
9.6.3 How to Repair MyISAM Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisam-optimization.html">
9.6.4 MyISAM Table Optimization
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisam-maintenance-schedule.html">
9.6.5 Setting Up a MyISAM Table Maintenance Schedule
</a>
</span>
</dt>
</dl>
</dd>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="optimization.html">
10 Optimization
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="optimize-overview.html">
10.1 Optimization Overview
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="statement-optimization.html">
10.2 Optimizing SQL Statements
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="select-optimization.html">
10.2.1 Optimizing SELECT Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="subquery-optimization.html">
10.2.2 Optimizing Subqueries, Derived Tables, View References, and Common Table
Expressions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-optimization.html">
10.2.3 Optimizing INFORMATION_SCHEMA Queries
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-optimization.html">
10.2.4 Optimizing Performance Schema Queries
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="data-change-optimization.html">
10.2.5 Optimizing Data Change Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="permission-optimization.html">
10.2.6 Optimizing Database Privileges
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="miscellaneous-optimization-tips.html">
10.2.7 Other Optimization Tips
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="optimization-indexes.html">
10.3 Optimization and Indexes
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysql-indexes.html">
10.3.1 How MySQL Uses Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="primary-key-optimization.html">
10.3.2 Primary Key Optimization
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="spatial-index-optimization.html">
10.3.3 SPATIAL Index Optimization
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="foreign-key-optimization.html">
10.3.4 Foreign Key Optimization
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="column-indexes.html">
10.3.5 Column Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="multiple-column-indexes.html">
10.3.6 Multiple-Column Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="verifying-index-usage.html">
10.3.7 Verifying Index Usage
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="index-statistics.html">
10.3.8 InnoDB and MyISAM Index Statistics Collection
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="index-btree-hash.html">
10.3.9 Comparison of B-Tree and Hash Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="index-extensions.html">
10.3.10 Use of Index Extensions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="generated-column-index-optimizations.html">
10.3.11 Optimizer Use of Generated Column Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="invisible-indexes.html">
10.3.12 Invisible Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="descending-indexes.html">
10.3.13 Descending Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="timestamp-lookups.html">
10.3.14 Indexed Lookups from TIMESTAMP Columns
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="optimizing-database-structure.html">
10.4 Optimizing Database Structure
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="data-size.html">
10.4.1 Optimizing Data Size
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimize-data-types.html">
10.4.2 Optimizing MySQL Data Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimize-multi-tables.html">
10.4.3 Optimizing for Many Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="internal-temporary-tables.html">
10.4.4 Internal Temporary Table Use in MySQL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="database-count-limit.html">
10.4.5 Limits on Number of Databases and Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="table-size-limit.html">
10.4.6 Limits on Table Size
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="column-count-limit.html">
10.4.7 Limits on Table Column Count and Row Size
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="optimizing-innodb.html">
10.5 Optimizing for InnoDB Tables
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="optimizing-innodb-storage-layout.html">
10.5.1 Optimizing Storage Layout for InnoDB Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-innodb-transaction-management.html">
10.5.2 Optimizing InnoDB Transaction Management
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-performance-ro-txn.html">
10.5.3 Optimizing InnoDB Read-Only Transactions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-innodb-logging.html">
10.5.4 Optimizing InnoDB Redo Logging
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-innodb-bulk-data-loading.html">
10.5.5 Bulk Data Loading for InnoDB Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-innodb-queries.html">
10.5.6 Optimizing InnoDB Queries
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-innodb-ddl-operations.html">
10.5.7 Optimizing InnoDB DDL Operations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-innodb-diskio.html">
10.5.8 Optimizing InnoDB Disk I/O
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-innodb-configuration-variables.html">
10.5.9 Optimizing InnoDB Configuration Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-innodb-many-tables.html">
10.5.10 Optimizing InnoDB for Systems with Many Tables
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="optimizing-myisam.html">
10.6 Optimizing for MyISAM Tables
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="optimizing-queries-myisam.html">
10.6.1 Optimizing MyISAM Queries
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-myisam-bulk-data-loading.html">
10.6.2 Bulk Data Loading for MyISAM Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="repair-table-optimization.html">
10.6.3 Optimizing REPAIR TABLE Statements
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="optimizing-memory-tables.html">
10.7 Optimizing for MEMORY Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="execution-plan-information.html">
10.8 Understanding the Query Execution Plan
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="using-explain.html">
10.8.1 Optimizing Queries with EXPLAIN
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="explain-output.html">
10.8.2 EXPLAIN Output Format
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="explain-extended.html">
10.8.3 Extended EXPLAIN Output Format
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="explain-for-connection.html">
10.8.4 Obtaining Execution Plan Information for a Named Connection
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="estimating-performance.html">
10.8.5 Estimating Query Performance
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="controlling-optimizer.html">
10.9 Controlling the Query Optimizer
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="controlling-query-plan-evaluation.html">
10.9.1 Controlling Query Plan Evaluation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="switchable-optimizations.html">
10.9.2 Switchable Optimizations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizer-hints.html">
10.9.3 Optimizer Hints
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="index-hints.html">
10.9.4 Index Hints
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="cost-model.html">
10.9.5 The Optimizer Cost Model
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizer-statistics.html">
10.9.6 Optimizer Statistics
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="buffering-caching.html">
10.10 Buffering and Caching
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-buffer-pool-optimization.html">
10.10.1 InnoDB Buffer Pool Optimization
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisam-key-cache.html">
10.10.2 The MyISAM Key Cache
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="statement-caching.html">
10.10.3 Caching of Prepared Statements and Stored Programs
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="locking-issues.html">
10.11 Optimizing Locking Operations
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="internal-locking.html">
10.11.1 Internal Locking Methods
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="table-locking.html">
10.11.2 Table Locking Issues
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="concurrent-inserts.html">
10.11.3 Concurrent Inserts
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="metadata-locking.html">
10.11.4 Metadata Locking
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="external-locking.html">
10.11.5 External Locking
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="optimizing-server.html">
10.12 Optimizing the MySQL Server
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="disk-issues.html">
10.12.1 Optimizing Disk I/O
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="symbolic-links.html">
10.12.2 Using Symbolic Links
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-memory.html">
10.12.3 Optimizing Memory Use
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="optimize-benchmarking.html">
10.13 Measuring Performance (Benchmarking)
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="select-benchmarking.html">
10.13.1 Measuring the Speed of Expressions and Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="custom-benchmarks.html">
10.13.2 Using Your Own Benchmarks
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="monitoring-performance-schema.html">
10.13.3 Measuring Performance with performance_schema
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="thread-information.html">
10.14 Examining Server Thread (Process) Information
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="processlist-access.html">
10.14.1 Accessing the Process List
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="thread-commands.html">
10.14.2 Thread Command Values
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="general-thread-states.html">
10.14.3 General Thread States
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="source-thread-states.html">
10.14.4 Replication Source Thread States
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replica-io-thread-states.html">
10.14.5 Replication I/O (Receiver) Thread States
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replica-sql-thread-states.html">
10.14.6 Replication SQL Thread States
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replica-connection-thread-states.html">
10.14.7 Replication Connection Thread States
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-thread-states.html">
10.14.8 NDB Cluster Thread States
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="event-scheduler-thread-states.html">
10.14.9 Event Scheduler Thread States
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="optimizer-tracing.html">
10.15 Tracing the Optimizer
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="optimizer-tracing-typical-usage.html">
10.15.1 Typical Usage
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="system-variables-controlling-tracing.html">
10.15.2 System Variables Controlling Tracing
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="traceable-statements.html">
10.15.3 Traceable Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="tuning-trace-purging.html">
10.15.4 Tuning Trace Purging
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="tracing-memory-usage.html">
10.15.5 Tracing Memory Usage
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="privilege-checking.html">
10.15.6 Privilege Checking
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="interaction-with-debug-option.html">
10.15.7 Interaction with the --debug Option
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizer-trace-system-variable.html">
10.15.8 The optimizer_trace System Variable
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="end-markers-in-json-system-variable.html">
10.15.9 The end_markers_in_json System Variable
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizer-features-to-trace.html">
10.15.10 Selecting Optimizer Features to Trace
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="trace-general-structure.html">
10.15.11 Trace General Structure
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="tracing-example.html">
10.15.12 Example
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="displaying-traces.html">
10.15.13 Displaying Traces in Other Applications
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="preventing-use-of-optimizer-trace.html">
10.15.14 Preventing the Use of Optimizer Trace
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizer-trace-testing.html">
10.15.15 Testing Optimizer Trace
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizer-trace-implementation.html">
10.15.16 Optimizer Trace Implementation
</a>
</span>
</dt>
</dl>
</dd>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="language-structure.html">
11 Language Structure
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="literals.html">
11.1 Literal Values
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="string-literals.html">
11.1.1 String Literals
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="number-literals.html">
11.1.2 Numeric Literals
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="date-and-time-literals.html">
11.1.3 Date and Time Literals
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="hexadecimal-literals.html">
11.1.4 Hexadecimal Literals
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="bit-value-literals.html">
11.1.5 Bit-Value Literals
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="boolean-literals.html">
11.1.6 Boolean Literals
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="null-values.html">
11.1.7 NULL Values
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="identifiers.html">
11.2 Schema Object Names
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="identifier-length.html">
11.2.1 Identifier Length Limits
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="identifier-qualifiers.html">
11.2.2 Identifier Qualifiers
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="identifier-case-sensitivity.html">
11.2.3 Identifier Case Sensitivity
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="identifier-mapping.html">
11.2.4 Mapping of Identifiers to File Names
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="function-resolution.html">
11.2.5 Function Name Parsing and Resolution
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="keywords.html">
11.3 Keywords and Reserved Words
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="user-variables.html">
11.4 User-Defined Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="expressions.html">
11.5 Expressions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="query-attributes.html">
11.6 Query Attributes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="comments.html">
11.7 Comments
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="charset.html">
12 Character Sets, Collations, Unicode
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="charset-general.html">
12.1 Character Sets and Collations in General
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-mysql.html">
12.2 Character Sets and Collations in MySQL
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="charset-repertoire.html">
12.2.1 Character Set Repertoire
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-metadata.html">
12.2.2 UTF-8 for Metadata
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="charset-syntax.html">
12.3 Specifying Character Sets and Collations
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="charset-collation-names.html">
12.3.1 Collation Naming Conventions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-server.html">
12.3.2 Server Character Set and Collation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-database.html">
12.3.3 Database Character Set and Collation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-table.html">
12.3.4 Table Character Set and Collation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-column.html">
12.3.5 Column Character Set and Collation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-literal.html">
12.3.6 Character String Literal Character Set and Collation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-national.html">
12.3.7 The National Character Set
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-introducer.html">
12.3.8 Character Set Introducers
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-examples.html">
12.3.9 Examples of Character Set and Collation Assignment
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-compatibility.html">
12.3.10 Compatibility with Other DBMSs
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="charset-connection.html">
12.4 Connection Character Sets and Collations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-applications.html">
12.5 Configuring Application Character Set and Collation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-errors.html">
12.6 Error Message Character Set
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-conversion.html">
12.7 Column Character Set Conversion
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-collations.html">
12.8 Collation Issues
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="charset-collate.html">
12.8.1 Using COLLATE in SQL Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-collate-precedence.html">
12.8.2 COLLATE Clause Precedence
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-collation-compatibility.html">
12.8.3 Character Set and Collation Compatibility
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-collation-coercibility.html">
12.8.4 Collation Coercibility in Expressions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-binary-collations.html">
12.8.5 The binary Collation Compared to _bin Collations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-collation-effect.html">
12.8.6 Examples of the Effect of Collation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-collation-information-schema.html">
12.8.7 Using Collation in INFORMATION_SCHEMA Searches
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="charset-unicode.html">
12.9 Unicode Support
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="charset-unicode-utf8mb4.html">
12.9.1 The utf8mb4 Character Set (4-Byte UTF-8 Unicode Encoding)
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-unicode-utf8mb3.html">
12.9.2 The utf8mb3 Character Set (3-Byte UTF-8 Unicode Encoding)
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-unicode-utf8.html">
12.9.3 The utf8 Character Set (Deprecated alias for utf8mb3)
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-unicode-ucs2.html">
12.9.4 The ucs2 Character Set (UCS-2 Unicode Encoding)
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-unicode-utf16.html">
12.9.5 The utf16 Character Set (UTF-16 Unicode Encoding)
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-unicode-utf16le.html">
12.9.6 The utf16le Character Set (UTF-16LE Unicode Encoding)
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-unicode-utf32.html">
12.9.7 The utf32 Character Set (UTF-32 Unicode Encoding)
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-unicode-conversion.html">
12.9.8 Converting Between 3-Byte and 4-Byte Unicode Character Sets
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="charset-charsets.html">
12.10 Supported Character Sets and Collations
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="charset-unicode-sets.html">
12.10.1 Unicode Character Sets
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-we-sets.html">
12.10.2 West European Character Sets
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-ce-sets.html">
12.10.3 Central European Character Sets
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-se-me-sets.html">
12.10.4 South European and Middle East Character Sets
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-baltic-sets.html">
12.10.5 Baltic Character Sets
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-cyrillic-sets.html">
12.10.6 Cyrillic Character Sets
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-asian-sets.html">
12.10.7 Asian Character Sets
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="charset-binary-set.html">
12.10.8 The Binary Character Set
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="charset-restrictions.html">
12.11 Restrictions on Character Sets
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="error-message-language.html">
12.12 Setting the Error Message Language
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="adding-character-set.html">
12.13 Adding a Character Set
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="character-arrays.html">
12.13.1 Character Definition Arrays
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="string-collating.html">
12.13.2 String Collating Support for Complex Character Sets
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="multibyte-characters.html">
12.13.3 Multi-Byte Character Support for Complex Character Sets
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="adding-collation.html">
12.14 Adding a Collation to a Character Set
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="charset-collation-implementations.html">
12.14.1 Collation Implementation Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="adding-collation-choosing-id.html">
12.14.2 Choosing a Collation ID
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="adding-collation-simple-8bit.html">
12.14.3 Adding a Simple Collation to an 8-Bit Character Set
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="adding-collation-unicode-uca.html">
12.14.4 Adding a UCA Collation to a Unicode Character Set
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="charset-configuration.html">
12.15 Character Set Configuration
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="locale-support.html">
12.16 MySQL Server Locale Support
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="data-types.html">
13 Data Types
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="numeric-types.html">
13.1 Numeric Data Types
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="numeric-type-syntax.html">
13.1.1 Numeric Data Type Syntax
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="integer-types.html">
13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT,
MEDIUMINT, BIGINT
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="fixed-point-types.html">
13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="floating-point-types.html">
13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="bit-type.html">
13.1.5 Bit-Value Type - BIT
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="numeric-type-attributes.html">
13.1.6 Numeric Type Attributes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="out-of-range-and-overflow.html">
13.1.7 Out-of-Range and Overflow Handling
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="date-and-time-types.html">
13.2 Date and Time Data Types
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="date-and-time-type-syntax.html">
13.2.1 Date and Time Data Type Syntax
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="datetime.html">
13.2.2 The DATE, DATETIME, and TIMESTAMP Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="time.html">
13.2.3 The TIME Type
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="year.html">
13.2.4 The YEAR Type
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="timestamp-initialization.html">
13.2.5 Automatic Initialization and Updating for TIMESTAMP and DATETIME
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="fractional-seconds.html">
13.2.6 Fractional Seconds in Time Values
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-calendar.html">
13.2.7 What Calendar Is Used By MySQL?
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="date-and-time-type-conversion.html">
13.2.8 Conversion Between Date and Time Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="two-digit-years.html">
13.2.9 2-Digit Years in Dates
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="string-types.html">
13.3 String Data Types
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="string-type-syntax.html">
13.3.1 String Data Type Syntax
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="char.html">
13.3.2 The CHAR and VARCHAR Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="binary-varbinary.html">
13.3.3 The BINARY and VARBINARY Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="blob.html">
13.3.4 The BLOB and TEXT Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="enum.html">
13.3.5 The ENUM Type
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="set.html">
13.3.6 The SET Type
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="spatial-types.html">
13.4 Spatial Data Types
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="spatial-type-overview.html">
13.4.1 Spatial Data Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="opengis-geometry-model.html">
13.4.2 The OpenGIS Geometry Model
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-data-formats.html">
13.4.3 Supported Spatial Data Formats
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="geometry-well-formedness-validity.html">
13.4.4 Geometry Well-Formedness and Validity
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="spatial-reference-systems.html">
13.4.5 Spatial Reference System Support
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="creating-spatial-columns.html">
13.4.6 Creating Spatial Columns
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="populating-spatial-columns.html">
13.4.7 Populating Spatial Columns
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="fetching-spatial-data.html">
13.4.8 Fetching Spatial Data
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-spatial-analysis.html">
13.4.9 Optimizing Spatial Analysis
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="creating-spatial-indexes.html">
13.4.10 Creating Spatial Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="using-spatial-indexes.html">
13.4.11 Using Spatial Indexes
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="json.html">
13.5 The JSON Data Type
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="data-type-defaults.html">
13.6 Data Type Default Values
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="storage-requirements.html">
13.7 Data Type Storage Requirements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="choosing-types.html">
13.8 Choosing the Right Type for a Column
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="other-vendor-data-types.html">
13.9 Using Data Types from Other Database Engines
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="functions.html">
14 Functions and Operators
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="built-in-function-reference.html">
14.1 Built-In Function and Operator Reference
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="loadable-function-reference.html">
14.2 Loadable Function Reference
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="type-conversion.html">
14.3 Type Conversion in Expression Evaluation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="non-typed-operators.html">
14.4 Operators
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="operator-precedence.html">
14.4.1 Operator Precedence
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="comparison-operators.html">
14.4.2 Comparison Functions and Operators
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="logical-operators.html">
14.4.3 Logical Operators
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="assignment-operators.html">
14.4.4 Assignment Operators
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="flow-control-functions.html">
14.5 Flow Control Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="numeric-functions.html">
14.6 Numeric Functions and Operators
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="arithmetic-functions.html">
14.6.1 Arithmetic Operators
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mathematical-functions.html">
14.6.2 Mathematical Functions
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="date-and-time-functions.html">
14.7 Date and Time Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="string-functions.html">
14.8 String Functions and Operators
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="string-comparison-functions.html">
14.8.1 String Comparison Functions and Operators
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="regexp.html">
14.8.2 Regular Expressions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="string-functions-charset.html">
14.8.3 Character Set and Collation of Function Results
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="fulltext-search.html">
14.9 Full-Text Search Functions
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="fulltext-natural-language.html">
14.9.1 Natural Language Full-Text Searches
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="fulltext-boolean.html">
14.9.2 Boolean Full-Text Searches
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="fulltext-query-expansion.html">
14.9.3 Full-Text Searches with Query Expansion
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="fulltext-stopwords.html">
14.9.4 Full-Text Stopwords
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="fulltext-restrictions.html">
14.9.5 Full-Text Restrictions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="fulltext-fine-tuning.html">
14.9.6 Fine-Tuning MySQL Full-Text Search
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="full-text-adding-collation.html">
14.9.7 Adding a User-Defined Collation for Full-Text Indexing
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="fulltext-search-ngram.html">
14.9.8 ngram Full-Text Parser
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="fulltext-search-mecab.html">
14.9.9 MeCab Full-Text Parser Plugin
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="cast-functions.html">
14.10 Cast Functions and Operators
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="xml-functions.html">
14.11 XML Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="bit-functions.html">
14.12 Bit Functions and Operators
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="encryption-functions.html">
14.13 Encryption and Compression Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="locking-functions.html">
14.14 Locking Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-functions.html">
14.15 Information Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="spatial-analysis-functions.html">
14.16 Spatial Analysis Functions
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="spatial-function-reference.html">
14.16.1 Spatial Function Reference
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="spatial-function-argument-handling.html">
14.16.2 Argument Handling by Spatial Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-wkt-functions.html">
14.16.3 Functions That Create Geometry Values from WKT Values
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-wkb-functions.html">
14.16.4 Functions That Create Geometry Values from WKB Values
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-mysql-specific-functions.html">
14.16.5 MySQL-Specific Functions That Create Geometry Values
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-format-conversion-functions.html">
14.16.6 Geometry Format Conversion Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-property-functions.html">
14.16.7 Geometry Property Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="spatial-operator-functions.html">
14.16.8 Spatial Operator Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="spatial-relation-functions.html">
14.16.9 Functions That Test Spatial Relations Between Geometry Objects
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="spatial-geohash-functions.html">
14.16.10 Spatial Geohash Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="spatial-geojson-functions.html">
14.16.11 Spatial GeoJSON Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="spatial-aggregate-functions.html">
14.16.12 Spatial Aggregate Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="spatial-convenience-functions.html">
14.16.13 Spatial Convenience Functions
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="json-functions.html">
14.17 JSON Functions
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="json-function-reference.html">
14.17.1 JSON Function Reference
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="json-creation-functions.html">
14.17.2 Functions That Create JSON Values
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="json-search-functions.html">
14.17.3 Functions That Search JSON Values
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="json-modification-functions.html">
14.17.4 Functions That Modify JSON Values
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="json-attribute-functions.html">
14.17.5 Functions That Return JSON Value Attributes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="json-table-functions.html">
14.17.6 JSON Table Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="json-validation-functions.html">
14.17.7 JSON Schema Validation Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="json-utility-functions.html">
14.17.8 JSON Utility Functions
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="replication-functions.html">
14.18 Replication Functions
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="group-replication-functions.html">
14.18.1 Group Replication Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gtid-functions.html">
14.18.2 Functions Used with Global Transaction Identifiers (GTIDs)
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-functions-async-failover.html">
14.18.3 Asynchronous Replication Channel Failover Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-functions-synchronization.html">
14.18.4 Position-Based Synchronization Functions
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="aggregate-functions-and-modifiers.html">
14.19 Aggregate Functions
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="aggregate-functions.html">
14.19.1 Aggregate Function Descriptions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-by-modifiers.html">
14.19.2 GROUP BY Modifiers
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-by-handling.html">
14.19.3 MySQL Handling of GROUP BY
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-by-functional-dependence.html">
14.19.4 Detection of Functional Dependence
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="window-functions.html">
14.20 Window Functions
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="window-function-descriptions.html">
14.20.1 Window Function Descriptions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="window-functions-usage.html">
14.20.2 Window Function Concepts and Syntax
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="window-functions-frames.html">
14.20.3 Window Function Frame Specification
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="window-functions-named-windows.html">
14.20.4 Named Windows
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="window-function-restrictions.html">
14.20.5 Window Function Restrictions
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="performance-schema-functions.html">
14.21 Performance Schema Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="internal-functions.html">
14.22 Internal Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="miscellaneous-functions.html">
14.23 Miscellaneous Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="precision-math.html">
14.24 Precision Math
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="precision-math-numbers.html">
14.24.1 Types of Numeric Values
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="precision-math-decimal-characteristics.html">
14.24.2 DECIMAL Data Type Characteristics
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="precision-math-expressions.html">
14.24.3 Expression Handling
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="precision-math-rounding.html">
14.24.4 Rounding Behavior
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="precision-math-examples.html">
14.24.5 Precision Math Examples
</a>
</span>
</dt>
</dl>
</dd>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="sql-statements.html">
15 SQL Statements
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="sql-data-definition-statements.html">
15.1 Data Definition Statements
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="atomic-ddl.html">
15.1.1 Atomic Data Definition Statement Support
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="alter-database.html">
15.1.2 ALTER DATABASE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="alter-event.html">
15.1.3 ALTER EVENT Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="alter-function.html">
15.1.4 ALTER FUNCTION Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="alter-instance.html">
15.1.5 ALTER INSTANCE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="alter-logfile-group.html">
15.1.6 ALTER LOGFILE GROUP Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="alter-procedure.html">
15.1.7 ALTER PROCEDURE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="alter-server.html">
15.1.8 ALTER SERVER Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="alter-table.html">
15.1.9 ALTER TABLE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="alter-tablespace.html">
15.1.10 ALTER TABLESPACE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="alter-view.html">
15.1.11 ALTER VIEW Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="create-database.html">
15.1.12 CREATE DATABASE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="create-event.html">
15.1.13 CREATE EVENT Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="create-function.html">
15.1.14 CREATE FUNCTION Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="create-index.html">
15.1.15 CREATE INDEX Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="create-logfile-group.html">
15.1.16 CREATE LOGFILE GROUP Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="create-procedure.html">
15.1.17 CREATE PROCEDURE and CREATE FUNCTION Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="create-server.html">
15.1.18 CREATE SERVER Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="create-spatial-reference-system.html">
15.1.19 CREATE SPATIAL REFERENCE SYSTEM Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="create-table.html">
15.1.20 CREATE TABLE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="create-tablespace.html">
15.1.21 CREATE TABLESPACE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="create-trigger.html">
15.1.22 CREATE TRIGGER Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="create-view.html">
15.1.23 CREATE VIEW Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="drop-database.html">
15.1.24 DROP DATABASE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="drop-event.html">
15.1.25 DROP EVENT Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="drop-function.html">
15.1.26 DROP FUNCTION Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="drop-index.html">
15.1.27 DROP INDEX Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="drop-logfile-group.html">
15.1.28 DROP LOGFILE GROUP Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="drop-procedure.html">
15.1.29 DROP PROCEDURE and DROP FUNCTION Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="drop-server.html">
15.1.30 DROP SERVER Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="drop-spatial-reference-system.html">
15.1.31 DROP SPATIAL REFERENCE SYSTEM Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="drop-table.html">
15.1.32 DROP TABLE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="drop-tablespace.html">
15.1.33 DROP TABLESPACE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="drop-trigger.html">
15.1.34 DROP TRIGGER Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="drop-view.html">
15.1.35 DROP VIEW Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="rename-table.html">
15.1.36 RENAME TABLE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="truncate-table.html">
15.1.37 TRUNCATE TABLE Statement
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="sql-data-manipulation-statements.html">
15.2 Data Manipulation Statements
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="call.html">
15.2.1 CALL Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="delete.html">
15.2.2 DELETE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="do.html">
15.2.3 DO Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="except.html">
15.2.4 EXCEPT Clause
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="handler.html">
15.2.5 HANDLER Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="import-table.html">
15.2.6 IMPORT TABLE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="insert.html">
15.2.7 INSERT Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="intersect.html">
15.2.8 INTERSECT Clause
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="load-data.html">
15.2.9 LOAD DATA Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="load-xml.html">
15.2.10 LOAD XML Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="parenthesized-query-expressions.html">
15.2.11 Parenthesized Query Expressions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replace.html">
15.2.12 REPLACE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="select.html">
15.2.13 SELECT Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="set-operations.html">
15.2.14 Set Operations with UNION, INTERSECT, and EXCEPT
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="subqueries.html">
15.2.15 Subqueries
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="table.html">
15.2.16 TABLE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="update.html">
15.2.17 UPDATE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="union.html">
15.2.18 UNION Clause
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="values.html">
15.2.19 VALUES Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="with.html">
15.2.20 WITH (Common Table Expressions)
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="sql-transactional-statements.html">
15.3 Transactional and Locking Statements
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="commit.html">
15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="cannot-roll-back.html">
15.3.2 Statements That Cannot Be Rolled Back
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="implicit-commit.html">
15.3.3 Statements That Cause an Implicit Commit
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="savepoint.html">
15.3.4 SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="lock-instance-for-backup.html">
15.3.5 LOCK INSTANCE FOR BACKUP and UNLOCK INSTANCE Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="lock-tables.html">
15.3.6 LOCK TABLES and UNLOCK TABLES Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="set-transaction.html">
15.3.7 SET TRANSACTION Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="xa.html">
15.3.8 XA Transactions
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="sql-replication-statements.html">
15.4 Replication Statements
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="replication-statements-source.html">
15.4.1 SQL Statements for Controlling Source Servers
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-statements-replica.html">
15.4.2 SQL Statements for Controlling Replica Servers
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-statements-group.html">
15.4.3 SQL Statements for Controlling Group Replication
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="sql-prepared-statements.html">
15.5 Prepared Statements
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="prepare.html">
15.5.1 PREPARE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="execute.html">
15.5.2 EXECUTE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="deallocate-prepare.html">
15.5.3 DEALLOCATE PREPARE Statement
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="sql-compound-statements.html">
15.6 Compound Statement Syntax
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="begin-end.html">
15.6.1 BEGIN ... END Compound Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="statement-labels.html">
15.6.2 Statement Labels
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="declare.html">
15.6.3 DECLARE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="stored-program-variables.html">
15.6.4 Variables in Stored Programs
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="flow-control-statements.html">
15.6.5 Flow Control Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="cursors.html">
15.6.6 Cursors
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="condition-handling.html">
15.6.7 Condition Handling
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="condition-handling-restrictions.html">
15.6.8 Restrictions on Condition Handling
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="sql-server-administration-statements.html">
15.7 Database Administration Statements
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="account-management-statements.html">
15.7.1 Account Management Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="resource-group-statements.html">
15.7.2 Resource Group Management Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="table-maintenance-statements.html">
15.7.3 Table Maintenance Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="component-statements.html">
15.7.4 Component, Plugin, and Loadable Function Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="clone.html">
15.7.5 CLONE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="set-statement.html">
15.7.6 SET Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="show.html">
15.7.7 SHOW Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="other-administrative-statements.html">
15.7.8 Other Administrative Statements
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="sql-utility-statements.html">
15.8 Utility Statements
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="describe.html">
15.8.1 DESCRIBE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="explain.html">
15.8.2 EXPLAIN Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="help.html">
15.8.3 HELP Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="use.html">
15.8.4 USE Statement
</a>
</span>
</dt>
</dl>
</dd>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="data-dictionary.html">
16 MySQL Data Dictionary
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="data-dictionary-schema.html">
16.1 Data Dictionary Schema
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="data-dictionary-file-removal.html">
16.2 Removal of File-based Metadata Storage
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="data-dictionary-transactional-storage.html">
16.3 Transactional Storage of Dictionary Data
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="data-dictionary-object-cache.html">
16.4 Dictionary Object Cache
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="data-dictionary-information-schema.html">
16.5 INFORMATION_SCHEMA and Data Dictionary Integration
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="serialized-dictionary-information.html">
16.6 Serialized Dictionary Information (SDI)
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="data-dictionary-usage-differences.html">
16.7 Data Dictionary Usage Differences
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="data-dictionary-limitations.html">
16.8 Data Dictionary Limitations
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="innodb-storage-engine.html">
17 The InnoDB Storage Engine
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-introduction.html">
17.1 Introduction to InnoDB
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-benefits.html">
17.1.1 Benefits of Using InnoDB Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-best-practices.html">
17.1.2 Best Practices for InnoDB Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-check-availability.html">
17.1.3 Verifying that InnoDB is the Default Storage Engine
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-benchmarking.html">
17.1.4 Testing and Benchmarking with InnoDB
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="mysql-acid.html">
17.2 InnoDB and the ACID Model
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-multi-versioning.html">
17.3 InnoDB Multi-Versioning
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-architecture.html">
17.4 InnoDB Architecture
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-in-memory-structures.html">
17.5 InnoDB In-Memory Structures
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-buffer-pool.html">
17.5.1 Buffer Pool
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-change-buffer.html">
17.5.2 Change Buffer
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-adaptive-hash.html">
17.5.3 Adaptive Hash Index
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-redo-log-buffer.html">
17.5.4 Log Buffer
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-on-disk-structures.html">
17.6 InnoDB On-Disk Structures
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-tables.html">
17.6.1 Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-indexes.html">
17.6.2 Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-tablespace.html">
17.6.3 Tablespaces
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-doublewrite-buffer.html">
17.6.4 Doublewrite Buffer
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-redo-log.html">
17.6.5 Redo Log
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-undo-logs.html">
17.6.6 Undo Logs
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-locking-transaction-model.html">
17.7 InnoDB Locking and Transaction Model
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-locking.html">
17.7.1 InnoDB Locking
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-transaction-model.html">
17.7.2 InnoDB Transaction Model
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-locks-set.html">
17.7.3 Locks Set by Different SQL Statements in InnoDB
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-next-key-locking.html">
17.7.4 Phantom Rows
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-deadlocks.html">
17.7.5 Deadlocks in InnoDB
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-transaction-scheduling.html">
17.7.6 Transaction Scheduling
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-configuration.html">
17.8 InnoDB Configuration
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-init-startup-configuration.html">
17.8.1 InnoDB Startup Configuration
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-read-only-instance.html">
17.8.2 Configuring InnoDB for Read-Only Operation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-performance-buffer-pool.html">
17.8.3 InnoDB Buffer Pool Configuration
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-performance-thread_concurrency.html">
17.8.4 Configuring Thread Concurrency for InnoDB
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-performance-multiple_io_threads.html">
17.8.5 Configuring the Number of Background InnoDB I/O Threads
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-linux-native-aio.html">
17.8.6 Using Asynchronous I/O on Linux
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-configuring-io-capacity.html">
17.8.7 Configuring InnoDB I/O Capacity
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-performance-spin_lock_polling.html">
17.8.8 Configuring Spin Lock Polling
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-purge-configuration.html">
17.8.9 Purge Configuration
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-performance-optimizer-statistics.html">
17.8.10 Configuring Optimizer Statistics for InnoDB
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="index-page-merge-threshold.html">
17.8.11 Configuring the Merge Threshold for Index Pages
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-dedicated-server.html">
17.8.12 Enabling Automatic InnoDB Configuration for a Dedicated MySQL Server
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-compression.html">
17.9 InnoDB Table and Page Compression
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-table-compression.html">
17.9.1 InnoDB Table Compression
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-page-compression.html">
17.9.2 InnoDB Page Compression
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-row-format.html">
17.10 InnoDB Row Formats
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-disk-management.html">
17.11 InnoDB Disk I/O and File Space Management
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-disk-io.html">
17.11.1 InnoDB Disk I/O
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-file-space.html">
17.11.2 File Space Management
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-checkpoints.html">
17.11.3 InnoDB Checkpoints
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-file-defragmenting.html">
17.11.4 Defragmenting a Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-truncate-table-reclaim-space.html">
17.11.5 Reclaiming Disk Space with TRUNCATE TABLE
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-online-ddl.html">
17.12 InnoDB and Online DDL
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-online-ddl-operations.html">
17.12.1 Online DDL Operations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-online-ddl-performance.html">
17.12.2 Online DDL Performance and Concurrency
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-online-ddl-space-requirements.html">
17.12.3 Online DDL Space Requirements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="online-ddl-memory-management.html">
17.12.4 Online DDL Memory Management
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="online-ddl-parallel-thread-configuration.html">
17.12.5 Configuring Parallel Threads for Online DDL Operations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-online-ddl-single-multi.html">
17.12.6 Simplifying DDL Statements with Online DDL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-online-ddl-failure-conditions.html">
17.12.7 Online DDL Failure Conditions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-online-ddl-limitations.html">
17.12.8 Online DDL Limitations
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-data-encryption.html">
17.13 InnoDB Data-at-Rest Encryption
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-parameters.html">
17.14 InnoDB Startup Options and System Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-information-schema.html">
17.15 InnoDB INFORMATION_SCHEMA Tables
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-information-schema-compression-tables.html">
17.15.1 InnoDB INFORMATION_SCHEMA Tables about Compression
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-information-schema-transactions.html">
17.15.2 InnoDB INFORMATION_SCHEMA Transaction and Locking Information
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-information-schema-system-tables.html">
17.15.3 InnoDB INFORMATION_SCHEMA Schema Object Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-information-schema-fulltext_index-tables.html">
17.15.4 InnoDB INFORMATION_SCHEMA FULLTEXT Index Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-information-schema-buffer-pool-tables.html">
17.15.5 InnoDB INFORMATION_SCHEMA Buffer Pool Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-information-schema-metrics-table.html">
17.15.6 InnoDB INFORMATION_SCHEMA Metrics Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-information-schema-temp-table-info.html">
17.15.7 InnoDB INFORMATION_SCHEMA Temporary Table Info Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-information-schema-files-table.html">
17.15.8 Retrieving InnoDB Tablespace Metadata from INFORMATION_SCHEMA.FILES
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-performance-schema.html">
17.16 InnoDB Integration with MySQL Performance Schema
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="monitor-alter-table-performance-schema.html">
17.16.1 Monitoring ALTER TABLE Progress for InnoDB Tables Using Performance
Schema
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="monitor-innodb-mutex-waits-performance-schema.html">
17.16.2 Monitoring InnoDB Mutex Waits Using Performance Schema
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-monitors.html">
17.17 InnoDB Monitors
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-monitor-types.html">
17.17.1 InnoDB Monitor Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-enabling-monitors.html">
17.17.2 Enabling InnoDB Monitors
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-standard-monitor.html">
17.17.3 InnoDB Standard Monitor and Lock Monitor Output
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-backup-recovery.html">
17.18 InnoDB Backup and Recovery
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-backup.html">
17.18.1 InnoDB Backup
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-recovery.html">
17.18.2 InnoDB Recovery
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-and-mysql-replication.html">
17.19 InnoDB and MySQL Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-troubleshooting.html">
17.20 InnoDB Troubleshooting
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="error-creating-innodb.html">
17.20.1 Troubleshooting InnoDB I/O Problems
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-troubleshooting-recovery.html">
17.20.2 Troubleshooting Recovery Failures
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="forcing-innodb-recovery.html">
17.20.3 Forcing InnoDB Recovery
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-troubleshooting-datadict.html">
17.20.4 Troubleshooting InnoDB Data Dictionary Operations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-error-handling.html">
17.20.5 InnoDB Error Handling
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-limits.html">
17.21 InnoDB Limits
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-restrictions-limitations.html">
17.22 InnoDB Restrictions and Limitations
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="storage-engines.html">
18 Alternative Storage Engines
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="storage-engine-setting.html">
18.1 Setting the Storage Engine
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisam-storage-engine.html">
18.2 The MyISAM Storage Engine
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="myisam-start.html">
18.2.1 MyISAM Startup Options
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="key-space.html">
18.2.2 Space Needed for Keys
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisam-table-formats.html">
18.2.3 MyISAM Table Storage Formats
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisam-table-problems.html">
18.2.4 MyISAM Table Problems
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="memory-storage-engine.html">
18.3 The MEMORY Storage Engine
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="csv-storage-engine.html">
18.4 The CSV Storage Engine
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="se-csv-repair.html">
18.4.1 Repairing and Checking CSV Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="se-csv-limitations.html">
18.4.2 CSV Limitations
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="archive-storage-engine.html">
18.5 The ARCHIVE Storage Engine
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="blackhole-storage-engine.html">
18.6 The BLACKHOLE Storage Engine
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="merge-storage-engine.html">
18.7 The MERGE Storage Engine
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="merge-table-advantages.html">
18.7.1 MERGE Table Advantages and Disadvantages
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="merge-table-problems.html">
18.7.2 MERGE Table Problems
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="federated-storage-engine.html">
18.8 The FEDERATED Storage Engine
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="federated-description.html">
18.8.1 FEDERATED Storage Engine Overview
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="federated-create.html">
18.8.2 How to Create FEDERATED Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="federated-usagenotes.html">
18.8.3 FEDERATED Storage Engine Notes and Tips
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="federated-storage-engine-resources.html">
18.8.4 FEDERATED Storage Engine Resources
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="example-storage-engine.html">
18.9 The EXAMPLE Storage Engine
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="storage-engines-other.html">
18.10 Other Storage Engines
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="pluggable-storage-overview.html">
18.11 Overview of MySQL Storage Engine Architecture
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="pluggable-storage.html">
18.11.1 Pluggable Storage Engine Architecture
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="pluggable-storage-common-layer.html">
18.11.2 The Common Database Server Layer
</a>
</span>
</dt>
</dl>
</dd>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="replication.html">
19 Replication
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="replication-configuration.html">
19.1 Configuring Replication
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="binlog-replication-configuration-overview.html">
19.1.1 Binary Log File Position Based Replication Configuration Overview
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-howto.html">
19.1.2 Setting Up Binary Log File Position Based Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-gtids.html">
19.1.3 Replication with Global Transaction Identifiers
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-mode-change-online.html">
19.1.4 Changing GTID Mode on Online Servers
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-multi-source.html">
19.1.5 MySQL Multi-Source Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-options.html">
19.1.6 Replication and Binary Logging Options and Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-administration.html">
19.1.7 Common Replication Administration Tasks
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="replication-implementation.html">
19.2 Replication Implementation
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="replication-formats.html">
19.2.1 Replication Formats
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-channels.html">
19.2.2 Replication Channels
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-threads.html">
19.2.3 Replication Threads
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replica-logs.html">
19.2.4 Relay Log and Replication Metadata Repositories
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-rules.html">
19.2.5 How Servers Evaluate Replication Filtering Rules
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="replication-security.html">
19.3 Replication Security
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="replication-encrypted-connections.html">
19.3.1 Setting Up Replication to Use Encrypted Connections
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-binlog-encryption.html">
19.3.2 Encrypting Binary Log Files and Relay Log Files
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-privilege-checks.html">
19.3.3 Replication Privilege Checks
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="replication-solutions.html">
19.4 Replication Solutions
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="replication-solutions-backups.html">
19.4.1 Using Replication for Backups
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-solutions-unexpected-replica-halt.html">
19.4.2 Handling an Unexpected Halt of a Replica
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-solutions-rbr-monitoring.html">
19.4.3 Monitoring Row-based Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-solutions-diffengines.html">
19.4.4 Using Replication with Different Source and Replica Storage Engines
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-solutions-scaleout.html">
19.4.5 Using Replication for Scale-Out
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-solutions-partitioning.html">
19.4.6 Replicating Different Databases to Different Replicas
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-solutions-performance.html">
19.4.7 Improving Replication Performance
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-solutions-switch.html">
19.4.8 Switching Sources During Failover
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-asynchronous-connection-failover.html">
19.4.9 Switching Sources and Replicas with Asynchronous Connection Failover
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-semisync.html">
19.4.10 Semisynchronous Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-delayed.html">
19.4.11 Delayed Replication
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="replication-notes.html">
19.5 Replication Notes and Tips
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="replication-features.html">
19.5.1 Replication Features and Issues
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-compatibility.html">
19.5.2 Replication Compatibility Between MySQL Versions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-upgrade.html">
19.5.3 Upgrading or Downgrading a Replication Topology
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-problems.html">
19.5.4 Troubleshooting Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-bugs.html">
19.5.5 How to Report Replication Bugs or Problems
</a>
</span>
</dt>
</dl>
</dd>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="group-replication.html">
20 Group Replication
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="group-replication-background.html">
20.1 Group Replication Background
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="group-replication-replication-technologies.html">
20.1.1 Replication Technologies
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-use-cases.html">
20.1.2 Group Replication Use Cases
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-deploying-in-multi-primary-or-single-primary-mode.html">
20.1.3 Multi-Primary and Single-Primary Modes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-details.html">
20.1.4 Group Replication Services
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-plugin-architecture.html">
20.1.5 Group Replication Plugin Architecture
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="group-replication-getting-started.html">
20.2 Getting Started
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="group-replication-deploying-in-single-primary-mode.html">
20.2.1 Deploying Group Replication in Single-Primary Mode
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-deploying-locally.html">
20.2.2 Deploying Group Replication Locally
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="group-replication-requirements-and-limitations.html">
20.3 Requirements and Limitations
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="group-replication-requirements.html">
20.3.1 Group Replication Requirements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-limitations.html">
20.3.2 Group Replication Limitations
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="group-replication-monitoring.html">
20.4 Monitoring Group Replication
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="group-replication-gtids.html">
20.4.1 GTIDs and Group Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-server-states.html">
20.4.2 Group Replication Server States
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-replication-group-members.html">
20.4.3 The replication_group_members Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-replication-group-member-stats.html">
20.4.4 The replication_group_member_stats Table
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="group-replication-operations.html">
20.5 Group Replication Operations
</a>
</span>
</dt>
<dd>
<dl>
<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>
</dd>
<dt>
<span class="section">
<a href="group-replication-security.html">
20.6 Group Replication Security
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="group-replication-connection-security.html">
20.6.1 Communication Stack for Connection Security Management
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-secure-socket-layer-support-ssl.html">
20.6.2 Securing Group Communication Connections with Secure Socket Layer (SSL)
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-distributed-recovery-securing.html">
20.6.3 Securing Distributed Recovery Connections
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-ip-address-permissions.html">
20.6.4 Group Replication IP Address Permissions
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="group-replication-performance.html">
20.7 Group Replication Performance and Troubleshooting
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="group-replication-fine-tuning-the-group-communication-thread.html">
20.7.1 Fine Tuning the Group Communication Thread
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-flow-control.html">
20.7.2 Flow Control
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-single-consensus-leader.html">
20.7.3 Single Consensus Leader
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-message-compression.html">
20.7.4 Message Compression
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-performance-message-fragmentation.html">
20.7.5 Message Fragmentation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-performance-xcom-cache.html">
20.7.6 XCom Cache Management
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-responses-failure.html">
20.7.7 Responses to Failure Detection and Network Partitioning
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-network-partitioning.html">
20.7.8 Handling a Network Partition and Loss of Quorum
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-gr-memory-monitoring-ps-instruments.html">
20.7.9 Monitoring Group Replication Memory Usage with Performance Schema Memory
Instrumentation
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="group-replication-upgrade.html">
20.8 Upgrading Group Replication
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="group-replication-online-upgrade-combining-versions.html">
20.8.1 Combining Different Member Versions in a Group
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-offline-upgrade.html">
20.8.2 Group Replication Offline Upgrade
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-online-upgrade.html">
20.8.3 Group Replication Online Upgrade
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="group-replication-options.html">
20.9 Group Replication Variables
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="group-replication-system-variables.html">
20.9.1 Group Replication System Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-status-variables.html">
20.9.2 Group Replication Status Variables
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="group-replication-frequently-asked-questions.html">
20.10 Frequently Asked Questions
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="mysql-shell-userguide.html">
21 MySQL Shell
</a>
</span>
</dt>
<dt>
<span class="chapter">
<a href="document-store.html">
22 Using MySQL as a Document Store
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="document-store-interfaces.html">
22.1 Interfaces to a MySQL Document Store
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="document-store-concepts.html">
22.2 Document Store Concepts
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-shell-tutorial-javascript.html">
22.3 JavaScript Quick-Start Guide: MySQL Shell for Document Store
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysql-shell-tutorial-javascript-shell.html">
22.3.1 MySQL Shell
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-shell-tutorial-javascript-download.html">
22.3.2 Download and Import world_x Database
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-shell-tutorial-javascript-documents-collections.html">
22.3.3 Documents and Collections
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-shell-tutorial-javascript-relational-tables.html">
22.3.4 Relational Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-shell-tutorial-javascript-documents-in-tables.html">
22.3.5 Documents in Tables
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="mysql-shell-tutorial-python.html">
22.4 Python Quick-Start Guide: MySQL Shell for Document Store
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysql-shell-tutorial-python-shell.html">
22.4.1 MySQL Shell
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-shell-tutorial-python-download.html">
22.4.2 Download and Import world_x Database
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-shell-tutorial-python-documents-collections.html">
22.4.3 Documents and Collections
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-shell-tutorial-python-relational-tables.html">
22.4.4 Relational Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-shell-tutorial-python-documents-in-tables.html">
22.4.5 Documents in Tables
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="x-plugin.html">
22.5 X Plugin
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="x-plugin-checking-installation.html">
22.5.1 Checking X Plugin Installation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="x-plugin-disabling.html">
22.5.2 Disabling X Plugin
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="x-plugin-encrypted-connections.html">
22.5.3 Using Encrypted Connections with X Plugin
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="x-plugin-sha2-cache-plugin.html">
22.5.4 Using X Plugin with the Caching SHA-2 Authentication Plugin
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="x-plugin-connection-compression.html">
22.5.5 Connection Compression with X Plugin
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="x-plugin-options-variables.html">
22.5.6 X Plugin Options and Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="x-plugin-system-monitoring.html">
22.5.7 Monitoring X Plugin
</a>
</span>
</dt>
</dl>
</dd>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="mysql-innodb-cluster-introduction.html">
23 InnoDB Cluster
</a>
</span>
</dt>
<dt>
<span class="chapter">
<a href="mysql-innodb-replicaset-introduction.html">
24 InnoDB ReplicaSet
</a>
</span>
</dt>
<dt>
<span class="chapter">
<a href="mysql-cluster.html">
25 MySQL NDB Cluster 8.4
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysql-cluster-general-info.html">
25.1 General Information
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-overview.html">
25.2 NDB Cluster Overview
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysql-cluster-basics.html">
25.2.1 NDB Cluster Core Concepts
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-nodes-groups.html">
25.2.2 NDB Cluster Nodes, Node Groups, Fragment Replicas, and Partitions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-overview-requirements.html">
25.2.3 NDB Cluster Hardware, Software, and Networking Requirements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-what-is-new.html">
25.2.4 What is New in MySQL NDB Cluster 8.4
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-added-deprecated-removed.html">
25.2.5 Options, Variables, and Parameters Added, Deprecated or Removed in NDB
8.4
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-compared.html">
25.2.6 MySQL Server Using InnoDB Compared with NDB Cluster
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-limitations.html">
25.2.7 Known Limitations of NDB Cluster
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="mysql-cluster-installation.html">
25.3 NDB Cluster Installation
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysql-cluster-install-linux.html">
25.3.1 Installation of NDB Cluster on Linux
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-install-windows.html">
25.3.2 Installing NDB Cluster on Windows
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-install-configuration.html">
25.3.3 Initial Configuration of NDB Cluster
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-install-first-start.html">
25.3.4 Initial Startup of NDB Cluster
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-install-example-data.html">
25.3.5 NDB Cluster Example with Tables and Data
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-install-shutdown-restart.html">
25.3.6 Safe Shutdown and Restart of NDB Cluster
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-upgrade-downgrade.html">
25.3.7 Upgrading and Downgrading NDB Cluster
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="mysql-cluster-configuration.html">
25.4 Configuration of NDB Cluster
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysql-cluster-quick.html">
25.4.1 Quick Test Setup of NDB Cluster
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-configuration-overview.html">
25.4.2 Overview of NDB Cluster Configuration Parameters, Options, and Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-config-file.html">
25.4.3 NDB Cluster Configuration Files
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-interconnects.html">
25.4.4 Using High-Speed Interconnects with NDB Cluster
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="mysql-cluster-programs.html">
25.5 NDB Cluster Programs
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndbd.html">
25.5.1 ndbd — The NDB Cluster Data Node Daemon
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndbinfo-select-all.html">
25.5.2 ndbinfo_select_all — Select From ndbinfo Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndbmtd.html">
25.5.3 ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-mgmd.html">
25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-mgm.html">
25.5.5 ndb_mgm — The NDB Cluster Management Client
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-blob-tool.html">
25.5.6 ndb_blob_tool — Check and Repair BLOB and TEXT columns of NDB Cluster
Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-config.html">
25.5.7 ndb_config — Extract NDB Cluster Configuration Information
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-delete-all.html">
25.5.8 ndb_delete_all — Delete All Rows from an NDB Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-desc.html">
25.5.9 ndb_desc — Describe NDB Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-drop-index.html">
25.5.10 ndb_drop_index — Drop Index from an NDB Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-drop-table.html">
25.5.11 ndb_drop_table — Drop an NDB Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-error-reporter.html">
25.5.12 ndb_error_reporter — NDB Error-Reporting Utility
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-import.html">
25.5.13 ndb_import — Import CSV Data Into NDB
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-index-stat.html">
25.5.14 ndb_index_stat — NDB Index Statistics Utility
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-move-data.html">
25.5.15 ndb_move_data — NDB Data Copy Utility
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-perror.html">
25.5.16 ndb_perror — Obtain NDB Error Message Information
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-print-backup-file.html">
25.5.17 ndb_print_backup_file — Print NDB Backup File Contents
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-print-file.html">
25.5.18 ndb_print_file — Print NDB Disk Data File Contents
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-print-frag-file.html">
25.5.19 ndb_print_frag_file — Print NDB Fragment List File Contents
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-print-schema-file.html">
25.5.20 ndb_print_schema_file — Print NDB Schema File Contents
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-print-sys-file.html">
25.5.21 ndb_print_sys_file — Print NDB System File Contents
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-redo-log-reader.html">
25.5.22 ndb_redo_log_reader — Check and Print Content of Cluster Redo Log
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-restore.html">
25.5.23 ndb_restore — Restore an NDB Cluster Backup
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-secretsfile-reader.html">
25.5.24 ndb_secretsfile_reader — Obtain Key Information from an Encrypted NDB
Data File
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-select-all.html">
25.5.25 ndb_select_all — Print Rows from an NDB Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-select-count.html">
25.5.26 ndb_select_count — Print Row Counts for NDB Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-show-tables.html">
25.5.27 ndb_show_tables — Display List of NDB Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-sign-keys.html">
25.5.28 ndb_sign_keys — Create, Sign, and Manage TLS Keys and Certificates for NDB
Cluster
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-size-pl.html">
25.5.29 ndb_size.pl — NDBCLUSTER Size Requirement Estimator
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-top.html">
25.5.30 ndb_top — View CPU usage information for NDB threads
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndb-waiter.html">
25.5.31 ndb_waiter — Wait for NDB Cluster to Reach a Given Status
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-programs-ndbxfrm.html">
25.5.32 ndbxfrm — Compress, Decompress, Encrypt, and Decrypt
Files Created by NDB Cluster
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="mysql-cluster-management.html">
25.6 Management of NDB Cluster
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysql-cluster-mgm-client-commands.html">
25.6.1 Commands in the NDB Cluster Management Client
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-logs-ndb-messages.html">
25.6.2 NDB Cluster Log Messages
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-event-reports.html">
25.6.3 Event Reports Generated in NDB Cluster
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-start-phases.html">
25.6.4 Summary of NDB Cluster Start Phases
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-rolling-restart.html">
25.6.5 Performing a Rolling Restart of an NDB Cluster
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-single-user-mode.html">
25.6.6 NDB Cluster Single User Mode
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-online-add-node.html">
25.6.7 Adding NDB Cluster Data Nodes Online
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-backup.html">
25.6.8 Online Backup of NDB Cluster
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-importing-data.html">
25.6.9 Importing Data Into MySQL Cluster
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-mysqld.html">
25.6.10 MySQL Server Usage for NDB Cluster
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-disk-data.html">
25.6.11 NDB Cluster Disk Data Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-online-operations.html">
25.6.12 Online Operations with ALTER TABLE in NDB Cluster
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-privilege-synchronization.html">
25.6.13 Privilege Synchronization and NDB_STORED_USER
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-tde.html">
25.6.14 File System Encryption for NDB Cluster
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-tls.html">
25.6.15 TLS Link Encryption for NDB Cluster
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-ndb-api-statistics.html">
25.6.16 NDB API Statistics Counters and Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-ndbinfo.html">
25.6.17 ndbinfo: The NDB Cluster Information Database
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-information-schema-tables.html">
25.6.18 INFORMATION_SCHEMA Tables for NDB Cluster
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-ps-tables.html">
25.6.19 NDB Cluster and the Performance Schema
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-sql-statements.html">
25.6.20 Quick Reference: NDB Cluster SQL Statements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-security.html">
25.6.21 NDB Cluster Security Issues
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="mysql-cluster-replication.html">
25.7 NDB Cluster Replication
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysql-cluster-replication-abbreviations.html">
25.7.1 NDB Cluster Replication: Abbreviations and Symbols
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-replication-general.html">
25.7.2 General Requirements for NDB Cluster Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-replication-issues.html">
25.7.3 Known Issues in NDB Cluster Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-replication-schema.html">
25.7.4 NDB Cluster Replication Schema and Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-replication-preparation.html">
25.7.5 Preparing the NDB Cluster for Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-replication-starting.html">
25.7.6 Starting NDB Cluster Replication (Single Replication Channel)
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-replication-two-channels.html">
25.7.7 Using Two Replication Channels for NDB Cluster Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-replication-failover.html">
25.7.8 Implementing Failover with NDB Cluster Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-replication-backups.html">
25.7.9 NDB Cluster Backups With NDB Cluster Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-replication-multi-source.html">
25.7.10 NDB Cluster Replication: Bidirectional and Circular Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-replication-mta.html">
25.7.11 NDB Cluster Replication Using the Multithreaded Applier
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-replication-conflict-resolution.html">
25.7.12 NDB Cluster Replication Conflict Resolution
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="mysql-cluster-news.html">
25.8 NDB Cluster Release Notes
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="partitioning.html">
26 Partitioning
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="partitioning-overview.html">
26.1 Overview of Partitioning in MySQL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="partitioning-types.html">
26.2 Partitioning Types
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="partitioning-range.html">
26.2.1 RANGE Partitioning
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="partitioning-list.html">
26.2.2 LIST Partitioning
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="partitioning-columns.html">
26.2.3 COLUMNS Partitioning
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="partitioning-hash.html">
26.2.4 HASH Partitioning
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="partitioning-key.html">
26.2.5 KEY Partitioning
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="partitioning-subpartitions.html">
26.2.6 Subpartitioning
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="partitioning-handling-nulls.html">
26.2.7 How MySQL Partitioning Handles NULL
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="partitioning-management.html">
26.3 Partition Management
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="partitioning-management-range-list.html">
26.3.1 Management of RANGE and LIST Partitions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="partitioning-management-hash-key.html">
26.3.2 Management of HASH and KEY Partitions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="partitioning-management-exchange.html">
26.3.3 Exchanging Partitions and Subpartitions with Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="partitioning-maintenance.html">
26.3.4 Maintenance of Partitions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="partitioning-info.html">
26.3.5 Obtaining Information About Partitions
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="partitioning-pruning.html">
26.4 Partition Pruning
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="partitioning-selection.html">
26.5 Partition Selection
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="partitioning-limitations.html">
26.6 Restrictions and Limitations on Partitioning
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="partitioning-limitations-partitioning-keys-unique-keys.html">
26.6.1 Partitioning Keys, Primary Keys, and Unique Keys
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="partitioning-limitations-storage-engines.html">
26.6.2 Partitioning Limitations Relating to Storage Engines
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="partitioning-limitations-functions.html">
26.6.3 Partitioning Limitations Relating to Functions
</a>
</span>
</dt>
</dl>
</dd>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="stored-objects.html">
27 Stored Objects
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="stored-programs-defining.html">
27.1 Defining Stored Programs
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="stored-routines.html">
27.2 Using Stored Routines
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="stored-routines-syntax.html">
27.2.1 Stored Routine Syntax
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="stored-routines-privileges.html">
27.2.2 Stored Routines and MySQL Privileges
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="stored-routines-metadata.html">
27.2.3 Stored Routine Metadata
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="stored-routines-last-insert-id.html">
27.2.4 Stored Procedures, Functions, Triggers, and LAST_INSERT_ID()
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="triggers.html">
27.3 Using Triggers
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="trigger-syntax.html">
27.3.1 Trigger Syntax and Examples
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="trigger-metadata.html">
27.3.2 Trigger Metadata
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="event-scheduler.html">
27.4 Using the Event Scheduler
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="events-overview.html">
27.4.1 Event Scheduler Overview
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="events-configuration.html">
27.4.2 Event Scheduler Configuration
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="events-syntax.html">
27.4.3 Event Syntax
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="events-metadata.html">
27.4.4 Event Metadata
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="events-status-info.html">
27.4.5 Event Scheduler Status
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="events-privileges.html">
27.4.6 The Event Scheduler and MySQL Privileges
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="views.html">
27.5 Using Views
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="view-syntax.html">
27.5.1 View Syntax
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="view-algorithms.html">
27.5.2 View Processing Algorithms
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="view-updatability.html">
27.5.3 Updatable and Insertable Views
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="view-check-option.html">
27.5.4 The View WITH CHECK OPTION Clause
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="view-metadata.html">
27.5.5 View Metadata
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="stored-objects-security.html">
27.6 Stored Object Access Control
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="stored-programs-logging.html">
27.7 Stored Program Binary Logging
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="stored-program-restrictions.html">
27.8 Restrictions on Stored Programs
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="view-restrictions.html">
27.9 Restrictions on Views
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="information-schema.html">
28 INFORMATION_SCHEMA Tables
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="information-schema-introduction.html">
28.1 Introduction
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-table-reference.html">
28.2 INFORMATION_SCHEMA Table Reference
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="general-information-schema-tables.html">
28.3 INFORMATION_SCHEMA General Tables
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="information-schema-general-table-reference.html">
28.3.1 INFORMATION_SCHEMA General Table Reference
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-administrable-role-authorizations-table.html">
28.3.2 The INFORMATION_SCHEMA ADMINISTRABLE_ROLE_AUTHORIZATIONS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-applicable-roles-table.html">
28.3.3 The INFORMATION_SCHEMA APPLICABLE_ROLES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-character-sets-table.html">
28.3.4 The INFORMATION_SCHEMA CHARACTER_SETS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-check-constraints-table.html">
28.3.5 The INFORMATION_SCHEMA CHECK_CONSTRAINTS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-collations-table.html">
28.3.6 The INFORMATION_SCHEMA COLLATIONS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-collation-character-set-applicability-table.html">
28.3.7 The INFORMATION_SCHEMA COLLATION_CHARACTER_SET_APPLICABILITY Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-columns-table.html">
28.3.8 The INFORMATION_SCHEMA COLUMNS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-columns-extensions-table.html">
28.3.9 The INFORMATION_SCHEMA COLUMNS_EXTENSIONS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-column-privileges-table.html">
28.3.10 The INFORMATION_SCHEMA COLUMN_PRIVILEGES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-column-statistics-table.html">
28.3.11 The INFORMATION_SCHEMA COLUMN_STATISTICS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-enabled-roles-table.html">
28.3.12 The INFORMATION_SCHEMA ENABLED_ROLES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-engines-table.html">
28.3.13 The INFORMATION_SCHEMA ENGINES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-events-table.html">
28.3.14 The INFORMATION_SCHEMA EVENTS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-files-table.html">
28.3.15 The INFORMATION_SCHEMA FILES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-key-column-usage-table.html">
28.3.16 The INFORMATION_SCHEMA KEY_COLUMN_USAGE Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-keywords-table.html">
28.3.17 The INFORMATION_SCHEMA KEYWORDS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-ndb-transid-mysql-connection-map-table.html">
28.3.18 The INFORMATION_SCHEMA ndb_transid_mysql_connection_map Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-optimizer-trace-table.html">
28.3.19 The INFORMATION_SCHEMA OPTIMIZER_TRACE Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-parameters-table.html">
28.3.20 The INFORMATION_SCHEMA PARAMETERS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-partitions-table.html">
28.3.21 The INFORMATION_SCHEMA PARTITIONS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-plugins-table.html">
28.3.22 The INFORMATION_SCHEMA PLUGINS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-processlist-table.html">
28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-profiling-table.html">
28.3.24 The INFORMATION_SCHEMA PROFILING Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-referential-constraints-table.html">
28.3.25 The INFORMATION_SCHEMA REFERENTIAL_CONSTRAINTS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-resource-groups-table.html">
28.3.26 The INFORMATION_SCHEMA RESOURCE_GROUPS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-role-column-grants-table.html">
28.3.27 The INFORMATION_SCHEMA ROLE_COLUMN_GRANTS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-role-routine-grants-table.html">
28.3.28 The INFORMATION_SCHEMA ROLE_ROUTINE_GRANTS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-role-table-grants-table.html">
28.3.29 The INFORMATION_SCHEMA ROLE_TABLE_GRANTS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-routines-table.html">
28.3.30 The INFORMATION_SCHEMA ROUTINES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-schemata-table.html">
28.3.31 The INFORMATION_SCHEMA SCHEMATA Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-schemata-extensions-table.html">
28.3.32 The INFORMATION_SCHEMA SCHEMATA_EXTENSIONS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-schema-privileges-table.html">
28.3.33 The INFORMATION_SCHEMA SCHEMA_PRIVILEGES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-statistics-table.html">
28.3.34 The INFORMATION_SCHEMA STATISTICS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-st-geometry-columns-table.html">
28.3.35 The INFORMATION_SCHEMA ST_GEOMETRY_COLUMNS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-st-spatial-reference-systems-table.html">
28.3.36 The INFORMATION_SCHEMA ST_SPATIAL_REFERENCE_SYSTEMS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-st-units-of-measure-table.html">
28.3.37 The INFORMATION_SCHEMA ST_UNITS_OF_MEASURE Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-tables-table.html">
28.3.38 The INFORMATION_SCHEMA TABLES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-tables-extensions-table.html">
28.3.39 The INFORMATION_SCHEMA TABLES_EXTENSIONS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-tablespaces-extensions-table.html">
28.3.40 The INFORMATION_SCHEMA TABLESPACES_EXTENSIONS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-table-constraints-table.html">
28.3.41 The INFORMATION_SCHEMA TABLE_CONSTRAINTS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-table-constraints-extensions-table.html">
28.3.42 The INFORMATION_SCHEMA TABLE_CONSTRAINTS_EXTENSIONS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-table-privileges-table.html">
28.3.43 The INFORMATION_SCHEMA TABLE_PRIVILEGES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-triggers-table.html">
28.3.44 The INFORMATION_SCHEMA TRIGGERS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-user-attributes-table.html">
28.3.45 The INFORMATION_SCHEMA USER_ATTRIBUTES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-user-privileges-table.html">
28.3.46 The INFORMATION_SCHEMA USER_PRIVILEGES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-views-table.html">
28.3.47 The INFORMATION_SCHEMA VIEWS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-view-routine-usage-table.html">
28.3.48 The INFORMATION_SCHEMA VIEW_ROUTINE_USAGE Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-view-table-usage-table.html">
28.3.49 The INFORMATION_SCHEMA VIEW_TABLE_USAGE Table
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-information-schema-tables.html">
28.4 INFORMATION_SCHEMA InnoDB Tables
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="information-schema-innodb-table-reference.html">
28.4.1 INFORMATION_SCHEMA InnoDB Table Reference
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-buffer-page-table.html">
28.4.2 The INFORMATION_SCHEMA INNODB_BUFFER_PAGE Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-buffer-page-lru-table.html">
28.4.3 The INFORMATION_SCHEMA INNODB_BUFFER_PAGE_LRU Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-buffer-pool-stats-table.html">
28.4.4 The INFORMATION_SCHEMA INNODB_BUFFER_POOL_STATS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-cached-indexes-table.html">
28.4.5 The INFORMATION_SCHEMA INNODB_CACHED_INDEXES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-cmp-table.html">
28.4.6 The INFORMATION_SCHEMA INNODB_CMP and INNODB_CMP_RESET Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-cmpmem-table.html">
28.4.7 The INFORMATION_SCHEMA INNODB_CMPMEM and INNODB_CMPMEM_RESET Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-cmp-per-index-table.html">
28.4.8 The INFORMATION_SCHEMA INNODB_CMP_PER_INDEX and
INNODB_CMP_PER_INDEX_RESET Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-columns-table.html">
28.4.9 The INFORMATION_SCHEMA INNODB_COLUMNS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-datafiles-table.html">
28.4.10 The INFORMATION_SCHEMA INNODB_DATAFILES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-fields-table.html">
28.4.11 The INFORMATION_SCHEMA INNODB_FIELDS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-foreign-table.html">
28.4.12 The INFORMATION_SCHEMA INNODB_FOREIGN Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-foreign-cols-table.html">
28.4.13 The INFORMATION_SCHEMA INNODB_FOREIGN_COLS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-ft-being-deleted-table.html">
28.4.14 The INFORMATION_SCHEMA INNODB_FT_BEING_DELETED Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-ft-config-table.html">
28.4.15 The INFORMATION_SCHEMA INNODB_FT_CONFIG Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-ft-default-stopword-table.html">
28.4.16 The INFORMATION_SCHEMA INNODB_FT_DEFAULT_STOPWORD Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-ft-deleted-table.html">
28.4.17 The INFORMATION_SCHEMA INNODB_FT_DELETED Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-ft-index-cache-table.html">
28.4.18 The INFORMATION_SCHEMA INNODB_FT_INDEX_CACHE Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-ft-index-table-table.html">
28.4.19 The INFORMATION_SCHEMA INNODB_FT_INDEX_TABLE Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-indexes-table.html">
28.4.20 The INFORMATION_SCHEMA INNODB_INDEXES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-metrics-table.html">
28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-session-temp-tablespaces-table.html">
28.4.22 The INFORMATION_SCHEMA INNODB_SESSION_TEMP_TABLESPACES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-tables-table.html">
28.4.23 The INFORMATION_SCHEMA INNODB_TABLES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-tablespaces-table.html">
28.4.24 The INFORMATION_SCHEMA INNODB_TABLESPACES Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-tablespaces-brief-table.html">
28.4.25 The INFORMATION_SCHEMA INNODB_TABLESPACES_BRIEF Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-tablestats-table.html">
28.4.26 The INFORMATION_SCHEMA INNODB_TABLESTATS View
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-temp-table-info-table.html">
28.4.27 The INFORMATION_SCHEMA INNODB_TEMP_TABLE_INFO Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-trx-table.html">
28.4.28 The INFORMATION_SCHEMA INNODB_TRX Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-innodb-virtual-table.html">
28.4.29 The INFORMATION_SCHEMA INNODB_VIRTUAL Table
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="thread-pool-information-schema-tables.html">
28.5 INFORMATION_SCHEMA Thread Pool Tables
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="information-schema-thread-pool-table-reference.html">
28.5.1 INFORMATION_SCHEMA Thread Pool Table Reference
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-tp-thread-group-state-table.html">
28.5.2 The INFORMATION_SCHEMA TP_THREAD_GROUP_STATE Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-tp-thread-group-stats-table.html">
28.5.3 The INFORMATION_SCHEMA TP_THREAD_GROUP_STATS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-tp-thread-state-table.html">
28.5.4 The INFORMATION_SCHEMA TP_THREAD_STATE Table
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="connection-control-information-schema-tables.html">
28.6 INFORMATION_SCHEMA Connection-Control Tables
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="information-schema-connection-control-table-reference.html">
28.6.1 INFORMATION_SCHEMA Connection-Control Table Reference
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-connection-control-failed-login-attempts-table.html">
28.6.2 The INFORMATION_SCHEMA CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS Table
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="firewall-information-schema-tables.html">
28.7 INFORMATION_SCHEMA MySQL Enterprise Firewall Tables
</a>
</span>
</dt>
<dd>
<dl>
<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>
</dd>
<dt>
<span class="section">
<a href="extended-show.html">
28.8 Extensions to SHOW Statements
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="performance-schema.html">
29 MySQL Performance Schema
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="performance-schema-quick-start.html">
29.1 Performance Schema Quick Start
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-build-configuration.html">
29.2 Performance Schema Build Configuration
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-startup-configuration.html">
29.3 Performance Schema Startup Configuration
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-runtime-configuration.html">
29.4 Performance Schema Runtime Configuration
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="performance-schema-timing.html">
29.4.1 Performance Schema Event Timing
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-filtering.html">
29.4.2 Performance Schema Event Filtering
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-pre-filtering.html">
29.4.3 Event Pre-Filtering
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-instrument-filtering.html">
29.4.4 Pre-Filtering by Instrument
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-object-filtering.html">
29.4.5 Pre-Filtering by Object
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-thread-filtering.html">
29.4.6 Pre-Filtering by Thread
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-consumer-filtering.html">
29.4.7 Pre-Filtering by Consumer
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-consumer-configurations.html">
29.4.8 Example Consumer Configurations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-filtering-names.html">
29.4.9 Naming Instruments or Consumers for Filtering Operations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-instrumentation-checking.html">
29.4.10 Determining What Is Instrumented
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="performance-schema-queries.html">
29.5 Performance Schema Queries
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-instrument-naming.html">
29.6 Performance Schema Instrument Naming Conventions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-status-monitoring.html">
29.7 Performance Schema Status Monitoring
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-atom-molecule-events.html">
29.8 Performance Schema Atom and Molecule Events
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-event-tables.html">
29.9 Performance Schema Tables for Current and Historical Events
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-statement-digests.html">
29.10 Performance Schema Statement Digests and Sampling
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-table-characteristics.html">
29.11 Performance Schema General Table Characteristics
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-table-descriptions.html">
29.12 Performance Schema Table Descriptions
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="performance-schema-table-reference.html">
29.12.1 Performance Schema Table Reference
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-setup-tables.html">
29.12.2 Performance Schema Setup Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-instance-tables.html">
29.12.3 Performance Schema Instance Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-wait-tables.html">
29.12.4 Performance Schema Wait Event Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-stage-tables.html">
29.12.5 Performance Schema Stage Event Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-statement-tables.html">
29.12.6 Performance Schema Statement Event Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-transaction-tables.html">
29.12.7 Performance Schema Transaction Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-connection-tables.html">
29.12.8 Performance Schema Connection Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-connection-attribute-tables.html">
29.12.9 Performance Schema Connection Attribute Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-user-variable-tables.html">
29.12.10 Performance Schema User-Defined Variable Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-replication-tables.html">
29.12.11 Performance Schema Replication Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-ndb-cluster-tables.html">
29.12.12 Performance Schema NDB Cluster Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-lock-tables.html">
29.12.13 Performance Schema Lock Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-system-variable-tables.html">
29.12.14 Performance Schema System Variable Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-status-variable-tables.html">
29.12.15 Performance Schema Status Variable Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-thread-pool-tables.html">
29.12.16 Performance Schema Thread Pool Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-firewall-tables.html">
29.12.17 Performance Schema Firewall Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-keyring-tables.html">
29.12.18 Performance Schema Keyring Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-clone-tables.html">
29.12.19 Performance Schema Clone Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-summary-tables.html">
29.12.20 Performance Schema Summary Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-telemetry-tables.html">
29.12.21 Performance Schema Telemetry Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-miscellaneous-tables.html">
29.12.22 Performance Schema Miscellaneous Tables
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="performance-schema-option-variable-reference.html">
29.13 Performance Schema Option and Variable Reference
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-options.html">
29.14 Performance Schema Command Options
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-system-variables.html">
29.15 Performance Schema System Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-status-variables.html">
29.16 Performance Schema Status Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-memory-model.html">
29.17 The Performance Schema Memory-Allocation Model
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-and-plugins.html">
29.18 Performance Schema and Plugins
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-examples.html">
29.19 Using the Performance Schema to Diagnose Problems
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="performance-schema-query-profiling.html">
29.19.1 Query Profiling Using Performance Schema
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-obtaining-parent-events.html">
29.19.2 Obtaining Parent Event Information
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="performance-schema-restrictions.html">
29.20 Restrictions on Performance Schema
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="sys-schema.html">
30 MySQL sys Schema
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="sys-schema-prerequisites.html">
30.1 Prerequisites for Using the sys Schema
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-schema-usage.html">
30.2 Using the sys Schema
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-schema-progress-reporting.html">
30.3 sys Schema Progress Reporting
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-schema-reference.html">
30.4 sys Schema Object Reference
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="sys-schema-object-index.html">
30.4.1 sys Schema Object Index
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-schema-tables.html">
30.4.2 sys Schema Tables and Triggers
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-schema-views.html">
30.4.3 sys Schema Views
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-schema-procedures.html">
30.4.4 sys Schema Stored Procedures
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-schema-functions.html">
30.4.5 sys Schema Stored Functions
</a>
</span>
</dt>
</dl>
</dd>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="connectors-apis.html">
31 Connectors and APIs
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="connector-cpp-info.html">
31.1 MySQL Connector/C++
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connector-j-info.html">
31.2 MySQL Connector/J
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connector-net-info.html">
31.3 MySQL Connector/NET
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connector-odbc-info.html">
31.4 MySQL Connector/ODBC
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connector-python-info.html">
31.5 MySQL Connector/Python
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="connector-nodejs-info.html">
31.6 MySQL Connector/Node.js
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="c-api-info.html">
31.7 MySQL C API
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="apis-php-info.html">
31.8 MySQL PHP API
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="apis-perl.html">
31.9 MySQL Perl API
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="apis-python.html">
31.10 MySQL Python API
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="apis-ruby.html">
31.11 MySQL Ruby APIs
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="apis-ruby-mysqlruby.html">
31.11.1 The MySQL/Ruby API
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="apis-ruby-rubymysql.html">
31.11.2 The Ruby/MySQL API
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="apis-tcl.html">
31.12 MySQL Tcl API
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="apis-eiffel.html">
31.13 MySQL Eiffel Wrapper
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="mysql-enterprise.html">
32 MySQL Enterprise Edition
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysql-enterprise-backup.html">
32.1 MySQL Enterprise Backup Overview
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-enterprise-security.html">
32.2 MySQL Enterprise Security Overview
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-enterprise-encryption.html">
32.3 MySQL Enterprise Encryption Overview
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-enterprise-audit.html">
32.4 MySQL Enterprise Audit Overview
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-enterprise-firewall.html">
32.5 MySQL Enterprise Firewall Overview
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-enterprise-thread-pool.html">
32.6 MySQL Enterprise Thread Pool Overview
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-enterprise-data-masking.html">
32.7 MySQL Enterprise Data Masking and De-Identification Overview
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-enterprise-monitor.html">
32.8 MySQL Enterprise Monitor Overview
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-enterprise-telemetry.html">
32.9 MySQL Telemetry
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="workbench.html">
33 MySQL Workbench
</a>
</span>
</dt>
<dt>
<span class="chapter">
<a href="mysql-oci-marketplace.html">
34 MySQL on OCI Marketplace
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="mysql-oci-marketplace-prereqs.html">
34.1 Prerequisites to Deploying MySQL EE on Oracle Cloud Infrastructure
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-oci-marketplace-deploy.html">
34.2 Deploying MySQL EE on Oracle Cloud Infrastructure
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-oci-marketplace-network-configuration.html">
34.3 Configuring Network Access
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-oci-marketplace-connecting.html">
34.4 Connecting
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-oci-marketplace-maintenance.html">
34.5 Maintenance
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="chapter">
<a href="telemetry.html">
35 Telemetry
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="telemetry-trace-install.html">
35.1 Installing OpenTelemetry Support
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="telemetry-system-variables.html">
35.2 Telemetry Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="telemetry-trace.html">
35.3 OpenTelemetry Trace
</a>
</span>
</dt>
<dd>
<dl>
<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>
</dd>
<dt>
<span class="section">
<a href="telemetry-metrics.html">
35.4 OpenTelemetry Metrics
</a>
</span>
</dt>
<dd>
<dl>
<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>
</dd>
</dl>
</dd>
<dt>
<span class="appendix">
<a href="faqs.html">
A MySQL 8.4 Frequently Asked Questions
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="faqs-general.html">
A.1 MySQL 8.4 FAQ: General
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="faqs-storage-engines.html">
A.2 MySQL 8.4 FAQ: Storage Engines
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="faqs-sql-modes.html">
A.3 MySQL 8.4 FAQ: Server SQL Mode
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="faqs-stored-procs.html">
A.4 MySQL 8.4 FAQ: Stored Procedures and Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="faqs-triggers.html">
A.5 MySQL 8.4 FAQ: Triggers
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="faqs-views.html">
A.6 MySQL 8.4 FAQ: Views
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="faqs-information-schema.html">
A.7 MySQL 8.4 FAQ: INFORMATION_SCHEMA
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="faqs-migration.html">
A.8 MySQL 8.4 FAQ: Migration
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="faqs-security.html">
A.9 MySQL 8.4 FAQ: Security
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="faqs-mysql-cluster.html">
A.10 MySQL 8.4 FAQ: NDB Cluster
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="faqs-cjk.html">
A.11 MySQL 8.4 FAQ: MySQL Chinese, Japanese, and Korean
Character Sets
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="faqs-connectors-apis.html">
A.12 MySQL 8.4 FAQ: Connectors & APIs
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="faqs-c-api.html">
A.13 MySQL 8.4 FAQ: C API, libmysql
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="faqs-replication.html">
A.14 MySQL 8.4 FAQ: Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="faqs-thread-pool.html">
A.15 MySQL 8.4 FAQ: MySQL Enterprise Thread Pool
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="faqs-innodb-change-buffer.html">
A.16 MySQL 8.4 FAQ: InnoDB Change Buffer
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="faqs-tablespace-encryption.html">
A.17 MySQL 8.4 FAQ: InnoDB Data-at-Rest Encryption
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="faqs-virtualization.html">
A.18 MySQL 8.4 FAQ: Virtualization Support
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="appendix">
<a href="error-handling.html">
B Error Messages and Common Problems
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="error-message-elements.html">
B.1 Error Message Sources and Elements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="error-interfaces.html">
B.2 Error Information Interfaces
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="problems.html">
B.3 Problems and Common Errors
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="what-is-crashing.html">
B.3.1 How to Determine What Is Causing a Problem
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="common-errors.html">
B.3.2 Common Errors When Using MySQL Programs
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="administration-issues.html">
B.3.3 Administration-Related Issues
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="query-issues.html">
B.3.4 Query-Related Issues
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizer-issues.html">
B.3.5 Optimizer-Related Issues
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="table-definition-issues.html">
B.3.6 Table Definition-Related Issues
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="known-issues.html">
B.3.7 Known Issues in MySQL
</a>
</span>
</dt>
</dl>
</dd>
</dl>
</dd>
<dt>
<span class="appendix">
<a href="indexes.html">
C Indexes
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="index">
<a href="ix01.html">
General Index
</a>
</span>
</dt>
<dt>
<span class="index">
<a href="dynindex-cfunc.html">
C Function Index
</a>
</span>
</dt>
<dt>
<span class="index">
<a href="dynindex-command.html">
Command Index
</a>
</span>
</dt>
<dt>
<span class="index">
<a href="dynindex-function.html">
Function Index
</a>
</span>
</dt>
<dt>
<span class="index">
<a href="dynindex-is.html">
INFORMATION_SCHEMA Index
</a>
</span>
</dt>
<dt>
<span class="index">
<a href="dynindex-jointype.html">
Join Types Index
</a>
</span>
</dt>
<dt>
<span class="index">
<a href="dynindex-operator.html">
Operator Index
</a>
</span>
</dt>
<dt>
<span class="index">
<a href="dynindex-option.html">
Option Index
</a>
</span>
</dt>
<dt>
<span class="index">
<a href="dynindex-priv.html">
Privileges Index
</a>
</span>
</dt>
<dt>
<span class="index">
<a href="dynindex-sqlmode.html">
SQL Modes Index
</a>
</span>
</dt>
<dt>
<span class="index">
<a href="dynindex-statement.html">
Statement/Syntax Index
</a>
</span>
</dt>
<dt>
<span class="index">
<a href="dynindex-statvar.html">
Status Variable Index
</a>
</span>
</dt>
<dt>
<span class="index">
<a href="dynindex-sysvar.html">
System Variable Index
</a>
</span>
</dt>
<dt>
<span class="index">
<a href="dynindex-isolevel.html">
Transaction Isolation Level Index
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="glossary">
<a href="glossary.html">
MySQL Glossary
</a>
</span>
</dt>
</dl>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-ps-check-lost-instrumentation.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-ps-check-lost-instrumentation">
</a>
30.4.3.23 The ps_check_lost_instrumentation View
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045062599488">
</a>
<a class="indexterm" name="idm46045062597984">
</a>
<p>
This view returns information about lost Performance Schema
instruments, to indicate whether the Performance Schema is
unable to monitor all runtime data.
</p>
<p>
The
<a class="link" href="sys-ps-check-lost-instrumentation.html" title="30.4.3.23 The ps_check_lost_instrumentation View">
<code class="literal">
ps_check_lost_instrumentation
</code>
</a>
view has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
variable_name
</code>
</p>
<p>
The Performance Schema status variable name indicating
which type of instrument was lost.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
variable_value
</code>
</p>
<p>
The number of instruments lost.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication.html | <div id="docs-body">
<div class="chapter">
<div class="titlepage">
<div>
<div>
<h1 class="title">
<a name="replication">
</a>
Chapter 19 Replication
</h1>
</div>
</div>
</div>
<div class="toc">
<p>
<b>
Table of Contents
</b>
</p>
<dl class="toc">
<dt>
<span class="section">
<a href="replication-configuration.html">
19.1 Configuring Replication
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="binlog-replication-configuration-overview.html">
19.1.1 Binary Log File Position Based Replication Configuration Overview
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-howto.html">
19.1.2 Setting Up Binary Log File Position Based Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-gtids.html">
19.1.3 Replication with Global Transaction Identifiers
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-mode-change-online.html">
19.1.4 Changing GTID Mode on Online Servers
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-multi-source.html">
19.1.5 MySQL Multi-Source Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-options.html">
19.1.6 Replication and Binary Logging Options and Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-administration.html">
19.1.7 Common Replication Administration Tasks
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="replication-implementation.html">
19.2 Replication Implementation
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="replication-formats.html">
19.2.1 Replication Formats
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-channels.html">
19.2.2 Replication Channels
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-threads.html">
19.2.3 Replication Threads
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replica-logs.html">
19.2.4 Relay Log and Replication Metadata Repositories
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-rules.html">
19.2.5 How Servers Evaluate Replication Filtering Rules
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="replication-security.html">
19.3 Replication Security
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="replication-encrypted-connections.html">
19.3.1 Setting Up Replication to Use Encrypted Connections
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-binlog-encryption.html">
19.3.2 Encrypting Binary Log Files and Relay Log Files
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-privilege-checks.html">
19.3.3 Replication Privilege Checks
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="replication-solutions.html">
19.4 Replication Solutions
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="replication-solutions-backups.html">
19.4.1 Using Replication for Backups
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-solutions-unexpected-replica-halt.html">
19.4.2 Handling an Unexpected Halt of a Replica
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-solutions-rbr-monitoring.html">
19.4.3 Monitoring Row-based Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-solutions-diffengines.html">
19.4.4 Using Replication with Different Source and Replica Storage Engines
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-solutions-scaleout.html">
19.4.5 Using Replication for Scale-Out
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-solutions-partitioning.html">
19.4.6 Replicating Different Databases to Different Replicas
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-solutions-performance.html">
19.4.7 Improving Replication Performance
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-solutions-switch.html">
19.4.8 Switching Sources During Failover
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-asynchronous-connection-failover.html">
19.4.9 Switching Sources and Replicas with Asynchronous Connection Failover
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-semisync.html">
19.4.10 Semisynchronous Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-delayed.html">
19.4.11 Delayed Replication
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="replication-notes.html">
19.5 Replication Notes and Tips
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="replication-features.html">
19.5.1 Replication Features and Issues
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-compatibility.html">
19.5.2 Replication Compatibility Between MySQL Versions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-upgrade.html">
19.5.3 Upgrading or Downgrading a Replication Topology
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-problems.html">
19.5.4 Troubleshooting Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-bugs.html">
19.5.5 How to Report Replication Bugs or Problems
</a>
</span>
</dt>
</dl>
</dd>
</dl>
</div>
<a class="indexterm" name="idm46045146901792">
</a>
<a class="indexterm" name="idm46045146900720">
</a>
<a class="indexterm" name="idm46045146899232">
</a>
<a class="indexterm" name="idm46045146897728">
</a>
<p>
Replication enables data from one MySQL database server (known as a
source) to be copied to one or more MySQL database servers (known as
replicas). Replication is asynchronous by default; replicas do not
need to be connected permanently to receive updates from a source.
Depending on the configuration, you can replicate all databases,
selected databases, or even selected tables within a database.
</p>
<p>
Advantages of replication in MySQL include:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Scale-out solutions - spreading the load among multiple replicas
to improve performance. In this environment, all writes and
updates must take place on the source server. Reads, however,
may take place on one or more replicas. This model can improve
the performance of writes (since the source is dedicated to
updates), while dramatically increasing read speed across an
increasing number of replicas.
</p>
</li>
<li class="listitem">
<p>
Data security - because the replica can pause the replication
process, it is possible to run backup services on the replica
without corrupting the corresponding source data.
</p>
</li>
<li class="listitem">
<p>
Analytics - live data can be created on the source, while the
analysis of the information can take place on the replica
without affecting the performance of the source.
</p>
</li>
<li class="listitem">
<p>
Long-distance data distribution - you can use replication to
create a local copy of data for a remote site to use, without
permanent access to the source.
</p>
</li>
</ul>
</div>
<p>
For information on how to use replication in such scenarios, see
<a class="xref" href="replication-solutions.html" title="19.4 Replication Solutions">
Section 19.4, “Replication Solutions”
</a>
.
</p>
<p>
MySQL 8.4 supports different methods of replication.
The traditional method is based on replicating events from the
source's binary log, and requires the log files and positions in
them to be synchronized between source and replica. The newer method
based on
<span class="firstterm">
global transaction
identifiers
</span>
(GTIDs) is transactional and therefore does
not require working with log files or positions within these files,
which greatly simplifies many common replication tasks. Replication
using GTIDs guarantees consistency between source and replica as
long as all transactions committed on the source have also been
applied on the replica. For more information about GTIDs and
GTID-based replication in MySQL, see
<a class="xref" href="replication-gtids.html" title="19.1.3 Replication with Global Transaction Identifiers">
Section 19.1.3, “Replication with Global Transaction Identifiers”
</a>
. For information on using binary
log file position based replication, see
<a class="xref" href="replication-configuration.html" title="19.1 Configuring Replication">
Section 19.1, “Configuring Replication”
</a>
.
</p>
<p>
Replication in MySQL supports different types of synchronization.
The original type of synchronization is one-way, asynchronous
replication, in which one server acts as the source, while one or
more other servers act as replicas. This is in contrast to the
<span class="emphasis">
<em>
synchronous
</em>
</span>
replication which is a
characteristic of NDB Cluster (see
<a class="xref" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
Chapter 25,
<i>
MySQL NDB Cluster 8.4
</i>
</a>
).
In MySQL 8.4, semisynchronous replication is supported
in addition to the built-in asynchronous replication. With
semisynchronous replication, a commit performed on the source blocks
before returning to the session that performed the transaction until
at least one replica acknowledges that it has received and logged
the events for the transaction; see
<a class="xref" href="replication-semisync.html" title="19.4.10 Semisynchronous Replication">
Section 19.4.10, “Semisynchronous Replication”
</a>
. MySQL 8.4 also
supports delayed replication such that a replica deliberately lags
behind the source by at least a specified amount of time; see
<a class="xref" href="replication-delayed.html" title="19.4.11 Delayed Replication">
Section 19.4.11, “Delayed Replication”
</a>
. For scenarios where
<span class="emphasis">
<em>
synchronous
</em>
</span>
replication is required, use NDB
Cluster (see
<a class="xref" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
Chapter 25,
<i>
MySQL NDB Cluster 8.4
</i>
</a>
).
</p>
<p>
There are a number of solutions available for setting up replication
between servers, and the best method to use depends on the presence
of data and the engine types you are using. For more information on
the available options, see
<a class="xref" href="replication-howto.html" title="19.1.2 Setting Up Binary Log File Position Based Replication">
Section 19.1.2, “Setting Up Binary Log File Position Based Replication”
</a>
.
</p>
<p>
There are two core types of replication format, Statement Based
Replication (SBR), which replicates entire SQL statements, and Row
Based Replication (RBR), which replicates only the changed rows. You
can also use a third variety, Mixed Based Replication (MBR). For
more information on the different replication formats, see
<a class="xref" href="replication-formats.html" title="19.2.1 Replication Formats">
Section 19.2.1, “Replication Formats”
</a>
.
</p>
<p>
Replication is controlled through a number of different options and
variables. For more information, 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>
. Additional security measures
can be applied to a replication topology, as described in
<a class="xref" href="replication-security.html" title="19.3 Replication Security">
Section 19.3, “Replication Security”
</a>
.
</p>
<p>
You can use replication to solve a number of different problems,
including performance, supporting the backup of different databases,
and as part of a larger solution to alleviate system failures. For
information on how to address these issues, see
<a class="xref" href="replication-solutions.html" title="19.4 Replication Solutions">
Section 19.4, “Replication Solutions”
</a>
.
</p>
<p>
For notes and tips on how different data types and statements are
treated during replication, including details of replication
features, version compatibility, upgrades, and potential problems
and their resolution, see
<a class="xref" href="replication-notes.html" title="19.5 Replication Notes and Tips">
Section 19.5, “Replication Notes and Tips”
</a>
. For
answers to some questions often asked by those who are new to MySQL
Replication, 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>
.
</p>
<p>
For detailed information on the implementation of replication, how
replication works, the process and contents of the binary log,
background threads and the rules used to decide how statements are
recorded and replicated, see
<a class="xref" href="replication-implementation.html" title="19.2 Replication Implementation">
Section 19.2, “Replication Implementation”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-best-practices.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-best-practices">
</a>
17.1.2 Best Practices for InnoDB Tables
</h3>
</div>
</div>
</div>
<p>
This section describes best practices when using
<code class="literal">
InnoDB
</code>
tables.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Specify a primary key for every table using the most
frequently queried column or columns, or an auto-increment
value if there is no obvious primary key.
</p>
</li>
<li class="listitem">
<p>
Use joins wherever data is pulled from multiple tables based
on identical ID values from those tables. For fast join
performance, define foreign keys on the join columns, and
declare those columns with the same data type in each table.
Adding foreign keys ensures that referenced columns are
indexed, which can improve performance. Foreign keys also
propagate deletes and updates to all affected tables, and
prevent insertion of data in a child table if the
corresponding IDs are not present in the parent table.
</p>
</li>
<li class="listitem">
<p>
Turn off autocommit. Committing hundreds of times a second
puts a cap on performance (limited by the write speed of your
storage device).
</p>
</li>
<li class="listitem">
<p>
Group sets of related DML operations into transactions by
bracketing them with
<code class="literal">
START TRANSACTION
</code>
and
<code class="literal">
COMMIT
</code>
statements. While you don't want to
commit too often, you also don't want to issue huge batches of
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
,
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
, or
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statements that run for
hours without committing.
</p>
</li>
<li class="listitem">
<p>
Do not use
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
statements.
<code class="literal">
InnoDB
</code>
can handle multiple
sessions all reading and writing to the same table at once
without sacrificing reliability or high performance. To get
exclusive write access to a set of rows, use the
<a class="link" href="innodb-locking-reads.html" title="17.7.2.4 Locking Reads">
<code class="literal">
SELECT
... FOR UPDATE
</code>
</a>
syntax to lock just the rows you
intend to update.
</p>
</li>
<li class="listitem">
<p>
Enable the
<a class="link" href="innodb-parameters.html#sysvar_innodb_file_per_table">
<code class="literal">
innodb_file_per_table
</code>
</a>
variable or use general tablespaces to put the data and
indexes for tables into separate files instead of the system
tablespace. The
<a class="link" href="innodb-parameters.html#sysvar_innodb_file_per_table">
<code class="literal">
innodb_file_per_table
</code>
</a>
variable is enabled by default.
</p>
</li>
<li class="listitem">
<p>
Evaluate whether your data and access patterns benefit from
the
<code class="literal">
InnoDB
</code>
table or page compression
features. You can compress
<code class="literal">
InnoDB
</code>
tables
without sacrificing read/write capability.
</p>
</li>
<li class="listitem">
<p>
Run the server with the
<a class="link" href="server-system-variables.html#sysvar_sql_mode">
<code class="literal">
--sql_mode=NO_ENGINE_SUBSTITUTION
</code>
</a>
option to prevent tables from being created with storage
engines that you do not want to use.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/window-function-descriptions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="window-function-descriptions">
</a>
14.20.1 Window Function Descriptions
</h3>
</div>
</div>
</div>
<p>
This section describes nonaggregate window functions that, for
each row from a query, perform a calculation using rows related
to that row. Most aggregate functions also can be used as window
functions; see
<a class="xref" href="aggregate-functions.html" title="14.19.1 Aggregate Function Descriptions">
Section 14.19.1, “Aggregate Function Descriptions”
</a>
.
</p>
<p>
For window function usage information and examples, and
definitions of terms such as the
<code class="literal">
OVER
</code>
clause,
window, partition, frame, and peer, see
<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="table">
<a name="idm46045192347696">
</a>
<p class="title">
<b>
Table 14.30 Window Functions
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="A reference that lists window functions.">
<colgroup>
<col style="width: 28%"/>
<col style="width: 71%"/>
</colgroup>
<thead>
<tr>
<th>
Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="window-function-descriptions.html#function_cume-dist">
<code class="literal">
CUME_DIST()
</code>
</a>
</td>
<td>
Cumulative distribution value
</td>
</tr>
<tr>
<td>
<a class="link" href="window-function-descriptions.html#function_dense-rank">
<code class="literal">
DENSE_RANK()
</code>
</a>
</td>
<td>
Rank of current row within its partition, without gaps
</td>
</tr>
<tr>
<td>
<a class="link" href="window-function-descriptions.html#function_first-value">
<code class="literal">
FIRST_VALUE()
</code>
</a>
</td>
<td>
Value of argument from first row of window frame
</td>
</tr>
<tr>
<td>
<a class="link" href="window-function-descriptions.html#function_lag">
<code class="literal">
LAG()
</code>
</a>
</td>
<td>
Value of argument from row lagging current row within partition
</td>
</tr>
<tr>
<td>
<a class="link" href="window-function-descriptions.html#function_last-value">
<code class="literal">
LAST_VALUE()
</code>
</a>
</td>
<td>
Value of argument from last row of window frame
</td>
</tr>
<tr>
<td>
<a class="link" href="window-function-descriptions.html#function_lead">
<code class="literal">
LEAD()
</code>
</a>
</td>
<td>
Value of argument from row leading current row within partition
</td>
</tr>
<tr>
<td>
<a class="link" href="window-function-descriptions.html#function_nth-value">
<code class="literal">
NTH_VALUE()
</code>
</a>
</td>
<td>
Value of argument from N-th row of window frame
</td>
</tr>
<tr>
<td>
<a class="link" href="window-function-descriptions.html#function_ntile">
<code class="literal">
NTILE()
</code>
</a>
</td>
<td>
Bucket number of current row within its partition.
</td>
</tr>
<tr>
<td>
<a class="link" href="window-function-descriptions.html#function_percent-rank">
<code class="literal">
PERCENT_RANK()
</code>
</a>
</td>
<td>
Percentage rank value
</td>
</tr>
<tr>
<td>
<a class="link" href="window-function-descriptions.html#function_rank">
<code class="literal">
RANK()
</code>
</a>
</td>
<td>
Rank of current row within its partition, with gaps
</td>
</tr>
<tr>
<td>
<a class="link" href="window-function-descriptions.html#function_row-number">
<code class="literal">
ROW_NUMBER()
</code>
</a>
</td>
<td>
Number of current row within its partition
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 580px;">
<thead>
<tr>
<th style="width: 163.828px;">
Name
</th>
<th style="width: 415.438px;">
Description
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<p>
In the following function descriptions,
<em class="replaceable">
<code>
over_clause
</code>
</em>
represents the
<code class="literal">
OVER
</code>
clause, 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>
. Some window functions
permit a
<em class="replaceable">
<code>
null_treatment
</code>
</em>
clause that
specifies how to handle
<code class="literal">
NULL
</code>
values when
calculating results. This clause is optional. It is part of the
SQL standard, but the MySQL implementation permits only
<code class="literal">
RESPECT NULLS
</code>
(which is also the default).
This means that
<code class="literal">
NULL
</code>
values are considered
when calculating results.
<code class="literal">
IGNORE NULLS
</code>
is
parsed, but produces an error.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a name="function_cume-dist">
</a>
<p>
<a class="link" href="window-function-descriptions.html#function_cume-dist">
<code class="literal">
CUME_DIST()
</code>
</a>
<em class="replaceable">
<code>
over_clause
</code>
</em>
</p>
<a class="indexterm" name="idm46045192296928">
</a>
<p>
Returns the cumulative distribution of a value within a
group of values; that is, the percentage of partition values
less than or equal to the value in the current row. This
represents the number of rows preceding or peer with the
current row in the window ordering of the window partition
divided by the total number of rows in the window partition.
Return values range from 0 to 1.
</p>
<p>
This function should be used with
<code class="literal">
ORDER
BY
</code>
to sort partition rows into the desired order.
Without
<code class="literal">
ORDER BY
</code>
, all rows are peers and
have value
<em class="replaceable">
<code>
N
</code>
</em>
/
<em class="replaceable">
<code>
N
</code>
</em>
=
1, where
<em class="replaceable">
<code>
N
</code>
</em>
is the partition size.
</p>
<p>
<em class="replaceable">
<code>
over_clause
</code>
</em>
is 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>
<p>
The following query shows, for the set of values in the
<code class="literal">
val
</code>
column, the
<code class="literal">
CUME_DIST()
</code>
value for each row, as well
as the percentage rank value returned by the similar
<code class="literal">
PERCENT_RANK()
</code>
function. For reference,
the query also displays row numbers using
<a class="link" href="window-function-descriptions.html#function_row-number">
<code class="literal">
ROW_NUMBER()
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34991824"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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>
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">CUME_DIST</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">'cume_dist'</span><span class="token punctuation">,</span>
<span class="token function">PERCENT_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">'percent_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>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> val <span class="token punctuation">|</span> row_number <span class="token punctuation">|</span> cume_dist <span class="token punctuation">|</span> percent_rank <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 0.2222222222222222 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 0.2222222222222222 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 0.3333333333333333 <span class="token punctuation">|</span> 0.25 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 0.6666666666666666 <span class="token punctuation">|</span> 0.375 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 0.6666666666666666 <span class="token punctuation">|</span> 0.375 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> 0.6666666666666666 <span class="token punctuation">|</span> 0.375 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 7 <span class="token punctuation">|</span> 0.8888888888888888 <span class="token punctuation">|</span> 0.75 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 8 <span class="token punctuation">|</span> 0.8888888888888888 <span class="token punctuation">|</span> 0.75 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 9 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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_dense-rank">
</a>
<p>
<a class="link" href="window-function-descriptions.html#function_dense-rank">
<code class="literal">
DENSE_RANK()
</code>
</a>
<em class="replaceable">
<code>
over_clause
</code>
</em>
</p>
<a class="indexterm" name="idm46045192273952">
</a>
<p>
Returns the rank of the current row within its partition,
without gaps. Peers are considered ties and receive the same
rank. This function assigns consecutive ranks to peer
groups; the result is that groups of size greater than one
do not produce noncontiguous rank numbers. For an example,
see the
<a class="link" href="window-function-descriptions.html#function_rank">
<code class="literal">
RANK()
</code>
</a>
function
description.
</p>
<p>
This function should be used with
<code class="literal">
ORDER
BY
</code>
to sort partition rows into the desired order.
Without
<code class="literal">
ORDER BY
</code>
, all rows are peers.
</p>
<p>
<em class="replaceable">
<code>
over_clause
</code>
</em>
is 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>
</li>
<li class="listitem">
<a name="function_first-value">
</a>
<p>
<a class="link" href="window-function-descriptions.html#function_first-value">
<code class="literal">
FIRST_VALUE(
<em class="replaceable">
<code>
expr
</code>
</em>
)
</code>
</a>
[
<em class="replaceable">
<code>
null_treatment
</code>
</em>
]
<em class="replaceable">
<code>
over_clause
</code>
</em>
</p>
<a class="indexterm" name="idm46045192261104">
</a>
<p>
Returns the value of
<em class="replaceable">
<code>
expr
</code>
</em>
from
the first row of the window frame.
</p>
<p>
<em class="replaceable">
<code>
over_clause
</code>
</em>
is 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>
.
<em class="replaceable">
<code>
null_treatment
</code>
</em>
is as described in
the section introduction.
</p>
<p>
The following query demonstrates
<a class="link" href="window-function-descriptions.html#function_first-value">
<code class="literal">
FIRST_VALUE()
</code>
</a>
,
<a class="link" href="window-function-descriptions.html#function_last-value">
<code class="literal">
LAST_VALUE()
</code>
</a>
, and two
instances of
<a class="link" href="window-function-descriptions.html#function_nth-value">
<code class="literal">
NTH_VALUE()
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa11556963"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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 datatype">time</span><span class="token punctuation">,</span> <span class="token keyword">subject</span><span class="token punctuation">,</span> val<span class="token punctuation">,</span>
<span class="token function">FIRST_VALUE</span><span class="token punctuation">(</span>val<span class="token punctuation">)</span> <span class="token keyword">OVER</span> w <span class="token keyword">AS</span> <span class="token string">'first'</span><span class="token punctuation">,</span>
<span class="token function">LAST_VALUE</span><span class="token punctuation">(</span>val<span class="token punctuation">)</span> <span class="token keyword">OVER</span> w <span class="token keyword">AS</span> <span class="token string">'last'</span><span class="token punctuation">,</span>
<span class="token function">NTH_VALUE</span><span class="token punctuation">(</span>val<span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">)</span> <span class="token keyword">OVER</span> w <span class="token keyword">AS</span> <span class="token string">'second'</span><span class="token punctuation">,</span>
<span class="token function">NTH_VALUE</span><span class="token punctuation">(</span>val<span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">)</span> <span class="token keyword">OVER</span> w <span class="token keyword">AS</span> <span class="token string">'fourth'</span>
<span class="token keyword">FROM</span> observations
<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> <span class="token keyword">subject</span> <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> <span class="token datatype">time</span>
<span class="token keyword">ROWS</span> <span class="token keyword">UNBOUNDED</span> <span class="token keyword">PRECEDING</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>
<span class="token output"><span class="token punctuation">|</span> time <span class="token punctuation">|</span> subject <span class="token punctuation">|</span> val <span class="token punctuation">|</span> first <span class="token punctuation">|</span> last <span class="token punctuation">|</span> second <span class="token punctuation">|</span> fourth <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 07:00:00 <span class="token punctuation">|</span> st113 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 07:15:00 <span class="token punctuation">|</span> st113 <span class="token punctuation">|</span> 9 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> 9 <span class="token punctuation">|</span> 9 <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 07:30:00 <span class="token punctuation">|</span> st113 <span class="token punctuation">|</span> 25 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> 25 <span class="token punctuation">|</span> 9 <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 07:45:00 <span class="token punctuation">|</span> st113 <span class="token punctuation">|</span> 20 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> 20 <span class="token punctuation">|</span> 9 <span class="token punctuation">|</span> 20 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 07:00:00 <span class="token punctuation">|</span> xh458 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 07:15:00 <span class="token punctuation">|</span> xh458 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 07:30:00 <span class="token punctuation">|</span> xh458 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 07:45:00 <span class="token punctuation">|</span> xh458 <span class="token punctuation">|</span> 30 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 30 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> 30 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 08:00:00 <span class="token punctuation">|</span> xh458 <span class="token punctuation">|</span> 25 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 25 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> 30 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
Each function uses the rows in the current frame, which, per
the window definition shown, extends from the first
partition row to the current row. For the
<a class="link" href="window-function-descriptions.html#function_nth-value">
<code class="literal">
NTH_VALUE()
</code>
</a>
calls, the
current frame does not always include the requested row; in
such cases, the return value is
<code class="literal">
NULL
</code>
.
</p>
</li>
<li class="listitem">
<a name="function_lag">
</a>
<p>
<a class="link" href="window-function-descriptions.html#function_lag">
<code class="literal">
LAG(
<em class="replaceable">
<code>
expr
</code>
</em>
[,
<em class="replaceable">
<code>
N
</code>
</em>
[,
<em class="replaceable">
<code>
default
</code>
</em>
]])
</code>
</a>
[
<em class="replaceable">
<code>
null_treatment
</code>
</em>
]
<em class="replaceable">
<code>
over_clause
</code>
</em>
</p>
<a class="indexterm" name="idm46045192234112">
</a>
<p>
Returns the value of
<em class="replaceable">
<code>
expr
</code>
</em>
from
the row that lags (precedes) the current row by
<em class="replaceable">
<code>
N
</code>
</em>
rows within its partition. If
there is no such row, the return value is
<em class="replaceable">
<code>
default
</code>
</em>
. For example, if
<em class="replaceable">
<code>
N
</code>
</em>
is 3, the return value is
<em class="replaceable">
<code>
default
</code>
</em>
for the first three rows.
If
<em class="replaceable">
<code>
N
</code>
</em>
or
<em class="replaceable">
<code>
default
</code>
</em>
are missing, the defaults
are 1 and
<code class="literal">
NULL
</code>
, respectively.
</p>
<p>
<em class="replaceable">
<code>
N
</code>
</em>
must be a literal nonnegative
integer. If
<em class="replaceable">
<code>
N
</code>
</em>
is 0,
<em class="replaceable">
<code>
expr
</code>
</em>
is evaluated for the current
row.
</p>
<p>
<em class="replaceable">
<code>
N
</code>
</em>
cannot be
<code class="literal">
NULL
</code>
, and must be an integer in the range
<code class="literal">
0
</code>
to
<code class="literal">
2
<sup>
63
</sup>
</code>
,
inclusive, in any of the following forms:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
an unsigned integer constant literal
</p>
</li>
<li class="listitem">
<p>
a positional parameter marker (
<code class="literal">
?
</code>
)
</p>
</li>
<li class="listitem">
<p>
a user-defined variable
</p>
</li>
<li class="listitem">
<p>
a local variable in a stored routine
</p>
</li>
</ul>
</div>
<p>
<em class="replaceable">
<code>
over_clause
</code>
</em>
is 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>
.
<em class="replaceable">
<code>
null_treatment
</code>
</em>
is as described in
the section introduction.
</p>
<p>
<a class="link" href="window-function-descriptions.html#function_lag">
<code class="literal">
LAG()
</code>
</a>
(and the similar
<a class="link" href="window-function-descriptions.html#function_lead">
<code class="literal">
LEAD()
</code>
</a>
function) are often
used to compute differences between rows. The following
query shows a set of time-ordered observations and, for each
one, the
<a class="link" href="window-function-descriptions.html#function_lag">
<code class="literal">
LAG()
</code>
</a>
and
<a class="link" href="window-function-descriptions.html#function_lead">
<code class="literal">
LEAD()
</code>
</a>
values from the
adjoining rows, as well as the differences between the
current and adjoining rows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa30162872"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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>
t<span class="token punctuation">,</span> val<span class="token punctuation">,</span>
<span class="token function">LAG</span><span class="token punctuation">(</span>val<span class="token punctuation">)</span> <span class="token keyword">OVER</span> w <span class="token keyword">AS</span> <span class="token string">'lag'</span><span class="token punctuation">,</span>
<span class="token function">LEAD</span><span class="token punctuation">(</span>val<span class="token punctuation">)</span> <span class="token keyword">OVER</span> w <span class="token keyword">AS</span> <span class="token string">'lead'</span><span class="token punctuation">,</span>
val <span class="token operator">-</span> <span class="token function">LAG</span><span class="token punctuation">(</span>val<span class="token punctuation">)</span> <span class="token keyword">OVER</span> w <span class="token keyword">AS</span> <span class="token string">'lag diff'</span><span class="token punctuation">,</span>
val <span class="token operator">-</span> <span class="token function">LEAD</span><span class="token punctuation">(</span>val<span class="token punctuation">)</span> <span class="token keyword">OVER</span> w <span class="token keyword">AS</span> <span class="token string">'lead diff'</span>
<span class="token keyword">FROM</span> series
<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> t<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> t <span class="token punctuation">|</span> val <span class="token punctuation">|</span> lag <span class="token punctuation">|</span> lead <span class="token punctuation">|</span> lag diff <span class="token punctuation">|</span> lead diff <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 12:00:00 <span class="token punctuation">|</span> 100 <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 125 <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> <span class="token punctuation">-</span>25 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 13:00:00 <span class="token punctuation">|</span> 125 <span class="token punctuation">|</span> 100 <span class="token punctuation">|</span> 132 <span class="token punctuation">|</span> 25 <span class="token punctuation">|</span> <span class="token punctuation">-</span>7 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 14:00:00 <span class="token punctuation">|</span> 132 <span class="token punctuation">|</span> 125 <span class="token punctuation">|</span> 145 <span class="token punctuation">|</span> 7 <span class="token punctuation">|</span> <span class="token punctuation">-</span>13 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 15:00:00 <span class="token punctuation">|</span> 145 <span class="token punctuation">|</span> 132 <span class="token punctuation">|</span> 140 <span class="token punctuation">|</span> 13 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 16:00:00 <span class="token punctuation">|</span> 140 <span class="token punctuation">|</span> 145 <span class="token punctuation">|</span> 150 <span class="token punctuation">|</span> <span class="token punctuation">-</span>5 <span class="token punctuation">|</span> <span class="token punctuation">-</span>10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 17:00:00 <span class="token punctuation">|</span> 150 <span class="token punctuation">|</span> 140 <span class="token punctuation">|</span> 200 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> <span class="token punctuation">-</span>50 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 18:00:00 <span class="token punctuation">|</span> 200 <span class="token punctuation">|</span> 150 <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 50 <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
In the example, the
<a class="link" href="window-function-descriptions.html#function_lag">
<code class="literal">
LAG()
</code>
</a>
and
<a class="link" href="window-function-descriptions.html#function_lead">
<code class="literal">
LEAD()
</code>
</a>
calls use the default
<em class="replaceable">
<code>
N
</code>
</em>
and
<em class="replaceable">
<code>
default
</code>
</em>
values of 1 and
<code class="literal">
NULL
</code>
, respectively.
</p>
<p>
The first row shows what happens when there is no previous
row for
<a class="link" href="window-function-descriptions.html#function_lag">
<code class="literal">
LAG()
</code>
</a>
: The function
returns the
<em class="replaceable">
<code>
default
</code>
</em>
value (in
this case,
<code class="literal">
NULL
</code>
). The last row shows the
same thing when there is no next row for
<a class="link" href="window-function-descriptions.html#function_lead">
<code class="literal">
LEAD()
</code>
</a>
.
</p>
<p>
<a class="link" href="window-function-descriptions.html#function_lag">
<code class="literal">
LAG()
</code>
</a>
and
<a class="link" href="window-function-descriptions.html#function_lead">
<code class="literal">
LEAD()
</code>
</a>
also serve to compute
sums rather than differences. Consider this data set, which
contains the first few numbers of the Fibonacci series:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa32740462"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> n <span class="token keyword">FROM</span> fib <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> n<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> n <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<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> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 8 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
The following query shows the
<a class="link" href="window-function-descriptions.html#function_lag">
<code class="literal">
LAG()
</code>
</a>
and
<a class="link" href="window-function-descriptions.html#function_lead">
<code class="literal">
LEAD()
</code>
</a>
values for the rows
adjacent to the current row. It also uses those functions to
add to the current row value the values from the preceding
and following rows. The effect is to generate the next
number in the Fibonacci series, and the next number after
that:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa70630976"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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>
n<span class="token punctuation">,</span>
<span class="token function">LAG</span><span class="token punctuation">(</span>n<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token keyword">OVER</span> w <span class="token keyword">AS</span> <span class="token string">'lag'</span><span class="token punctuation">,</span>
<span class="token function">LEAD</span><span class="token punctuation">(</span>n<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token keyword">OVER</span> w <span class="token keyword">AS</span> <span class="token string">'lead'</span><span class="token punctuation">,</span>
n <span class="token operator">+</span> <span class="token function">LAG</span><span class="token punctuation">(</span>n<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token keyword">OVER</span> w <span class="token keyword">AS</span> <span class="token string">'next_n'</span><span class="token punctuation">,</span>
n <span class="token operator">+</span> <span class="token function">LEAD</span><span class="token punctuation">(</span>n<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token keyword">OVER</span> w <span class="token keyword">AS</span> <span class="token string">'next_next_n'</span>
<span class="token keyword">FROM</span> fib
<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> n<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> n <span class="token punctuation">|</span> lag <span class="token punctuation">|</span> lead <span class="token punctuation">|</span> next_n <span class="token punctuation">|</span> next_next_n <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 8 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 8 <span class="token punctuation">|</span> 8 <span class="token punctuation">|</span> 13 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 8 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 13 <span class="token punctuation">|</span> 8 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
One way to generate the initial set of Fibonacci numbers is
to use a recursive common table expression. For an example,
see
<a class="xref" href="with.html#common-table-expressions-recursive-fibonacci-series" title="Fibonacci Series Generation">
Fibonacci Series Generation
</a>
.
</p>
<p>
You cannot use a negative value for the rows argument of
this function.
</p>
</li>
<li class="listitem">
<a name="function_last-value">
</a>
<p>
<a class="link" href="window-function-descriptions.html#function_last-value">
<code class="literal">
LAST_VALUE(
<em class="replaceable">
<code>
expr
</code>
</em>
)
</code>
</a>
[
<em class="replaceable">
<code>
null_treatment
</code>
</em>
]
<em class="replaceable">
<code>
over_clause
</code>
</em>
</p>
<a class="indexterm" name="idm46045192171312">
</a>
<p>
Returns the value of
<em class="replaceable">
<code>
expr
</code>
</em>
from
the last row of the window frame.
</p>
<p>
<em class="replaceable">
<code>
over_clause
</code>
</em>
is 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>
.
<em class="replaceable">
<code>
null_treatment
</code>
</em>
is as described in
the section introduction.
</p>
<p>
For an example, see the
<a class="link" href="window-function-descriptions.html#function_first-value">
<code class="literal">
FIRST_VALUE()
</code>
</a>
function
description.
</p>
</li>
<li class="listitem">
<a name="function_lead">
</a>
<p>
<a class="link" href="window-function-descriptions.html#function_lead">
<code class="literal">
LEAD(
<em class="replaceable">
<code>
expr
</code>
</em>
[,
<em class="replaceable">
<code>
N
</code>
</em>
[,
<em class="replaceable">
<code>
default
</code>
</em>
]])
</code>
</a>
[
<em class="replaceable">
<code>
null_treatment
</code>
</em>
]
<em class="replaceable">
<code>
over_clause
</code>
</em>
</p>
<a class="indexterm" name="idm46045192158448">
</a>
<p>
Returns the value of
<em class="replaceable">
<code>
expr
</code>
</em>
from
the row that leads (follows) the current row by
<em class="replaceable">
<code>
N
</code>
</em>
rows within its partition. If
there is no such row, the return value is
<em class="replaceable">
<code>
default
</code>
</em>
. For example, if
<em class="replaceable">
<code>
N
</code>
</em>
is 3, the return value is
<em class="replaceable">
<code>
default
</code>
</em>
for the last three rows.
If
<em class="replaceable">
<code>
N
</code>
</em>
or
<em class="replaceable">
<code>
default
</code>
</em>
are missing, the defaults
are 1 and
<code class="literal">
NULL
</code>
, respectively.
</p>
<p>
<em class="replaceable">
<code>
N
</code>
</em>
must be a literal nonnegative
integer. If
<em class="replaceable">
<code>
N
</code>
</em>
is 0,
<em class="replaceable">
<code>
expr
</code>
</em>
is evaluated for the current
row.
</p>
<p>
<em class="replaceable">
<code>
N
</code>
</em>
cannot be
<code class="literal">
NULL
</code>
, and must be an integer in the range
<code class="literal">
0
</code>
to
<code class="literal">
2
<sup>
63
</sup>
</code>
,
inclusive, in any of the following forms:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
an unsigned integer constant literal
</p>
</li>
<li class="listitem">
<p>
a positional parameter marker (
<code class="literal">
?
</code>
)
</p>
</li>
<li class="listitem">
<p>
a user-defined variable
</p>
</li>
<li class="listitem">
<p>
a local variable in a stored routine
</p>
</li>
</ul>
</div>
<p>
<em class="replaceable">
<code>
over_clause
</code>
</em>
is 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>
.
<em class="replaceable">
<code>
null_treatment
</code>
</em>
is as described in
the section introduction.
</p>
<p>
For an example, see the
<a class="link" href="window-function-descriptions.html#function_lag">
<code class="literal">
LAG()
</code>
</a>
function description.
</p>
<p>
Use of a negative value for the rows argument of this
function is not permitted.
</p>
</li>
<li class="listitem">
<a name="function_nth-value">
</a>
<p>
<a class="link" href="window-function-descriptions.html#function_nth-value">
<code class="literal">
NTH_VALUE(
<em class="replaceable">
<code>
expr
</code>
</em>
,
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
</a>
[
<em class="replaceable">
<code>
from_first_last
</code>
</em>
]
[
<em class="replaceable">
<code>
null_treatment
</code>
</em>
]
<em class="replaceable">
<code>
over_clause
</code>
</em>
</p>
<a class="indexterm" name="idm46045192132160">
</a>
<p>
Returns the value of
<em class="replaceable">
<code>
expr
</code>
</em>
from
the
<em class="replaceable">
<code>
N
</code>
</em>
-th row of the window frame.
If there is no such row, the return value is
<code class="literal">
NULL
</code>
.
</p>
<p>
<em class="replaceable">
<code>
N
</code>
</em>
must be a literal positive
integer.
</p>
<p>
<em class="replaceable">
<code>
from_first_last
</code>
</em>
is part of the
SQL standard, but the MySQL implementation permits only
<code class="literal">
FROM FIRST
</code>
(which is also the default).
This means that calculations begin at the first row of the
window.
<code class="literal">
FROM LAST
</code>
is parsed, but produces
an error. To obtain the same effect as
<code class="literal">
FROM
LAST
</code>
(begin calculations at the last row of the
window), use
<code class="literal">
ORDER BY
</code>
to sort in reverse
order.
</p>
<p>
<em class="replaceable">
<code>
over_clause
</code>
</em>
is 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>
.
<em class="replaceable">
<code>
null_treatment
</code>
</em>
is as described in
the section introduction.
</p>
<p>
For an example, see the
<a class="link" href="window-function-descriptions.html#function_first-value">
<code class="literal">
FIRST_VALUE()
</code>
</a>
function
description.
</p>
<p>
You cannot use
<code class="literal">
NULL
</code>
for the row argument
of this function.
</p>
</li>
<li class="listitem">
<a name="function_ntile">
</a>
<p>
<a class="link" href="window-function-descriptions.html#function_ntile">
<code class="literal">
NTILE(
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
</a>
<em class="replaceable">
<code>
over_clause
</code>
</em>
</p>
<a class="indexterm" name="idm46045192113408">
</a>
<p>
Divides a partition into
<em class="replaceable">
<code>
N
</code>
</em>
groups
(buckets), assigns each row in the partition its bucket
number, and returns the bucket number of the current row
within its partition. For example, if
<em class="replaceable">
<code>
N
</code>
</em>
is 4,
<code class="literal">
NTILE()
</code>
divides rows into four buckets.
If
<em class="replaceable">
<code>
N
</code>
</em>
is 100,
<code class="literal">
NTILE()
</code>
divides rows into 100 buckets.
</p>
<p>
<em class="replaceable">
<code>
N
</code>
</em>
must be a literal positive
integer. Bucket number return values range from 1 to
<em class="replaceable">
<code>
N
</code>
</em>
.
</p>
<p>
<em class="replaceable">
<code>
N
</code>
</em>
cannot be
<code class="literal">
NULL
</code>
, and must be an integer in the range
<code class="literal">
0
</code>
to
<code class="literal">
2
<sup>
63
</sup>
</code>
,
inclusive, in any of the following forms:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
an unsigned integer constant literal
</p>
</li>
<li class="listitem">
<p>
a positional parameter marker (
<code class="literal">
?
</code>
)
</p>
</li>
<li class="listitem">
<p>
a user-defined variable
</p>
</li>
<li class="listitem">
<p>
a local variable in a stored routine
</p>
</li>
</ul>
</div>
<p>
This function should be used with
<code class="literal">
ORDER
BY
</code>
to sort partition rows into the desired order.
</p>
<p>
<em class="replaceable">
<code>
over_clause
</code>
</em>
is 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>
<p>
The following query shows, for the set of values in the
<code class="literal">
val
</code>
column, the percentile values
resulting from dividing the rows into two or four groups.
For reference, the query also displays row numbers using
<a class="link" href="window-function-descriptions.html#function_row-number">
<code class="literal">
ROW_NUMBER()
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42069335"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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>
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">NTILE</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span> <span class="token keyword">OVER</span> w <span class="token keyword">AS</span> <span class="token string">'ntile2'</span><span class="token punctuation">,</span>
<span class="token function">NTILE</span><span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">)</span> <span class="token keyword">OVER</span> w <span class="token keyword">AS</span> <span class="token string">'ntile4'</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>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> val <span class="token punctuation">|</span> row_number <span class="token punctuation">|</span> ntile2 <span class="token punctuation">|</span> ntile4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 7 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 8 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 9 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
The construct
<code class="literal">
NTILE(NULL)
</code>
is not
permitted.
</p>
</li>
<li class="listitem">
<a name="function_percent-rank">
</a>
<p>
<a class="link" href="window-function-descriptions.html#function_percent-rank">
<code class="literal">
PERCENT_RANK()
</code>
</a>
<em class="replaceable">
<code>
over_clause
</code>
</em>
</p>
<a class="indexterm" name="idm46045192080720">
</a>
<p>
Returns the percentage of partition values less than the
value in the current row, excluding the highest value.
Return values range from 0 to 1 and represent the row
relative rank, calculated as the result of this formula,
where
<em class="replaceable">
<code>
rank
</code>
</em>
is the row rank and
<em class="replaceable">
<code>
rows
</code>
</em>
is the number of partition
rows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-clike"><div class="docs-select-all right" id="sa89285317"><div class="copy-help left">Press ⌘+C to 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"><span class="token punctuation">(</span><em class="replaceable">rank</em> <span class="token operator">-</span> <span class="token number">1</span><span class="token punctuation">)</span> <span class="token operator">/</span> <span class="token punctuation">(</span><em class="replaceable">rows</em> <span class="token operator">-</span> <span class="token number">1</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
This function should be used with
<code class="literal">
ORDER
BY
</code>
to sort partition rows into the desired order.
Without
<code class="literal">
ORDER BY
</code>
, all rows are peers.
</p>
<p>
<em class="replaceable">
<code>
over_clause
</code>
</em>
is 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>
<p>
For an example, see the
<a class="link" href="window-function-descriptions.html#function_cume-dist">
<code class="literal">
CUME_DIST()
</code>
</a>
function
description.
</p>
</li>
<li class="listitem">
<a name="function_rank">
</a>
<p>
<a class="link" href="window-function-descriptions.html#function_rank">
<code class="literal">
RANK()
</code>
</a>
<em class="replaceable">
<code>
over_clause
</code>
</em>
</p>
<a class="indexterm" name="idm46045192065616">
</a>
<p>
Returns the rank of the current row within its partition,
with gaps. Peers are considered ties and receive the same
rank. This function does not assign consecutive ranks to
peer groups if groups of size greater than one exist; the
result is noncontiguous rank numbers.
</p>
<p>
This function should be used with
<code class="literal">
ORDER
BY
</code>
to sort partition rows into the desired order.
Without
<code class="literal">
ORDER BY
</code>
, all rows are peers.
</p>
<p>
<em class="replaceable">
<code>
over_clause
</code>
</em>
is 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>
<p>
The following query shows the difference between
<a class="link" href="window-function-descriptions.html#function_rank">
<code class="literal">
RANK()
</code>
</a>
, which produces ranks
with gaps, and
<a class="link" href="window-function-descriptions.html#function_dense-rank">
<code class="literal">
DENSE_RANK()
</code>
</a>
,
which produces ranks without gaps. The query shows rank
values for each member of a set of values in the
<code class="literal">
val
</code>
column, which contains some
duplicates.
<a class="link" href="window-function-descriptions.html#function_rank">
<code class="literal">
RANK()
</code>
</a>
assigns
peers (the duplicates) the same rank value, and the next
greater value has a rank higher by the number of peers minus
one.
<a class="link" href="window-function-descriptions.html#function_dense-rank">
<code class="literal">
DENSE_RANK()
</code>
</a>
also
assigns peers the same rank value, but the next higher value
has a rank one greater. For reference, the query also
displays row numbers using
<a class="link" href="window-function-descriptions.html#function_row-number">
<code class="literal">
ROW_NUMBER()
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa28340814"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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>
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>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> val <span class="token punctuation">|</span> row_number <span class="token punctuation">|</span> rank <span class="token punctuation">|</span> dense_rank <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 7 <span class="token punctuation">|</span> 7 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 8 <span class="token punctuation">|</span> 7 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 9 <span class="token punctuation">|</span> 9 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_row-number">
</a>
<p>
<a class="link" href="window-function-descriptions.html#function_row-number">
<code class="literal">
ROW_NUMBER()
</code>
</a>
<em class="replaceable">
<code>
over_clause
</code>
</em>
</p>
<a class="indexterm" name="idm46045192039680">
</a>
<p>
Returns the number of the current row within its partition.
Rows numbers range from 1 to the number of partition rows.
</p>
<p>
<code class="literal">
ORDER BY
</code>
affects the order in which rows
are numbered. Without
<code class="literal">
ORDER BY
</code>
, row
numbering is nondeterministic.
</p>
<p>
<a class="link" href="window-function-descriptions.html#function_row-number">
<code class="literal">
ROW_NUMBER()
</code>
</a>
assigns peers
different row numbers. To assign peers the same value, use
<a class="link" href="window-function-descriptions.html#function_rank">
<code class="literal">
RANK()
</code>
</a>
or
<a class="link" href="window-function-descriptions.html#function_dense-rank">
<code class="literal">
DENSE_RANK()
</code>
</a>
. For an example,
see the
<a class="link" href="window-function-descriptions.html#function_rank">
<code class="literal">
RANK()
</code>
</a>
function
description.
</p>
<p>
<em class="replaceable">
<code>
over_clause
</code>
</em>
is 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>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-engines-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-engines-table">
</a>
28.3.13 The INFORMATION_SCHEMA ENGINES Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045080032864">
</a>
<p>
The
<a class="link" href="information-schema-engines-table.html" title="28.3.13 The INFORMATION_SCHEMA ENGINES Table">
<code class="literal">
ENGINES
</code>
</a>
table provides
information about storage engines. This is particularly useful for
checking whether a storage engine is supported, or to see what the
default engine is.
</p>
<p>
The
<a class="link" href="information-schema-engines-table.html" title="28.3.13 The INFORMATION_SCHEMA ENGINES Table">
<code class="literal">
ENGINES
</code>
</a>
table has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
ENGINE
</code>
</p>
<p>
The name of the storage engine.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SUPPORT
</code>
</p>
<p>
The server's level of support for the storage engine, as shown
in the following table.
</p>
<div class="informaltable">
<table summary="Values for the SUPPORT column in the INFORMATION_SCHEMA.ENGINES table.">
<colgroup>
<col style="width: 15%"/>
<col style="width: 85%"/>
</colgroup>
<thead>
<tr>
<th>
Value
</th>
<th>
Meaning
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code class="literal">
YES
</code>
</td>
<td>
The engine is supported and is active
</td>
</tr>
<tr>
<td>
<code class="literal">
DEFAULT
</code>
</td>
<td>
Like
<code class="literal">
YES
</code>
, plus this is the default engine
</td>
</tr>
<tr>
<td>
<code class="literal">
NO
</code>
</td>
<td>
The engine is not supported
</td>
</tr>
<tr>
<td>
<code class="literal">
DISABLED
</code>
</td>
<td>
The engine is supported but has been disabled
</td>
</tr>
</tbody>
</table>
</div>
<p>
A value of
<code class="literal">
NO
</code>
means that the server was
compiled without support for the engine, so it cannot be
enabled at runtime.
</p>
<p>
A value of
<code class="literal">
DISABLED
</code>
occurs either because
the server was started with an option that disables the
engine, or because not all options required to enable it were
given. In the latter case, the error log should contain a
reason indicating why the option is disabled. See
<a class="xref" href="error-log.html" title="7.4.2 The Error Log">
Section 7.4.2, “The Error Log”
</a>
.
</p>
<p>
You might also see
<code class="literal">
DISABLED
</code>
for a storage
engine if the server was compiled to support it, but was
started with a
<code class="option">
--skip-
<em class="replaceable">
<code>
engine_name
</code>
</em>
</code>
option. For the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage
engine,
<code class="literal">
DISABLED
</code>
means the server was
compiled with support for NDB Cluster, but was not started
with the
<a class="link" href="mysql-cluster-options-variables.html#option_mysqld_ndbcluster">
<code class="option">
--ndbcluster
</code>
</a>
option.
</p>
<p>
All MySQL servers support
<code class="literal">
MyISAM
</code>
tables. It
is not possible to disable
<code class="literal">
MyISAM
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COMMENT
</code>
</p>
<p>
A brief description of the storage engine.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
TRANSACTIONS
</code>
</p>
<p>
Whether the storage engine supports transactions.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
XA
</code>
</p>
<p>
Whether the storage engine supports XA transactions.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SAVEPOINTS
</code>
</p>
<p>
Whether the storage engine supports savepoints.
</p>
</li>
</ul>
</div>
<h4>
<a name="idm46045079989456">
</a>
Notes
</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="information-schema-engines-table.html" title="28.3.13 The INFORMATION_SCHEMA ENGINES Table">
<code class="literal">
ENGINES
</code>
</a>
is a nonstandard
<code class="literal">
INFORMATION_SCHEMA
</code>
table.
</p>
</li>
</ul>
</div>
<p>
Storage engine information is also available from the
<a class="link" href="show-engines.html" title="15.7.7.17 SHOW ENGINES Statement">
<code class="literal">
SHOW ENGINES
</code>
</a>
statement. See
<a class="xref" href="show-engines.html" title="15.7.7.17 SHOW ENGINES Statement">
Section 15.7.7.17, “SHOW ENGINES Statement”
</a>
. The following statements are
equivalent:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69295162"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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><span class="token keyword">ENGINES</span>
<span class="token keyword">SHOW</span> <span class="token keyword">ENGINES</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-by-handling.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="group-by-handling">
</a>
14.19.3 MySQL Handling of GROUP BY
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045192598608">
</a>
<a class="indexterm" name="idm46045192597568">
</a>
<a class="indexterm" name="idm46045192596064">
</a>
<a class="indexterm" name="idm46045192594576">
</a>
<p>
SQL-92 and earlier does not permit queries for which the select
list,
<code class="literal">
HAVING
</code>
condition, or
<code class="literal">
ORDER
BY
</code>
list refer to nonaggregated columns that are not
named in the
<code class="literal">
GROUP BY
</code>
clause. For example,
this query is illegal in standard SQL-92 because the
nonaggregated
<code class="literal">
name
</code>
column in the select list
does not appear in the
<code class="literal">
GROUP BY
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa51138550"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> o<span class="token punctuation">.</span>custid<span class="token punctuation">,</span> c<span class="token punctuation">.</span><span class="token keyword">name</span><span class="token punctuation">,</span> <span class="token function">MAX</span><span class="token punctuation">(</span>o<span class="token punctuation">.</span>payment<span class="token punctuation">)</span>
<span class="token keyword">FROM</span> orders <span class="token keyword">AS</span> o<span class="token punctuation">,</span> customers <span class="token keyword">AS</span> c
<span class="token keyword">WHERE</span> o<span class="token punctuation">.</span>custid <span class="token operator">=</span> c<span class="token punctuation">.</span>custid
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> o<span class="token punctuation">.</span>custid<span class="token punctuation">;</span></code></pre>
</div>
<p>
For the query to be legal in SQL-92, the
<code class="literal">
name
</code>
column must be omitted from the select list or named in the
<code class="literal">
GROUP BY
</code>
clause.
</p>
<p>
SQL:1999 and later permits such nonaggregates per optional
feature T301 if they are functionally dependent on
<code class="literal">
GROUP BY
</code>
columns: If such a relationship
exists between
<code class="literal">
name
</code>
and
<code class="literal">
custid
</code>
, the query is legal. This would be the
case, for example, were
<code class="literal">
custid
</code>
a primary key
of
<code class="literal">
customers
</code>
.
</p>
<p>
MySQL implements detection of functional dependence. If the
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
SQL mode is
enabled (which it is by default), MySQL rejects queries for
which the select list,
<code class="literal">
HAVING
</code>
condition, or
<code class="literal">
ORDER BY
</code>
list refer to nonaggregated columns
that are neither named in the
<code class="literal">
GROUP BY
</code>
clause
nor are functionally dependent on them.
</p>
<p>
MySQL also permits a nonaggregate column not named in a
<code class="literal">
GROUP BY
</code>
clause when SQL
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
mode is
enabled, provided that this column is limited to a single value,
as shown in the following example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa40495737"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> mytable <span class="token punctuation">(</span>
<span class="token prompt"> -></span> id <span class="token datatype">INT</span> <span class="token keyword">UNSIGNED</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> a <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> b <span class="token datatype">INT</span>
<span class="token prompt"> -></span> <span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> mytable
<span class="token prompt"> -></span> <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'abc'</span><span class="token punctuation">,</span> <span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token string">'abc'</span><span class="token punctuation">,</span> <span class="token number">2000</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span> <span class="token string">'def'</span><span class="token punctuation">,</span> <span class="token number">4000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">SESSION</span> sql_mode <span class="token operator">=</span> sys<span class="token punctuation">.</span>list_add<span class="token punctuation">(</span><span class="token variable">@@session.sql_mode</span><span class="token punctuation">,</span> <span class="token string">'ONLY_FULL_GROUP_BY'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> a<span class="token punctuation">,</span> <span class="token function">SUM</span><span class="token punctuation">(</span>b<span class="token punctuation">)</span> <span class="token keyword">FROM</span> mytable <span class="token keyword">WHERE</span> a <span class="token operator">=</span> <span class="token string">'abc'</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>
<span class="token output"><span class="token punctuation">|</span> a <span class="token punctuation">|</span> SUM(b) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> abc <span class="token punctuation">|</span> 3000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 also possible to have more than one nonaggregate column in
the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
list when employing
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
. In this
case, every such column must be limited to a single value in the
<code class="literal">
WHERE
</code>
clause, and all such limiting
conditions must be joined by logical
<code class="literal">
AND
</code>
, as
shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15963600"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">DROP</span> <span class="token keyword">TABLE</span> <span class="token keyword">IF</span> <span class="token keyword">EXISTS</span> mytable<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> mytable <span class="token punctuation">(</span>
<span class="token prompt"> -></span> id <span class="token datatype">INT</span> <span class="token keyword">UNSIGNED</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> a <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> b <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> c <span class="token datatype">INT</span>
<span class="token prompt"> -></span> <span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> mytable
<span class="token prompt"> -></span> <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'abc'</span><span class="token punctuation">,</span> <span class="token string">'qrs'</span><span class="token punctuation">,</span> <span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token string">'abc'</span><span class="token punctuation">,</span> <span class="token string">'tuv'</span><span class="token punctuation">,</span> <span class="token number">2000</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span> <span class="token string">'def'</span><span class="token punctuation">,</span> <span class="token string">'qrs'</span><span class="token punctuation">,</span> <span class="token number">4000</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">,</span> <span class="token string">'def'</span><span class="token punctuation">,</span> <span class="token string">'tuv'</span><span class="token punctuation">,</span> <span class="token number">8000</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span> <span class="token string">'abc'</span><span class="token punctuation">,</span> <span class="token string">'qrs'</span><span class="token punctuation">,</span> <span class="token number">16000</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token punctuation">(</span><span class="token number">6</span><span class="token punctuation">,</span> <span class="token string">'def'</span><span class="token punctuation">,</span> <span class="token string">'tuv'</span><span class="token punctuation">,</span> <span class="token number">32000</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 variable">@@session.sql_mode</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>
<span class="token output"><span class="token punctuation">|</span> @@session.sql_mode <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><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> a<span class="token punctuation">,</span> b<span class="token punctuation">,</span> <span class="token function">SUM</span><span class="token punctuation">(</span>c<span class="token punctuation">)</span> <span class="token keyword">FROM</span> mytable
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> a <span class="token operator">=</span> <span class="token string">'abc'</span> <span class="token operator">AND</span> b <span class="token operator">=</span> <span class="token string">'qrs'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> a <span class="token punctuation">|</span> b <span class="token punctuation">|</span> SUM(c) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> abc <span class="token punctuation">|</span> qrs <span class="token punctuation">|</span> 17000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
is
disabled, a MySQL extension to the standard SQL use of
<code class="literal">
GROUP BY
</code>
permits the select list,
<code class="literal">
HAVING
</code>
condition, or
<code class="literal">
ORDER
BY
</code>
list to refer to nonaggregated columns even if the
columns are not functionally dependent on
<code class="literal">
GROUP
BY
</code>
columns. This causes MySQL to accept the preceding
query. In this case, the server is free to choose any value from
each group, so unless they are the same, the values chosen are
nondeterministic, which is probably not what you want.
Furthermore, the selection of values from each group cannot be
influenced by adding an
<code class="literal">
ORDER BY
</code>
clause.
Result set sorting occurs after values have been chosen, and
<code class="literal">
ORDER BY
</code>
does not affect which value within
each group the server chooses. Disabling
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
is useful
primarily when you know that, due to some property of the data,
all values in each nonaggregated column not named in the
<code class="literal">
GROUP BY
</code>
are the same for each group.
</p>
<p>
You can achieve the same effect without disabling
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
by using
<a class="link" href="miscellaneous-functions.html#function_any-value">
<code class="literal">
ANY_VALUE()
</code>
</a>
to refer to the
nonaggregated column.
</p>
<p>
The following discussion demonstrates functional dependence, the
error message MySQL produces when functional dependence is
absent, and ways of causing MySQL to accept a query in the
absence of functional dependence.
</p>
<p>
This query might be invalid with
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
enabled
because the nonaggregated
<code class="literal">
address
</code>
column in
the select list is not named in the
<code class="literal">
GROUP BY
</code>
clause:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa10195796"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">name</span><span class="token punctuation">,</span> address<span class="token punctuation">,</span> <span class="token function">MAX</span><span class="token punctuation">(</span>age<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The query is valid if
<code class="literal">
name
</code>
is a primary key
of
<code class="literal">
t
</code>
or is a unique
<code class="literal">
NOT
NULL
</code>
column. In such cases, MySQL recognizes that the
selected column is functionally dependent on a grouping column.
For example, if
<code class="literal">
name
</code>
is a primary key, its
value determines the value of
<code class="literal">
address
</code>
because
each group has only one value of the primary key and thus only
one row. As a result, there is no randomness in the choice of
<code class="literal">
address
</code>
value in a group and no need to
reject the query.
</p>
<p>
The query is invalid if
<code class="literal">
name
</code>
is not a primary
key of
<code class="literal">
t
</code>
or a unique
<code class="literal">
NOT
NULL
</code>
column. In this case, no functional dependency
can be inferred and an error occurs:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69731397"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> address<span class="token punctuation">,</span> <span class="token function">MAX</span><span class="token punctuation">(</span>age<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1055 (42000)<span class="token punctuation">:</span> Expression #2 of SELECT list is not in GROUP
BY clause and contains nonaggregated column 'mydb.t.address' which
is not functionally dependent on columns in GROUP BY clause; this
is incompatible with sql_mode=only_full_group_by</span></code></pre>
</div>
<p>
If you know that,
<span class="emphasis">
<em>
for a given data set,
</em>
</span>
each
<code class="literal">
name
</code>
value in fact uniquely determines
the
<code class="literal">
address
</code>
value,
<code class="literal">
address
</code>
is effectively functionally dependent on
<code class="literal">
name
</code>
. To tell MySQL to accept the query, you
can use the
<a class="link" href="miscellaneous-functions.html#function_any-value">
<code class="literal">
ANY_VALUE()
</code>
</a>
function:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa98851196"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">name</span><span class="token punctuation">,</span> <span class="token function">ANY_VALUE</span><span class="token punctuation">(</span>address<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">MAX</span><span class="token punctuation">(</span>age<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Alternatively, disable
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
.
</p>
<p>
The preceding example is quite simple, however. In particular,
it is unlikely you would group on a single primary key column
because every group would contain only one row. For additional
examples demonstrating functional dependence in more complex
queries, see
<a class="xref" href="group-by-functional-dependence.html" title="14.19.4 Detection of Functional Dependence">
Section 14.19.4, “Detection of Functional Dependence”
</a>
.
</p>
<p>
If a query has aggregate functions and no
<code class="literal">
GROUP
BY
</code>
clause, it cannot have nonaggregated columns in the
select list,
<code class="literal">
HAVING
</code>
condition, or
<code class="literal">
ORDER BY
</code>
list with
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
enabled:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa79302699"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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 function">MAX</span><span class="token punctuation">(</span>age<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t<span class="token punctuation">;</span>
<span class="token output">ERROR 1140 (42000)<span class="token punctuation">:</span> In aggregated query without GROUP BY, expression
#1 of SELECT list contains nonaggregated column 'mydb.t.name'; this
is incompatible with sql_mode=only_full_group_by</span></code></pre>
</div>
<p>
Without
<code class="literal">
GROUP BY
</code>
, there is a single group and
it is nondeterministic which
<code class="literal">
name
</code>
value to
choose for the group. Here, too,
<a class="link" href="miscellaneous-functions.html#function_any-value">
<code class="literal">
ANY_VALUE()
</code>
</a>
can be used, if it is
immaterial which
<code class="literal">
name
</code>
value MySQL chooses:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa63926716"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">ANY_VALUE</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">MAX</span><span class="token punctuation">(</span>age<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t<span class="token punctuation">;</span></code></pre>
</div>
<p>
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
also affects handling of
queries that use
<code class="literal">
DISTINCT
</code>
and
<code class="literal">
ORDER
BY
</code>
. Consider the case of a table
<code class="literal">
t
</code>
with three columns
<code class="literal">
c1
</code>
,
<code class="literal">
c2
</code>
,
and
<code class="literal">
c3
</code>
that contains these rows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa12201721"><div class="copy-help left">Press ⌘+C to 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">c1 c2 c3
1 2 A
3 4 B
1 2 C</code></pre>
</div>
<p>
Suppose that we execute the following query, expecting the
results to be ordered by
<code class="literal">
c3
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa47190664"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> c1<span class="token punctuation">,</span> c2 <span class="token keyword">FROM</span> t <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> c3<span class="token punctuation">;</span></code></pre>
</div>
<p>
To order the result, duplicates must be eliminated first. But to
do so, should we keep the first row or the third? This arbitrary
choice influences the retained value of
<code class="literal">
c3
</code>
,
which in turn influences ordering and makes it arbitrary as
well. To prevent this problem, a query that has
<code class="literal">
DISTINCT
</code>
and
<code class="literal">
ORDER BY
</code>
is
rejected as invalid if any
<code class="literal">
ORDER BY
</code>
expression does not satisfy at least one of these conditions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The expression is equal to one in the select list
</p>
</li>
<li class="listitem">
<p>
All columns referenced by the expression and belonging to
the query's selected tables are elements of the select list
</p>
</li>
</ul>
</div>
<p>
Another MySQL extension to standard SQL permits references in
the
<code class="literal">
HAVING
</code>
clause to aliased expressions in
the select list. For example, the following query returns
<code class="literal">
name
</code>
values that occur only once in table
<code class="literal">
orders
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa57849073"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">name</span><span class="token punctuation">,</span> <span class="token function">COUNT</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> orders
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span>
<span class="token keyword">HAVING</span> <span class="token function">COUNT</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The MySQL extension permits the use of an alias in the
<code class="literal">
HAVING
</code>
clause for the aggregated column:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa90783597"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">name</span><span class="token punctuation">,</span> <span class="token function">COUNT</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> c <span class="token keyword">FROM</span> orders
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span>
<span class="token keyword">HAVING</span> c <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span></code></pre>
</div>
<a class="indexterm" name="idm46045192480544">
</a>
<a class="indexterm" name="idm46045192479056">
</a>
<a class="indexterm" name="idm46045192477568">
</a>
<a class="indexterm" name="idm46045192476496">
</a>
<p>
Standard SQL permits only column expressions in
<code class="literal">
GROUP
BY
</code>
clauses, so a statement such as this is invalid
because
<code class="literal">
FLOOR(value/100)
</code>
is a noncolumn
expression:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa72123799"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> id<span class="token punctuation">,</span> <span class="token function">FLOOR</span><span class="token punctuation">(</span><span class="token keyword">value</span><span class="token operator">/</span><span class="token number">100</span><span class="token punctuation">)</span>
<span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em>
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> id<span class="token punctuation">,</span> <span class="token function">FLOOR</span><span class="token punctuation">(</span><span class="token keyword">value</span><span class="token operator">/</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
MySQL extends standard SQL to permit noncolumn expressions in
<code class="literal">
GROUP BY
</code>
clauses and considers the preceding
statement valid.
</p>
<p>
Standard SQL also does not permit aliases in
<code class="literal">
GROUP
BY
</code>
clauses. MySQL extends standard SQL to permit
aliases, so another way to write the query is as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa84524328"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> id<span class="token punctuation">,</span> <span class="token function">FLOOR</span><span class="token punctuation">(</span><span class="token keyword">value</span><span class="token operator">/</span><span class="token number">100</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> val
<span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em>
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> id<span class="token punctuation">,</span> val<span class="token punctuation">;</span></code></pre>
</div>
<p>
The alias
<code class="literal">
val
</code>
is considered a column
expression in the
<code class="literal">
GROUP BY
</code>
clause.
</p>
<p>
In the presence of a noncolumn expression in the
<code class="literal">
GROUP
BY
</code>
clause, MySQL recognizes equality between that
expression and expressions in the select list. This means that
with
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
SQL
mode enabled, the query containing
<code class="literal">
GROUP BY id,
FLOOR(value/100)
</code>
is valid because that same
<a class="link" href="mathematical-functions.html#function_floor">
<code class="literal">
FLOOR()
</code>
</a>
expression occurs in the
select list. However, MySQL does not try to recognize functional
dependence on
<code class="literal">
GROUP BY
</code>
noncolumn expressions,
so the following query is invalid with
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
enabled,
even though the third selected expression is a simple formula of
the
<code class="literal">
id
</code>
column and the
<a class="link" href="mathematical-functions.html#function_floor">
<code class="literal">
FLOOR()
</code>
</a>
expression in the
<code class="literal">
GROUP BY
</code>
clause:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa48038222"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> id<span class="token punctuation">,</span> <span class="token function">FLOOR</span><span class="token punctuation">(</span><span class="token keyword">value</span><span class="token operator">/</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">,</span> id<span class="token operator">+</span><span class="token function">FLOOR</span><span class="token punctuation">(</span><span class="token keyword">value</span><span class="token operator">/</span><span class="token number">100</span><span class="token punctuation">)</span>
<span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em>
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> id<span class="token punctuation">,</span> <span class="token function">FLOOR</span><span class="token punctuation">(</span><span class="token keyword">value</span><span class="token operator">/</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
A workaround is to use a derived table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa1858445"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> id<span class="token punctuation">,</span> F<span class="token punctuation">,</span> id<span class="token operator">+</span>F
<span class="token keyword">FROM</span>
<span class="token punctuation">(</span><span class="token keyword">SELECT</span> id<span class="token punctuation">,</span> <span class="token function">FLOOR</span><span class="token punctuation">(</span><span class="token keyword">value</span><span class="token operator">/</span><span class="token number">100</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> F
<span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em>
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> id<span class="token punctuation">,</span> <span class="token function">FLOOR</span><span class="token punctuation">(</span><span class="token keyword">value</span><span class="token operator">/</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> dt<span class="token punctuation">;</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/set-sql-log-bin.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="set-sql-log-bin">
</a>
15.4.1.3 SET sql_log_bin Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045177793296">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa67996332"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> sql_log_bin <span class="token operator">=</span> {<span class="token keyword">OFF</span><span class="token operator">|</span><span class="token keyword">ON</span>}</code></pre>
</div>
<p>
The
<a class="link" href="replication-options-binary-log.html#sysvar_sql_log_bin">
<code class="literal">
sql_log_bin
</code>
</a>
variable
controls whether logging to the binary log is enabled for the
current session (assuming that the binary log itself is
enabled). The default value is
<code class="literal">
ON
</code>
. To disable
or enable binary logging for the current session, set the
session
<a class="link" href="replication-options-binary-log.html#sysvar_sql_log_bin">
<code class="literal">
sql_log_bin
</code>
</a>
variable to
<code class="literal">
OFF
</code>
or
<code class="literal">
ON
</code>
.
</p>
<p>
Set this variable to
<code class="literal">
OFF
</code>
for a session to
temporarily disable binary logging while making changes to the
source that you do not want replicated to the replica.
</p>
<p>
Setting the session value of this system variable is a
restricted operation. The session user must have privileges
sufficient to set restricted session 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>
It is not possible to set the session value of
<a class="link" href="replication-options-binary-log.html#sysvar_sql_log_bin">
<code class="literal">
sql_log_bin
</code>
</a>
within a
transaction or subquery.
</p>
<p>
<span class="emphasis">
<em>
Setting this variable to
<code class="literal">
OFF
</code>
prevents new GTIDs from being assigned to transactions in the
binary log
</em>
</span>
. If you are using GTIDs for replication,
this means that even when binary logging is later enabled again,
the GTIDs written into the log from this point do not account
for any transactions that occurred in the meantime, so in effect
those transactions are lost.
</p>
<p>
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
adds a
<code class="literal">
SET
@@SESSION.sql_log_bin=0
</code>
statement to a dump file from
a server where GTIDs are in use, which disables binary logging
while the dump file is being reloaded. The statement prevents
new GTIDs from being generated and assigned to the transactions
in the dump file as they are executed, so that the original
GTIDs for the transactions are used.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/no-matching-rows.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="no-matching-rows">
</a>
B.3.4.7 Solving Problems with No Matching Rows
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045053473744">
</a>
<a class="indexterm" name="idm46045053472704">
</a>
<p>
If you have a complicated query that uses many tables but that
returns no rows, you should use the following procedure to
find out what is wrong:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Test the query with
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
to check whether you can find something that is obviously
wrong. See
<a class="xref" href="explain.html" title="15.8.2 EXPLAIN Statement">
Section 15.8.2, “EXPLAIN Statement”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Select only those columns that are used in the
<code class="literal">
WHERE
</code>
clause.
</p>
</li>
<li class="listitem">
<p>
Remove one table at a time from the query until it returns
some rows. If the tables are large, it is a good idea to
use
<code class="literal">
LIMIT 10
</code>
with the query.
</p>
</li>
<li class="listitem">
<p>
Issue a
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
for the
column that should have matched a row against the table
that was last removed from the query.
</p>
</li>
<li class="listitem">
<p>
If you are comparing
<a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
<code class="literal">
FLOAT
</code>
</a>
or
<a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
<code class="literal">
DOUBLE
</code>
</a>
columns with
numbers that have decimals, you cannot use equality
(
<code class="literal">
=
</code>
) comparisons. This problem is common
in most computer languages because not all floating-point
values can be stored with exact precision. In some cases,
changing the
<a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
<code class="literal">
FLOAT
</code>
</a>
to a
<a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
<code class="literal">
DOUBLE
</code>
</a>
fixes this. See
<a class="xref" href="problems-with-float.html" title="B.3.4.8 Problems with Floating-Point Values">
Section B.3.4.8, “Problems with Floating-Point Values”
</a>
.
</p>
</li>
<li class="listitem">
<p>
If you still cannot figure out what is wrong, create a
minimal test that can be run with
<code class="literal">
mysql test <
query.sql
</code>
that shows your problems. You can
create a test file by dumping the tables with
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump --quick db_name
<em class="replaceable">
<code>
tbl_name_1
</code>
</em>
...
<em class="replaceable">
<code>
tbl_name_n
</code>
</em>
>
query.sql
</strong>
</span>
</a>
. Open the file in an editor, remove
some insert lines (if there are more than needed to
demonstrate the problem), and add your
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement at the end
of the file.
</p>
<p>
Verify that the test file demonstrates the problem by
executing these commands:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa23333681"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysqladmin</span> create test2
<span class="token prompt">$> </span><span class="token command">mysql</span> test2 < query<span class="token punctuation">.</span>sql</code></pre>
</div>
<p>
Attach the test file to a bug report, which you can file
using the instructions 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>
</li>
</ol>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/example-maximum-column-group-row.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="example-maximum-column-group-row">
</a>
5.6.4 The Rows Holding the Group-wise Maximum of a Certain Column
</h3>
</div>
</div>
</div>
<p>
<span class="emphasis">
<em>
Task: For each article, find the dealer or dealers
with the most expensive price.
</em>
</span>
</p>
<p>
This problem can be solved with a subquery like this one:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa3774861"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> article<span class="token punctuation">,</span> dealer<span class="token punctuation">,</span> price
<span class="token keyword">FROM</span> shop s1
<span class="token keyword">WHERE</span> price<span class="token operator">=</span><span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token function">MAX</span><span class="token punctuation">(</span>s2<span class="token punctuation">.</span>price<span class="token punctuation">)</span>
<span class="token keyword">FROM</span> shop s2
<span class="token keyword">WHERE</span> s1<span class="token punctuation">.</span>article <span class="token operator">=</span> s2<span class="token punctuation">.</span>article<span class="token punctuation">)</span>
<span class="token keyword">ORDER</span> <span class="token keyword">BY</span> article<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> article <span class="token punctuation">|</span> dealer <span class="token punctuation">|</span> price <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 0001 <span class="token punctuation">|</span> B <span class="token punctuation">|</span> 3.99 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 0002 <span class="token punctuation">|</span> A <span class="token punctuation">|</span> 10.99 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 0003 <span class="token punctuation">|</span> C <span class="token punctuation">|</span> 1.69 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 0004 <span class="token punctuation">|</span> D <span class="token punctuation">|</span> 19.95 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
The preceding example uses a correlated subquery, which can be
inefficient (see
<a class="xref" href="correlated-subqueries.html" title="15.2.15.7 Correlated Subqueries">
Section 15.2.15.7, “Correlated Subqueries”
</a>
). Other
possibilities for solving the problem are to use an uncorrelated
subquery in the
<code class="literal">
FROM
</code>
clause, a
<code class="literal">
LEFT
JOIN
</code>
, or a common table expression with a window
function.
</p>
<p>
Uncorrelated subquery:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa1136785"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> s1<span class="token punctuation">.</span>article<span class="token punctuation">,</span> dealer<span class="token punctuation">,</span> s1<span class="token punctuation">.</span>price
<span class="token keyword">FROM</span> shop s1
<span class="token keyword">JOIN</span> <span class="token punctuation">(</span>
<span class="token keyword">SELECT</span> article<span class="token punctuation">,</span> <span class="token function">MAX</span><span class="token punctuation">(</span>price<span class="token punctuation">)</span> <span class="token keyword">AS</span> price
<span class="token keyword">FROM</span> shop
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> article<span class="token punctuation">)</span> <span class="token keyword">AS</span> s2
<span class="token keyword">ON</span> s1<span class="token punctuation">.</span>article <span class="token operator">=</span> s2<span class="token punctuation">.</span>article <span class="token operator">AND</span> s1<span class="token punctuation">.</span>price <span class="token operator">=</span> s2<span class="token punctuation">.</span>price
<span class="token keyword">ORDER</span> <span class="token keyword">BY</span> article<span class="token punctuation">;</span></code></pre>
</div>
<p>
<code class="literal">
LEFT JOIN
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20573262"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> s1<span class="token punctuation">.</span>article<span class="token punctuation">,</span> s1<span class="token punctuation">.</span>dealer<span class="token punctuation">,</span> s1<span class="token punctuation">.</span>price
<span class="token keyword">FROM</span> shop s1
<span class="token keyword">LEFT</span> <span class="token keyword">JOIN</span> shop s2 <span class="token keyword">ON</span> s1<span class="token punctuation">.</span>article <span class="token operator">=</span> s2<span class="token punctuation">.</span>article <span class="token operator">AND</span> s1<span class="token punctuation">.</span>price <span class="token operator"><</span> s2<span class="token punctuation">.</span>price
<span class="token keyword">WHERE</span> s2<span class="token punctuation">.</span>article <span class="token operator">IS</span> <span class="token boolean">NULL</span>
<span class="token keyword">ORDER</span> <span class="token keyword">BY</span> s1<span class="token punctuation">.</span>article<span class="token punctuation">;</span></code></pre>
</div>
<p>
The
<code class="literal">
LEFT JOIN
</code>
works on the basis that when
<code class="literal">
s1.price
</code>
is at its maximum value, there is no
<code class="literal">
s2.price
</code>
with a greater value and thus the
corresponding
<code class="literal">
s2.article
</code>
value is
<code class="literal">
NULL
</code>
. See
<a class="xref" href="join.html" title="15.2.13.2 JOIN Clause">
Section 15.2.13.2, “JOIN Clause”
</a>
.
</p>
<p>
Common table expression with window function:
</p>
<a class="indexterm" name="idm46045324692848">
</a>
<a class="indexterm" name="idm46045324691760">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24252225"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">WITH</span> s1 <span class="token keyword">AS</span> <span class="token punctuation">(</span>
<span class="token keyword">SELECT</span> article<span class="token punctuation">,</span> dealer<span class="token punctuation">,</span> price<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">PARTITION</span> <span class="token keyword">BY</span> article
<span class="token keyword">ORDER</span> <span class="token keyword">BY</span> price <span class="token keyword">DESC</span>
<span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token punctuation">`</span>Rank<span class="token punctuation">`</span>
<span class="token keyword">FROM</span> shop
<span class="token punctuation">)</span>
<span class="token keyword">SELECT</span> article<span class="token punctuation">,</span> dealer<span class="token punctuation">,</span> price
<span class="token keyword">FROM</span> s1
<span class="token keyword">WHERE</span> <span class="token punctuation">`</span>Rank<span class="token punctuation">`</span> <span class="token operator">=</span> <span class="token number">1</span>
<span class="token keyword">ORDER</span> <span class="token keyword">BY</span> article<span class="token punctuation">;</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/view-syntax.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="view-syntax">
</a>
27.5.1 View Syntax
</h3>
</div>
</div>
</div>
<p>
The
<a class="link" href="create-view.html" title="15.1.23 CREATE VIEW Statement">
<code class="literal">
CREATE VIEW
</code>
</a>
statement creates a
new view (see
<a class="xref" href="create-view.html" title="15.1.23 CREATE VIEW Statement">
Section 15.1.23, “CREATE VIEW Statement”
</a>
). To alter the
definition of a view or drop a view, use
<a class="link" href="alter-view.html" title="15.1.11 ALTER VIEW Statement">
<code class="literal">
ALTER VIEW
</code>
</a>
(see
<a class="xref" href="alter-view.html" title="15.1.11 ALTER VIEW Statement">
Section 15.1.11, “ALTER VIEW Statement”
</a>
), or
<a class="link" href="drop-view.html" title="15.1.35 DROP VIEW Statement">
<code class="literal">
DROP
VIEW
</code>
</a>
(see
<a class="xref" href="drop-view.html" title="15.1.35 DROP VIEW Statement">
Section 15.1.35, “DROP VIEW Statement”
</a>
).
</p>
<p>
A view can be created from many kinds of
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements. It can refer to
base tables or other views. It can use joins,
<a class="link" href="union.html" title="15.2.18 UNION Clause">
<code class="literal">
UNION
</code>
</a>
, and subqueries. The
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
need not even refer to any
tables. The following example defines a view that selects two
columns from another table, as well as an expression calculated
from those columns:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18512009"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t <span class="token punctuation">(</span>qty <span class="token datatype">INT</span><span class="token punctuation">,</span> price <span class="token datatype">INT</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <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 number">50</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">60</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">VIEW</span> v <span class="token keyword">AS</span> <span class="token keyword">SELECT</span> qty<span class="token punctuation">,</span> price<span class="token punctuation">,</span> qty<span class="token operator">*</span>price <span class="token keyword">AS</span> <span class="token keyword">value</span> <span class="token keyword">FROM</span> t<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> v<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> qty <span class="token punctuation">|</span> price <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>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 50 <span class="token punctuation">|</span> 150 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 60 <span class="token punctuation">|</span> 300 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><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 operator">*</span> <span class="token keyword">FROM</span> v <span class="token keyword">WHERE</span> qty <span class="token operator">=</span> <span class="token number">5</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> qty <span class="token punctuation">|</span> price <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>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 60 <span class="token punctuation">|</span> 300 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-programs-ndb-drop-index.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-programs-ndb-drop-index">
</a>
25.5.10 ndb_drop_index — Drop Index from an NDB Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045103876432">
</a>
<p>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html" title="25.5.10 ndb_drop_index — Drop Index from an NDB Table">
<span class="command">
<strong>
ndb_drop_index
</strong>
</span>
</a>
drops the specified index from
an
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table.
<span class="emphasis">
<em>
It is
recommended that you use this utility only as an example for
writing NDB API applications
</em>
</span>
—see the Warning
later in this section for details.
</p>
<h4>
<a name="idm46045103871872">
</a>
Usage
</h4>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa83583439"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">ndb_drop_index <span class="token property">-c</span> <em class="replaceable">connection_string</em> <em class="replaceable">table_name</em> <em class="replaceable">index</em> <span class="token property">-d</span> <em class="replaceable">db_name</em></code></pre>
</div>
<p>
The statement shown above drops the index named
<em class="replaceable">
<code>
index
</code>
</em>
from the
<em class="replaceable">
<code>
table
</code>
</em>
in the
<em class="replaceable">
<code>
database
</code>
</em>
.
</p>
<p>
Options that can be used with
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html" title="25.5.10 ndb_drop_index — Drop Index from an NDB Table">
<span class="command">
<strong>
ndb_drop_index
</strong>
</span>
</a>
are shown in the following table. Additional descriptions follow
the table.
</p>
<p>
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="option_ndb_drop_index_character-sets-dir">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_character-sets-dir">
<code class="option">
--character-sets-dir
</code>
</a>
</p>
<a class="indexterm" name="idm46045103861760">
</a>
<a class="indexterm" name="idm46045103860256">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for character-sets-dir">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--character-sets-dir=path
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Directory containing character sets.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_connect-retries">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_connect-retries">
<code class="option">
--connect-retries
</code>
</a>
</p>
<a class="indexterm" name="idm46045103850400">
</a>
<a class="indexterm" name="idm46045103848912">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for connect-retries">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--connect-retries=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
12
</code>
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
0
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
12
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Number of times to retry connection before giving up.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_connect-retry-delay">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_connect-retry-delay">
<code class="option">
--connect-retry-delay
</code>
</a>
</p>
<a class="indexterm" name="idm46045103829808">
</a>
<a class="indexterm" name="idm46045103828304">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for connect-retry-delay">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--connect-retry-delay=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
5
</code>
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
0
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
5
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Number of seconds to wait between attempts to contact
management server.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_connect-string">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_connect-string">
<code class="option">
--connect-string
</code>
</a>
</p>
<a class="indexterm" name="idm46045103809248">
</a>
<a class="indexterm" name="idm46045103807760">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for connect-string">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--connect-string=connection_string
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Same as
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_core-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_core-file">
<code class="option">
--core-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045103792400">
</a>
<a class="indexterm" name="idm46045103790912">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for core-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--core-file
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Write core file on error; used in debugging.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_database">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_database">
<code class="option">
--database
</code>
</a>
,
<code class="option">
-d
</code>
</p>
<a class="indexterm" name="idm46045103780720">
</a>
<a class="indexterm" name="idm46045103779232">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for database">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--database=name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
TEST_DB
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Name of the database in which the table resides.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_defaults-extra-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_defaults-extra-file">
<code class="option">
--defaults-extra-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045103764944">
</a>
<a class="indexterm" name="idm46045103763440">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for defaults-extra-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--defaults-extra-file=path
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Read given file after global files are read.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_defaults-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_defaults-file">
<code class="option">
--defaults-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045103749216">
</a>
<a class="indexterm" name="idm46045103747728">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for defaults-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--defaults-file=path
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Read default options from given file only.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_defaults-group-suffix">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_defaults-group-suffix">
<code class="option">
--defaults-group-suffix
</code>
</a>
</p>
<a class="indexterm" name="idm46045103733312">
</a>
<a class="indexterm" name="idm46045103731808">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for defaults-group-suffix">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--defaults-group-suffix=string
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Also read groups with concat(group, suffix).
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_help">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_help">
<code class="option">
--help
</code>
</a>
</p>
<a class="indexterm" name="idm46045103717520">
</a>
<a class="indexterm" name="idm46045103716032">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for help">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--help
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Display help text and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_login-path">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_login-path">
<code class="option">
--login-path
</code>
</a>
</p>
<a class="indexterm" name="idm46045103706352">
</a>
<a class="indexterm" name="idm46045103704864">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for login-path">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--login-path=path
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Read given path from login file.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_no-login-paths">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_no-login-paths">
<code class="option">
--no-login-paths
</code>
</a>
</p>
<a class="indexterm" name="idm46045103690592">
</a>
<a class="indexterm" name="idm46045103689104">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for no-login-paths">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--no-login-paths
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Skips reading options from the login path file.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_ndb-connectstring">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
</p>
<a class="indexterm" name="idm46045103679440">
</a>
<a class="indexterm" name="idm46045103677984">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-connectstring">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-connectstring=connection_string
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Set connection string for connecting to
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
<span class="command">
<strong>
ndb_mgmd
</strong>
</span>
</a>
. Syntax:
<code class="literal">
[nodeid=
<em class="replaceable">
<code>
id
</code>
</em>
;][host=]
<em class="replaceable">
<code>
hostname
</code>
</em>
[:
<em class="replaceable">
<code>
port
</code>
</em>
]
</code>
.
Overrides entries in
<code class="literal">
NDB_CONNECTSTRING
</code>
and
<code class="filename">
my.cnf
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_ndb-mgm-tls">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_ndb-mgm-tls">
<code class="option">
--ndb-mgm-tls
</code>
</a>
</p>
<a class="indexterm" name="idm46045103658880">
</a>
<a class="indexterm" name="idm46045103657392">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-mgm-tls">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-mgm-tls=level
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Enumeration
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
relaxed
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
relaxed
</code>
</p>
<p class="valid-value">
<code class="literal">
strict
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Sets the level of TLS support required to connect to the
management server; one of
<code class="literal">
relaxed
</code>
or
<code class="literal">
strict
</code>
.
<code class="literal">
relaxed
</code>
(the
default) means that a TLS connection is attempted, but
success is not required;
<code class="literal">
strict
</code>
means
that TLS is required to connect.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_ndb-mgmd-host">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_ndb-mgmd-host">
<code class="option">
--ndb-mgmd-host
</code>
</a>
</p>
<a class="indexterm" name="idm46045103636272">
</a>
<a class="indexterm" name="idm46045103634784">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-mgmd-host">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-mgmd-host=connection_string
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Same as
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_ndb-nodeid">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_ndb-nodeid">
<code class="option">
--ndb-nodeid
</code>
</a>
</p>
<a class="indexterm" name="idm46045103619600">
</a>
<a class="indexterm" name="idm46045103618112">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-nodeid">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-nodeid=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Set node ID for this node, overriding any ID set by
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_ndb-optimized-node-selection">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_ndb-optimized-node-selection">
<code class="option">
--ndb-optimized-node-selection
</code>
</a>
</p>
<a class="indexterm" name="idm46045103602736">
</a>
<a class="indexterm" name="idm46045103601232">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-optimized-node-selection">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-optimized-node-selection
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Enable optimizations for selection of nodes for
transactions. Enabled by default; use
<code class="option">
--skip-ndb-optimized-node-selection
</code>
to
disable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_ndb-tls-search-path">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_ndb-tls-search-path">
<code class="option">
--ndb-tls-search-path
</code>
</a>
</p>
<a class="indexterm" name="idm46045103590864">
</a>
<a class="indexterm" name="idm46045103589360">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-tls-search-path">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-tls-search-path=list
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Path name
</td>
</tr>
<tr>
<th>
Default Value (Unix)
</th>
<td>
<code class="literal">
$HOME/ndb-tls
</code>
</td>
</tr>
<tr>
<th>
Default Value (Windows)
</th>
<td>
<code class="literal">
$HOMEDIR/ndb-tls
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Specify a list of directories to search for a CA file. On
Unix platforms, the directory names are separated by colons
(
<code class="literal">
:
</code>
); on Windows systems, the semicolon
character (
<code class="literal">
;
</code>
) is used as the separator. A
directory reference may be relative or absolute; it may
contain one or more environment variables, each denoted by a
prefixed dollar sign (
<code class="literal">
$
</code>
), and expanded
prior to use.
</p>
<p>
Searching begins with the leftmost named directory and
proceeds from left to right until a file is found. An empty
string denotes an empty search path, which causes all
searches to fail. A string consisting of a single dot
(
<code class="literal">
.
</code>
) indicates that the search path
limited to the current working directory.
</p>
<p>
If no search path is supplied, the compiled-in default value
is used. This value depends on the platform used: On
Windows, this is
<code class="literal">
\ndb-tls
</code>
; on other
platforms (including Linux), it is
<code class="literal">
$HOME/ndb-tls
</code>
. This can be overridden by
compiling NDB Cluster using
<a class="link" href="source-configuration-options.html#option_cmake_with_ndb_tls_search_path">
<code class="option">
-DWITH_NDB_TLS_SEARCH_PATH
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_no-defaults">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
</p>
<a class="indexterm" name="idm46045103565664">
</a>
<a class="indexterm" name="idm46045103564176">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for no-defaults">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--no-defaults
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Do not read default options from any option file other than
login file.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_print-defaults">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_print-defaults">
<code class="option">
--print-defaults
</code>
</a>
</p>
<a class="indexterm" name="idm46045103554288">
</a>
<a class="indexterm" name="idm46045103552800">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for print-defaults">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--print-defaults
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Print program argument list and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_usage">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_usage">
<code class="option">
--usage
</code>
</a>
</p>
<a class="indexterm" name="idm46045103543088">
</a>
<a class="indexterm" name="idm46045103541600">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for usage">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--usage
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Display help text and exit; same as
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_help">
<code class="option">
--help
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_drop_index_version">
</a>
<a class="link" href="mysql-cluster-programs-ndb-drop-index.html#option_ndb_drop_index_version">
<code class="option">
--version
</code>
</a>
</p>
<a class="indexterm" name="idm46045103530912">
</a>
<a class="indexterm" name="idm46045103529424">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for version">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--version
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Display version information and exit.
</p>
</li>
</ul>
</div>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
<span class="emphasis">
<em>
Operations performed on Cluster table indexes using
the NDB API are not visible to MySQL and make the table
unusable by a MySQL server
</em>
</span>
. If you use this program
to drop an index, then try to access the table from an SQL
node, an error results, as shown here:
</p>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa9263973"><div class="copy-help left">Press ⌘+C to 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_drop_index</span> <span class="token property">-c</span> localhost dogs ix <span class="token property">-d</span> ctest1
Dropping index dogs/idx<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>OK
<span class="token prompt">$> </span><span class="token command">./mysql</span> <span class="token property">-u</span> jon <span class="token property">-p</span> ctest1
Enter password<span class="token punctuation">:</span> *******
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with <span class="token property">-A</span>
Welcome to the MySQL monitor<span class="token punctuation">.</span> Commands end with <span class="token punctuation">;</span> or \g<span class="token punctuation">.</span>
Your MySQL connection id is 7 to server version<span class="token punctuation">:</span> 5<span class="token punctuation">.</span>7<span class="token punctuation">.</span>44-ndb-7<span class="token punctuation">.</span>5<span class="token punctuation">.</span>36
Type <span class="token atrule">'help;'</span> or <span class="token atrule">'\h'</span> for help<span class="token punctuation">.</span> Type <span class="token atrule">'\c'</span> to clear the buffer<span class="token punctuation">.</span>
<span class="token prompt">mysql></span><span class="token command"> SHOW</span> TABLES<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>
<span class="token output"><span class="token punctuation">|</span> Tables_in_ctest1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> a <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> bt1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> bt2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> dogs <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> employees <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> fish <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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>
<span class="token prompt">mysql></span><span class="token command"> SELECT</span> * FROM dogs<span class="token punctuation">;</span>
<span class="token output">ERROR 1296 (HY000)<span class="token punctuation">:</span> Got error 4243 'Index not found' from NDBCLUSTER</span></code></pre>
</div>
<p>
In such a case, your
<span class="emphasis">
<em>
only
</em>
</span>
option for making
the table available to MySQL again is to drop the table and
re-create it. You can use either the SQL
statement
<a class="link" href="drop-table.html" title="15.1.32 DROP TABLE Statement">
<code class="literal">
DROP TABLE
</code>
</a>
or the
<a class="link" href="mysql-cluster-programs-ndb-drop-table.html" title="25.5.11 ndb_drop_table — Drop an NDB Table">
<span class="command">
<strong>
ndb_drop_table
</strong>
</span>
</a>
utility (see
<a class="xref" href="mysql-cluster-programs-ndb-drop-table.html" title="25.5.11 ndb_drop_table — Drop an NDB Table">
Section 25.5.11, “ndb_drop_table — Drop an NDB Table”
</a>
) to drop
the table.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/source-thread-states.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="source-thread-states">
</a>
10.14.4 Replication Source Thread States
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045221307232">
</a>
<a class="indexterm" name="idm46045221305776">
</a>
<p>
The following list shows the most common states you may see in
the
<code class="literal">
State
</code>
column for the
<code class="literal">
Binlog
Dump
</code>
thread of the replication source. If you see no
<code class="literal">
Binlog Dump
</code>
threads on a source, this means
that replication is not running; that is, that no replicas are
currently connected.
</p>
<p>
In MySQL 8.0, incompatible changes were made to instrumentation
names. Monitoring tools that work with these instrumentation
names might be impacted. If the incompatible changes have an
impact for you, set the
<a class="link" href="replication-options-replica.html#sysvar_terminology_use_previous">
<code class="literal">
terminology_use_previous
</code>
</a>
system
variable to
<code class="literal">
BEFORE_8_0_26
</code>
to make MySQL
Server use the old versions of the names for the objects
specified in the previous list. This enables monitoring tools
that rely on the old names to continue working until they can be
updated to use the new names.
</p>
<p>
Set the
<a class="link" href="replication-options-replica.html#sysvar_terminology_use_previous">
<code class="literal">
terminology_use_previous
</code>
</a>
system
variable with session scope to support individual functions, or
global scope to be a default for all new sessions. When global
scope is used, the slow query log contains the old versions of
the names.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="indexterm" name="idm46045221294192">
</a>
<a class="indexterm" name="idm46045221292672">
</a>
<code class="literal">
Finished reading one binlog; switching to next
binlog
</code>
</p>
<p>
The thread has finished reading a binary log file and is
opening the next one to send to the replica.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045221289104">
</a>
<a class="indexterm" name="idm46045221287568">
</a>
<code class="literal">
Master has sent all binlog to slave; waiting for
more updates
</code>
</p>
<p>
<a class="indexterm" name="idm46045221284896">
</a>
<a class="indexterm" name="idm46045221283360">
</a>
<code class="literal">
Source has sent all binlog to replica; waiting for
more updates
</code>
</p>
<p>
The thread has read all remaining updates from the binary
logs and sent them to the replica. The thread is now idle,
waiting for new events to appear in the binary log resulting
from new updates occurring on the source.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045221279632">
</a>
<a class="indexterm" name="idm46045221278128">
</a>
<code class="literal">
Sending binlog event to slave
</code>
</p>
<p>
<a class="indexterm" name="idm46045221275536">
</a>
<a class="indexterm" name="idm46045221274032">
</a>
<code class="literal">
Sending binlog event to replica
</code>
</p>
<p>
Binary logs consist of
<span class="emphasis">
<em>
events
</em>
</span>
, where an
event is usually an update plus some other information. The
thread has read an event from the binary log and is now
sending it to the replica.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045221269984">
</a>
<a class="indexterm" name="idm46045221268480">
</a>
<code class="literal">
Waiting to finalize termination
</code>
</p>
<p>
A very brief state that occurs as the thread is stopping.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/using-log-files.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="using-log-files">
</a>
7.9.1.6 Using Server Logs to Find Causes of Errors in mysqld
</h4>
</div>
</div>
</div>
<p>
Note that before starting
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
with the
general query log enabled, you should check all your tables with
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
. See
<a class="xref" href="server-administration.html" title="Chapter 7 MySQL Server Administration">
Chapter 7,
<i>
MySQL Server Administration
</i>
</a>
.
</p>
<p>
If
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
dies or hangs, you should start
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
with the general query log enabled.
See
<a class="xref" href="query-log.html" title="7.4.3 The General Query Log">
Section 7.4.3, “The General Query Log”
</a>
. When
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
dies again, you can examine the end of the log file for the
query that killed
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
.
</p>
<p>
If you use the default general query log file, the log is stored
in the database directory as
<code class="filename">
<em class="replaceable">
<code>
host_name
</code>
</em>
.log
</code>
In
most cases it is the last query in the log file that killed
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
, but if possible you should verify
this by restarting
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
and executing the
found query from the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
command-line
tools. If this works, you should also test all complicated
queries that did not complete.
</p>
<p>
You can also try the command
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
on all
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements that takes a
long time to ensure that
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
is using
indexes properly. See
<a class="xref" href="explain.html" title="15.8.2 EXPLAIN Statement">
Section 15.8.2, “EXPLAIN Statement”
</a>
.
</p>
<p>
You can find the queries that take a long time to execute by
starting
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
with the slow query log
enabled. See
<a class="xref" href="slow-query-log.html" title="7.4.5 The Slow Query Log">
Section 7.4.5, “The Slow Query Log”
</a>
.
</p>
<p>
If you find the text
<code class="literal">
mysqld restarted
</code>
in the
error log (normally a file named
<code class="filename">
<em class="replaceable">
<code>
host_name
</code>
</em>
.err
</code>
)
you probably have found a query that causes
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
to fail. If this happens, you should
check all your tables with
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
(see
<a class="xref" href="server-administration.html" title="Chapter 7 MySQL Server Administration">
Chapter 7,
<i>
MySQL Server Administration
</i>
</a>
), and test the queries
in the MySQL log files to see whether one fails. If you find
such a query, try first upgrading to the newest MySQL version.
If this does not help, report a bug, see
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
.
</p>
<p>
If you have started
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
with the
<a class="link" href="server-system-variables.html#sysvar_myisam_recover_options">
<code class="literal">
myisam_recover_options
</code>
</a>
system
variable set, MySQL automatically checks and tries to repair
<code class="literal">
MyISAM
</code>
tables if they are marked as 'not
closed properly' or 'crashed'. If this happens, MySQL writes an
entry in the
<code class="literal">
hostname.err
</code>
file
<code class="literal">
'Warning: Checking table ...'
</code>
which is
followed by
<code class="literal">
Warning: Repairing table
</code>
if the
table needs to be repaired. If you get a lot of these errors,
without
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
having died unexpectedly just
before, then something is wrong and needs to be investigated
further. See
<a class="xref" href="server-options.html" title="7.1.7 Server Command Options">
Section 7.1.7, “Server Command Options”
</a>
.
</p>
<p>
When the server detects
<code class="literal">
MyISAM
</code>
table
corruption, it writes additional information to the error log,
such as the name and line number of the source file, and the
list of threads accessing the table. Example:
<code class="literal">
Got an
error from thread_id=1, mi_dynrec.c:368
</code>
. This is
useful information to include in bug reports.
</p>
<p>
It is not a good sign if
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
did die
unexpectedly, but in this case, you should not investigate the
<code class="literal">
Checking table...
</code>
messages, but instead try
to find out why
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
died.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-ps-setup-reload-saved.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-ps-setup-reload-saved">
</a>
30.4.4.12 The ps_setup_reload_saved() Procedure
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045061428624">
</a>
<a class="indexterm" name="idm46045061427120">
</a>
<p>
Reloads a Performance Schema configuration saved earlier
within the same session using
<a class="link" href="sys-ps-setup-save.html" title="30.4.4.14 The ps_setup_save() Procedure">
<code class="literal">
ps_setup_save()
</code>
</a>
. For more
information, see the description of
<a class="link" href="sys-ps-setup-save.html" title="30.4.4.14 The ps_setup_save() Procedure">
<code class="literal">
ps_setup_save()
</code>
</a>
.
</p>
<p>
This procedure disables binary logging during its execution by
manipulating the session value of the
<a class="link" href="replication-options-binary-log.html#sysvar_sql_log_bin">
<code class="literal">
sql_log_bin
</code>
</a>
system variable.
That is a restricted operation, so the procedure requires
privileges sufficient to set restricted session variables. See
<a class="xref" href="system-variable-privileges.html" title="7.1.9.1 System Variable Privileges">
Section 7.1.9.1, “System Variable Privileges”
</a>
.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-ps-setup-reload-saved-parameters">
</a>
Parameters
</h5>
</div>
</div>
</div>
<p>
None.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-ip-address-permissions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="group-replication-ip-address-permissions">
</a>
20.6.4 Group Replication IP Address Permissions
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045132298960">
</a>
<a class="indexterm" name="idm46045132297472">
</a>
<a class="indexterm" name="idm46045132295984">
</a>
<p>
When and only when the XCom communication stack is used for
establishing group communications
(
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_communication_stack">
<code class="literal">
group_replication_communication_stack=XCOM
</code>
</a>
),
the Group Replication plugin lets you specify an allowlist of
hosts from which an incoming Group Communication System connection
can be accepted. If you specify an allowlist on a server s1, then
when server s2 is establishing a connection to s1 for the purpose
of engaging group communication, s1 first checks the allowlist
before accepting the connection from s2. If s2 is in the
allowlist, then s1 accepts the connection, otherwise s1 rejects
the connection attempt by s2. The system variable
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_ip_allowlist">
<code class="literal">
group_replication_ip_allowlist
</code>
</a>
is
used to specify the allowlist.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
When the MySQL communication stack is used for establishing
group communications
(
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_communication_stack">
<code class="literal">
group_replication_communication_stack=MYSQL
</code>
</a>
),
the setting for
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_ip_allowlist">
<code class="literal">
group_replication_ip_allowlist
</code>
</a>
is ignored. See
<a class="xref" href="group-replication-connection-security.html" title="20.6.1 Communication Stack for Connection Security Management">
Section 20.6.1, “Communication Stack for Connection Security Management”
</a>
.
</p>
</div>
<p>
If you do not specify an allowlist explicitly, the group
communication engine (XCom) automatically scans active interfaces
on the host, and identifies those with addresses on private
subnetworks, together with the subnet mask that is configured for
each interface. These addresses, and the
<code class="literal">
localhost
</code>
IP address for IPv4 and IPv6 are used
to create an automatic Group Replication allowlist. The automatic
allowlist therefore includes any IP addresses that are found for
the host in the following ranges after the appropriate subnet mask
has been applied:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa34986202"><div class="copy-help left">Press ⌘+C to 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">IPv4 (as defined in RFC 1918)
10/8 prefix (10.0.0.0 - 10.255.255.255) - Class A
172.16/12 prefix (172.16.0.0 - 172.31.255.255) - Class B
192.168/16 prefix (192.168.0.0 - 192.168.255.255) - Class C
IPv6 (as defined in RFC 4193 and RFC 5156)
fc00:/7 prefix - unique-local addresses
fe80::/10 prefix - link-local unicast addresses
127.0.0.1 - localhost for IPv4
::1 - localhost for IPv6</code></pre>
</div>
<p>
An entry is added to the error log stating the addresses that have
been allowed automatically for the host.
</p>
<p>
The automatic allowlist of private addresses cannot be used for
connections from servers outside the private network, so a server,
even if it has interfaces on public IPs, does not by default allow
Group Replication connections from external hosts. For Group
Replication connections between server instances that are on
different machines, you must provide public IP addresses and
specify these as an explicit allowlist. If you specify any entries
for the allowlist, the private and
<code class="literal">
localhost
</code>
addresses are not added automatically, so if you use any of these,
you must specify them explicitly.
</p>
<p>
To specify an allow list manually, use the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_ip_allowlist">
<code class="literal">
group_replication_ip_allowlist
</code>
</a>
system variable. You can change the list while Group Replication
is running.
</p>
<p>
The allowlist must contain the IP address or host name that is
specified in each member's
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_local_address">
<code class="literal">
group_replication_local_address
</code>
</a>
system variable. This address is not the same as the MySQL server
SQL protocol host and port, and is not specified in the
<a class="link" href="server-system-variables.html#sysvar_bind_address">
<code class="literal">
bind_address
</code>
</a>
system variable for
the server instance. If a host name used as the Group Replication
local address for a server instance resolves to both an IPv4 and
an IPv6 address, the IPv4 address is preferred for Group
Replication connections.
</p>
<p>
IP addresses specified as distributed recovery endpoints, and the
IP address for the member's standard SQL client connection if that
is used for distributed recovery (which is the default), do not
need to be added to the allowlist. The allowlist is only for the
address specified by
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_local_address">
<code class="literal">
group_replication_local_address
</code>
</a>
for each member. A joining member must have its initial connection
to the group permitted by the allowlist in order to retrieve the
address or addresses for distributed recovery.
</p>
<p>
In the allowlist, you can specify any combination of the
following:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
IPv4 addresses (for example,
<code class="literal">
198.51.100.44
</code>
)
</p>
</li>
<li class="listitem">
<p>
IPv4 addresses with CIDR notation (for example,
<code class="literal">
192.0.2.21/24
</code>
)
</p>
</li>
<li class="listitem">
<p>
IPv6 addresses (for example,
<code class="literal">
2001:db8:85a3:8d3:1319:8a2e:370:7348
</code>
)
</p>
</li>
<li class="listitem">
<p>
IPv6 addresses with CIDR notation (for example,
<code class="literal">
2001:db8:85a3:8d3::/64
</code>
)
</p>
</li>
<li class="listitem">
<p>
Host names (for example,
<code class="literal">
example.org
</code>
)
</p>
</li>
<li class="listitem">
<p>
Host names with CIDR notation (for example,
<code class="literal">
www.example.com/24
</code>
)
</p>
</li>
</ul>
</div>
<p>
Host names can resolve to IPv4 addresses, IPv6 addresses, or both.
If a host name resolves to both an IPv4 and an IPv6 address, the
IPv4 address is always used for Group Replication connections. You
can use CIDR notation in combination with host names or IP
addresses to permit a block of IP addresses with a particular
network prefix, but do ensure that all the IP addresses in the
specified subnet are under your control.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
When a connection attempt from an IP address is refused because
the address is not in the allowlist, the refusal message always
prints the IP address in IPv6 format. IPv4 addresses are
preceded by
<code class="literal">
::ffff:
</code>
in this format (an
IPV4-mapped IPv6 address). You do not need to use this format to
specify IPv4 addresses in the allowlist; use the standard IPv4
format for them.
</p>
</div>
<p>
A comma must separate each entry in the allowlist. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa74194974"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> group_replication_ip_allowlist<span class="token operator">=</span><span class="token string">"192.0.2.21/24,198.51.100.44,203.0.113.0/24,2001:db8:85a3:8d3:1319:8a2e:370:7348,example.org,www.example.com/24"</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
To join a replication group, a server needs to be permitted on the
seed member to which it makes the request to join the group.
Typically, this would be the bootstrap member for the replication
group, but it can be any of the servers listed by the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_group_seeds">
<code class="literal">
group_replication_group_seeds
</code>
</a>
option in the configuration for the server joining the group. If
any of the seed members for the group are listed in the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_group_seeds">
<code class="literal">
group_replication_group_seeds
</code>
</a>
option with an IPv6 address when a joining member has an IPv4
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_local_address">
<code class="literal">
group_replication_local_address
</code>
</a>
,
or the reverse, you must also set up and permit an alternative
address for the joining member for the protocol offered by the
seed member (or a host name that resolves to an address for that
protocol). This is because when a server joins a replication
group, it must make the initial contact with the seed member using
the protocol that the seed member advertises in the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_group_seeds">
<code class="literal">
group_replication_group_seeds
</code>
</a>
option, whether that is IPv4 or IPv6. If a joining member does not
have a permitted address for the appropriate protocol, its
connection attempt is refused. For more information on managing
mixed IPv4 and IPv6 replication groups, see
<a class="xref" href="group-replication-ipv6.html" title="20.5.5 Support For IPv6 And For Mixed IPv6 And IPv4 Groups">
Section 20.5.5, “Support For IPv6 And For Mixed IPv6 And IPv4 Groups”
</a>
.
</p>
<p>
When a replication group is reconfigured (for example, when a new
primary is elected or a member joins or leaves), the group members
re-establish connections between themselves. If a group member is
only permitted by servers that are no longer part of the
replication group after the reconfiguration, it is unable to
reconnect to the remaining servers in the replication group that
do not permit it. To avoid this scenario entirely, specify the
same allowlist for all servers that are members of the replication
group.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
It is possible to configure different allowlists on different
group members according to your security requirements, for
example, in order to keep different subnets separate. If you
need to configure different allowlists to meet your security
requirements, ensure that there is sufficient overlap between
the allowlists in the replication group to maximize the
possibility of servers being able to reconnect in the absence of
their original seed member.
</p>
</div>
<p>
For host names, name resolution takes place only when a connection
request is made by another server. A host name that cannot be
resolved is not considered for allowlist validation, and a warning
message is written to the error log. Forward-confirmed reverse DNS
(FCrDNS) verification is carried out for resolved host names.
</p>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
Host names are inherently less secure than IP addresses in an
allowlist. FCrDNS verification provides a good level of
protection, but can be compromised by certain types of attack.
Specify host names in your allowlist only when strictly
necessary, and ensure that all components used for name
resolution, such as DNS servers, are maintained under your
control. You can also implement name resolution locally using
the hosts file, to avoid the use of external components.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/scheduler-component.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="scheduler-component">
</a>
7.5.5 Scheduler Component
</h3>
</div>
</div>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<code class="literal">
scheduler
</code>
component is included in MySQL Enterprise Edition,
a commercial product. To learn more about commercial products,
see
<a class="ulink" href="https://www.mysql.com/products/" target="_blank">
https://www.mysql.com/products/
</a>
.
</p>
</div>
<p>
The
<code class="literal">
scheduler
</code>
component provides an
implementation of the
<code class="literal">
mysql_scheduler
</code>
service
that enables applications, components, or plugins to configure,
run, and unconfigure tasks every
<em class="replaceable">
<code>
N
</code>
</em>
seconds. For example, the
<code class="literal">
audit_log
</code>
server
plugin calls the
<code class="literal">
scheduler
</code>
component at its
initialization and configures a regular, recurring flush of its
memory cache (see
<a class="xref" href="audit-log-logging-configuration.html#audit-log-flush-task" title="Enabling the Audit Log Flush Task">
Enabling the Audit Log Flush Task
</a>
).
</p>
<a class="indexterm" name="idm46045257157440">
</a>
<a class="indexterm" name="idm46045257156368">
</a>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Purpose: Implements the
<a class="link" href="server-system-variables.html#sysvar_component_scheduler.enabled">
<code class="literal">
component_scheduler.enabled
</code>
</a>
system variable that controls whether the scheduler is
actively executing tasks. At startup, the
<code class="literal">
scheduler
</code>
component registers the
<code class="literal">
performance_schema.component_scheduler_tasks
</code>
table, which lists the currently scheduled tasks and some
runtime data about each one.
</p>
</li>
<li class="listitem">
<p>
URN:
<code class="literal">
file://component_scheduler
</code>
</p>
</li>
</ul>
</div>
<p>
For installation instructions, see
<a class="xref" href="component-loading.html" title="7.5.1 Installing and Uninstalling Components">
Section 7.5.1, “Installing and Uninstalling Components”
</a>
.
</p>
<p>
The
<code class="literal">
scheduler
</code>
component implements the service
using these elements:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A priority queue of the registered, inactive scheduled tasks
sorted by the next time to run (in ascending order).
</p>
</li>
<li class="listitem">
<p>
A list of the registered, active tasks.
</p>
</li>
<li class="listitem">
<p>
A background thread that:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Sleeps if there are no tasks or if the top task needs more
time to run. It wakes periodically to check whether it is
time to end.
</p>
</li>
<li class="listitem">
<p>
Compiles a list of the tasks that need to run, moves them
from the inactive queue, adds them to the active queue,
and executes each task individually.
</p>
</li>
<li class="listitem">
<p>
After executing the task list, removes the tasks from the
active list, adds them to the inactive list, and
calculates the next time they need to run.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
When a caller invokes the
<code class="literal">
mysql_scheduler.create()
</code>
service, it creates a
new scheduled task instance to add to the queue, which signals the
semaphore of the background thread. A handle to the new task is
returned to the caller. The calling code should keep this handle
and the service reference to the scheduling service until after
calling the
<code class="literal">
mysql_scheduler.destroy()
</code>
service.
When the caller invokes
<code class="literal">
destroy()
</code>
and passes in
the handle it received from
<code class="literal">
create()
</code>
, the
service waits for the task to become inactive (if running) and
then removes it from the inactive queue.
</p>
<p>
The component service calls each application-provided callback
(function pointer) into the same scheduler thread, one at a time
and in ascending order, based on the time each requires to run.
</p>
<p>
Developers who wish to incorporate scheduler-queueing capabilities
into an application, component, or plugin should consult the
<code class="filename">
mysql_scheduler.h
</code>
file in a MySQL source
distribution.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/partitioning-columns-list.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="partitioning-columns-list">
</a>
26.2.3.2 LIST COLUMNS partitioning
</h4>
</div>
</div>
</div>
<p>
MySQL 8.4 provides support for
<code class="literal">
LIST
COLUMNS
</code>
partitioning. This is a variant of
<code class="literal">
LIST
</code>
partitioning that enables the use of
multiple columns as partition keys, and for columns of data
types other than integer types to be used as partitioning
columns; you can use string types,
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATE
</code>
</a>
, and
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATETIME
</code>
</a>
columns. (For more
information about permitted data types for
<code class="literal">
COLUMNS
</code>
partitioning columns, see
<a class="xref" href="partitioning-columns.html" title="26.2.3 COLUMNS Partitioning">
Section 26.2.3, “COLUMNS Partitioning”
</a>
.)
</p>
<p>
Suppose that you have a business that has customers in 12
cities which, for sales and marketing purposes, you organize
into 4 regions of 3 cities each as shown in the following
table:
</p>
<div class="informaltable">
<table summary="The example described in the preceding text of a business with four sales and marketing regions, with each region having three cities.">
<colgroup>
<col style="width: 50%"/>
<col style="width: 50%"/>
</colgroup>
<thead>
<tr>
<th>
Region
</th>
<th>
Cities
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
1
</td>
<td>
Oskarshamn, Högsby, Mönsterås
</td>
</tr>
<tr>
<td>
2
</td>
<td>
Vimmerby, Hultsfred, Västervik
</td>
</tr>
<tr>
<td>
3
</td>
<td>
Nässjö, Eksjö, Vetlanda
</td>
</tr>
<tr>
<td>
4
</td>
<td>
Uppvidinge, Alvesta, Växjo
</td>
</tr>
</tbody>
</table>
</div>
<p>
With
<code class="literal">
LIST COLUMNS
</code>
partitioning, you can
create a table for customer data that assigns a row to any of
4 partitions corresponding to these regions based on the name
of the city where a customer resides, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa48447647"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> customers_1 <span class="token punctuation">(</span>
first_name <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">25</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
last_name <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">25</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
street_1 <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>
street_2 <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>
city <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">15</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
renewal <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">LIST</span> <span class="token keyword">COLUMNS</span><span class="token punctuation">(</span>city<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> pRegion_1 <span class="token keyword">VALUES</span> <span class="token keyword">IN</span><span class="token punctuation">(</span><span class="token string">'Oskarshamn'</span><span class="token punctuation">,</span> <span class="token string">'Högsby'</span><span class="token punctuation">,</span> <span class="token string">'Mönsterås'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> pRegion_2 <span class="token keyword">VALUES</span> <span class="token keyword">IN</span><span class="token punctuation">(</span><span class="token string">'Vimmerby'</span><span class="token punctuation">,</span> <span class="token string">'Hultsfred'</span><span class="token punctuation">,</span> <span class="token string">'Västervik'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> pRegion_3 <span class="token keyword">VALUES</span> <span class="token keyword">IN</span><span class="token punctuation">(</span><span class="token string">'Nässjö'</span><span class="token punctuation">,</span> <span class="token string">'Eksjö'</span><span class="token punctuation">,</span> <span class="token string">'Vetlanda'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> pRegion_4 <span class="token keyword">VALUES</span> <span class="token keyword">IN</span><span class="token punctuation">(</span><span class="token string">'Uppvidinge'</span><span class="token punctuation">,</span> <span class="token string">'Alvesta'</span><span class="token punctuation">,</span> <span class="token string">'Växjo'</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
As with partitioning by
<code class="literal">
RANGE COLUMNS
</code>
, you
do not need to use expressions in the
<code class="literal">
COLUMNS()
</code>
clause to convert column values
into integers. (In fact, the use of expressions other than
column names is not permitted with
<code class="literal">
COLUMNS()
</code>
.)
</p>
<p>
It is also possible to use
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATE
</code>
</a>
and
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATETIME
</code>
</a>
columns, as shown
in the following example that uses the same name and columns
as the
<code class="literal">
customers_1
</code>
table shown previously,
but employs
<code class="literal">
LIST COLUMNS
</code>
partitioning based
on the
<code class="literal">
renewal
</code>
column to store rows in one
of 4 partitions depending on the week in February 2010 the
customer's account is scheduled to renew:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa4644030"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> customers_2 <span class="token punctuation">(</span>
first_name <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">25</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
last_name <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">25</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
street_1 <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>
street_2 <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>
city <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">15</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
renewal <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">LIST</span> <span class="token keyword">COLUMNS</span><span class="token punctuation">(</span>renewal<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> pWeek_1 <span class="token keyword">VALUES</span> <span class="token keyword">IN</span><span class="token punctuation">(</span><span class="token string">'2010-02-01'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-02'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-03'</span><span class="token punctuation">,</span>
<span class="token string">'2010-02-04'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-05'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-06'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-07'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> pWeek_2 <span class="token keyword">VALUES</span> <span class="token keyword">IN</span><span class="token punctuation">(</span><span class="token string">'2010-02-08'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-09'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-10'</span><span class="token punctuation">,</span>
<span class="token string">'2010-02-11'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-12'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-13'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-14'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> pWeek_3 <span class="token keyword">VALUES</span> <span class="token keyword">IN</span><span class="token punctuation">(</span><span class="token string">'2010-02-15'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-16'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-17'</span><span class="token punctuation">,</span>
<span class="token string">'2010-02-18'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-19'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-20'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-21'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> pWeek_4 <span class="token keyword">VALUES</span> <span class="token keyword">IN</span><span class="token punctuation">(</span><span class="token string">'2010-02-22'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-23'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-24'</span><span class="token punctuation">,</span>
<span class="token string">'2010-02-25'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-26'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-27'</span><span class="token punctuation">,</span> <span class="token string">'2010-02-28'</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
This works, but becomes cumbersome to define and maintain if
the number of dates involved grows very large; in such cases,
it is usually more practical to employ
<code class="literal">
RANGE
</code>
or
<code class="literal">
RANGE COLUMNS
</code>
partitioning instead. In this case, since the column we wish
to use as the partitioning key is a
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATE
</code>
</a>
column, we use
<code class="literal">
RANGE COLUMNS
</code>
partitioning, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa68416689"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> customers_3 <span class="token punctuation">(</span>
first_name <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">25</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
last_name <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">25</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
street_1 <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>
street_2 <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>
city <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">15</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
renewal <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">RANGE</span> <span class="token keyword">COLUMNS</span><span class="token punctuation">(</span>renewal<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> pWeek_1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span><span class="token punctuation">(</span><span class="token string">'2010-02-09'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> pWeek_2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span><span class="token punctuation">(</span><span class="token string">'2010-02-15'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> pWeek_3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span><span class="token punctuation">(</span><span class="token string">'2010-02-22'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> pWeek_4 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span><span class="token punctuation">(</span><span class="token string">'2010-03-01'</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
See
<a class="xref" href="partitioning-columns-range.html" title="26.2.3.1 RANGE COLUMNS partitioning">
Section 26.2.3.1, “RANGE COLUMNS partitioning”
</a>
, for more
information.
</p>
<p>
In addition (as with
<code class="literal">
RANGE COLUMNS
</code>
partitioning), you can use multiple columns in the
<code class="literal">
COLUMNS()
</code>
clause.
</p>
<p>
See
<a class="xref" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
Section 15.1.20, “CREATE TABLE Statement”
</a>
, for additional information
about
<code class="literal">
PARTITION BY LIST COLUMNS()
</code>
syntax.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/linux-installation-rpm.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="linux-installation-rpm">
</a>
2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045330806832">
</a>
<a class="indexterm" name="idm46045330805792">
</a>
<a class="indexterm" name="idm46045330804720">
</a>
<p>
The recommended way to install MySQL on RPM-based Linux
distributions is by using the RPM packages provided by Oracle.
There are two sources for obtaining them, for the Community
Edition of MySQL:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
From the MySQL software repositories:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The MySQL Yum repository (see
<a class="xref" href="linux-installation-yum-repo.html" title="2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository">
Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”
</a>
for
details).
</p>
</li>
<li class="listitem">
<p>
The MySQL SLES repository (see
<a class="xref" href="linux-installation-sles-repo.html" title="2.5.3 Using the MySQL SLES Repository">
Section 2.5.3, “Using the MySQL SLES Repository”
</a>
for
details).
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
From the
<a class="ulink" href="https://dev.mysql.com/downloads/mysql/" target="_top">
Download
MySQL Community Server
</a>
page in the
<a class="ulink" href="https://dev.mysql.com/" target="_top">
MySQL Developer Zone
</a>
.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
RPM distributions of MySQL are also provided by other vendors.
Be aware that they may differ from those built by Oracle in
features, capabilities, and conventions (including communication
setup), and that the installation instructions in this manual do
not necessarily apply to them. The vendor's instructions should
be consulted instead.
</p>
</div>
<h4>
<a name="idm46045330793488">
</a>
MySQL RPM Packages
</h4>
<div class="table">
<a name="idm46045330792800">
</a>
<p class="title">
<b>
Table 2.8 RPM Packages for MySQL Community Edition
</b>
</p>
<div class="table-contents">
<table frame="all">
<colgroup>
<col style="width: 35%"/>
<col style="width: 25%"/>
</colgroup>
<thead>
<tr>
<th>
Package Name
</th>
<th>
Summary
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code class="literal">
mysql-community-client
</code>
</td>
<td>
MySQL client applications and tools
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-community-client-plugins
</code>
</td>
<td>
Shared plugins for MySQL client applications
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-community-common
</code>
</td>
<td>
Common files for server and client libraries
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-community-devel
</code>
</td>
<td>
Development header files and libraries for MySQL database client
applications
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-community-embedded-compat
</code>
</td>
<td>
MySQL server as an embedded library with compatibility for applications
using version 18 of the library
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-community-icu-data-files
</code>
</td>
<td>
MySQL packaging of ICU data files needed by MySQL regular expressions
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-community-libs
</code>
</td>
<td>
Shared libraries for MySQL database client applications
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-community-libs-compat
</code>
</td>
<td>
Shared compatibility libraries for previous MySQL installations; only
present if previous MySQL versions are supported by the
platform
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-community-server
</code>
</td>
<td>
Database server and related tools
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-community-server-debug
</code>
</td>
<td>
Debug server and plugin binaries
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-community-test
</code>
</td>
<td>
Test suite for the MySQL server
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-community
</code>
</td>
<td>
The source code RPM looks similar to
mysql-community-8.4.3-1.el7.src.rpm, depending
on selected OS
</td>
</tr>
<tr>
<td>
Additional *debuginfo* RPMs
</td>
<td>
There are several
<code class="literal">
debuginfo
</code>
packages:
mysql-community-client-debuginfo,
mysql-community-libs-debuginfo
mysql-community-server-debug-debuginfo
mysql-community-server-debuginfo, and
mysql-community-test-debuginfo.
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 739px;">
<thead>
<tr>
<th style="width: 430.484px;">
Package Name
</th>
<th style="width: 307.516px;">
Summary
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<div class="table">
<a name="idm46045330752480">
</a>
<p class="title">
<b>
Table 2.9 RPM Packages for the MySQL Enterprise Edition
</b>
</p>
<div class="table-contents">
<table frame="all">
<colgroup>
<col style="width: 35%"/>
<col style="width: 25%"/>
</colgroup>
<thead>
<tr>
<th>
Package Name
</th>
<th>
Summary
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code class="literal">
mysql-commercial-backup
</code>
</td>
<td>
MySQL Enterprise Backup
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-commercial-client
</code>
</td>
<td>
MySQL client applications and tools
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-commercial-client-plugins
</code>
</td>
<td>
Shared plugins for MySQL client applications
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-commercial-common
</code>
</td>
<td>
Common files for server and client libraries
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-commercial-devel
</code>
</td>
<td>
Development header files and libraries for MySQL database client
applications
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-commercial-embedded-compat
</code>
</td>
<td>
MySQL server as an embedded library with compatibility for applications
using version 18 of the library
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-commercial-icu-data-files
</code>
</td>
<td>
MySQL packaging of ICU data files needed by MySQL regular expressions
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-commercial-libs
</code>
</td>
<td>
Shared libraries for MySQL database client applications
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-commercial-libs-compat
</code>
</td>
<td>
Shared compatibility libraries for previous MySQL installations; only
present if previous MySQL versions are supported by the
platform. The version of the libraries matches the version
of the libraries installed by default by the distribution
you are using.
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-commercial-server
</code>
</td>
<td>
Database server and related tools
</td>
</tr>
<tr>
<td>
<code class="literal">
mysql-commercial-test
</code>
</td>
<td>
Test suite for the MySQL server
</td>
</tr>
<tr>
<td>
Additional *debuginfo* RPMs
</td>
<td>
There are several
<code class="literal">
debuginfo
</code>
packages:
mysql-commercial-client-debuginfo,
mysql-commercial-libs-debuginfo
mysql-commercial-server-debug-debuginfo
mysql-commercial-server-debuginfo, and
mysql-commercial-test-debuginfo.
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 739px;">
<thead>
<tr>
<th style="width: 430.484px;">
Package Name
</th>
<th style="width: 307.516px;">
Summary
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<p>
The full names for the RPMs have the following syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa8362808"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><em class="replaceable">packagename</em>-<em class="replaceable">version</em>-<em class="replaceable">distribution</em>-<em class="replaceable">arch</em><span class="token punctuation">.</span>rpm</code></pre>
</div>
<p>
The
<em class="replaceable">
<code>
distribution
</code>
</em>
and
<em class="replaceable">
<code>
arch
</code>
</em>
values indicate the Linux
distribution and the processor type for which the package was
built. See the table below for lists of the distribution
identifiers:
</p>
<div class="table">
<a name="idm46045330710288">
</a>
<p class="title">
<b>
Table 2.10 MySQL Linux RPM Package Distribution Identifiers
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col style="width: 25%"/>
<col style="width: 75%"/>
</colgroup>
<thead>
<tr>
<th>
Distribution Value
</th>
<th>
Intended Use
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
el
<em class="replaceable">
<code>
{version}
</code>
</em>
where
<em class="replaceable">
<code>
{version}
</code>
</em>
is the major Enterprise
Linux version, such as
<code class="literal">
el8
</code>
</td>
<td>
EL6 (8.0), EL7, EL8, and EL9-based platforms (for example, the corresponding versions of Oracle Linux, Red Hat Enterprise Linux, and CentOS)
</td>
</tr>
<tr>
<td>
fc
<em class="replaceable">
<code>
{version}
</code>
</em>
where
<em class="replaceable">
<code>
{version}
</code>
</em>
is the major Fedora
version, such as
<code class="literal">
fc37
</code>
</td>
<td>
Fedora 39, 40, and 41
</td>
</tr>
<tr>
<td>
<code class="literal">
sl5
</code>
</td>
<td>
SUSE Linux Enterprise Server 15
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
To see all files in an RPM package (for example,
<code class="literal">
mysql-community-server
</code>
), use the following
command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa16131180"><div class="copy-help left">Press ⌘+C to 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">rpm</span> <span class="token property">-qpl</span> mysql-community-server-<em class="replaceable">version</em>-<em class="replaceable">distribution</em>-<em class="replaceable">arch</em><span class="token punctuation">.</span>rpm</code></pre>
</div>
<p>
<span class="emphasis">
<em>
The discussion in the rest of this section applies only
to an installation process using the RPM packages directly
downloaded from Oracle, instead of through a MySQL
repository.
</em>
</span>
</p>
<p>
Dependency relationships exist among some of the packages. If you
plan to install many of the packages, you may wish to download the
RPM bundle
<span class="command">
<strong>
tar
</strong>
</span>
file instead, which contains all
the RPM packages listed above, so that you need not download them
separately.
</p>
<p>
In most cases, you need to install the
<code class="literal">
mysql-community-server
</code>
,
<code class="literal">
mysql-community-client
</code>
,
<code class="literal">
mysql-community-client-plugins
</code>
,
<code class="literal">
mysql-community-libs
</code>
,
<code class="literal">
mysql-community-icu-data-files
</code>
,
<code class="literal">
mysql-community-common
</code>
, and
<code class="literal">
mysql-community-libs-compat
</code>
packages to get a
functional, standard MySQL installation. To perform such a
standard, basic installation, go to the folder that contains all
those packages (and, preferably, no other RPM packages with
similar names), and issue the following command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa95537303"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> yum install mysql-community-<span class="token punctuation">{</span>server<span class="token punctuation">,</span>client<span class="token punctuation">,</span>client-plugins<span class="token punctuation">,</span>icu-data-files<span class="token punctuation">,</span>common<span class="token punctuation">,</span>libs<span class="token punctuation">}</span>-*</code></pre>
</div>
<p>
Replace
<span class="command">
<strong>
yum
</strong>
</span>
with
<span class="command">
<strong>
zypper
</strong>
</span>
for
SLES, and with
<span class="command">
<strong>
dnf
</strong>
</span>
for Fedora.
</p>
<p>
While it is much preferable to use a high-level package management
tool like
<span class="command">
<strong>
yum
</strong>
</span>
to install the packages, users
who prefer direct
<span class="command">
<strong>
rpm
</strong>
</span>
commands can replace the
<span class="command">
<strong>
yum install
</strong>
</span>
command with the
<span class="command">
<strong>
rpm
-Uvh
</strong>
</span>
command; however, using
<span class="command">
<strong>
rpm -Uvh
</strong>
</span>
instead makes the installation process more prone to failure, due
to potential dependency issues the installation process might run
into.
</p>
<p>
To install only the client programs, you can skip
<code class="literal">
mysql-community-server
</code>
in your list of packages
to install; issue the following command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa52073376"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> yum install mysql-community-<span class="token punctuation">{</span>client<span class="token punctuation">,</span>client-plugins<span class="token punctuation">,</span>common<span class="token punctuation">,</span>libs<span class="token punctuation">}</span>-*</code></pre>
</div>
<p>
Replace
<span class="command">
<strong>
yum
</strong>
</span>
with
<span class="command">
<strong>
zypper
</strong>
</span>
for
SLES, and with
<span class="command">
<strong>
dnf
</strong>
</span>
for Fedora.
</p>
<p>
A standard installation of MySQL using the RPM packages result in
files and resources created under the system directories, shown in
the following table.
</p>
<div class="table">
<a name="mysql-installation-layout-linuxrpm">
</a>
<p class="title">
<b>
Table 2.11 MySQL Installation Layout for Linux RPM Packages from the MySQL Developer Zone
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col style="width: 55%"/>
<col style="width: 45%"/>
</colgroup>
<thead>
<tr>
<th>
Files or Resources
</th>
<th>
Location
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Client programs and scripts
</td>
<td>
<code class="filename">
/usr/bin
</code>
</td>
</tr>
<tr>
<td>
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server
</td>
<td>
<code class="filename">
/usr/sbin
</code>
</td>
</tr>
<tr>
<td>
Configuration file
</td>
<td>
<code class="filename">
/etc/my.cnf
</code>
</td>
</tr>
<tr>
<td>
Data directory
</td>
<td>
<code class="filename">
/var/lib/mysql
</code>
</td>
</tr>
<tr>
<td>
Error log file
</td>
<td>
<p>
For RHEL, Oracle Linux, CentOS or Fedora platforms:
<code class="filename">
/var/log/mysqld.log
</code>
</p>
<p>
For SLES:
<code class="filename">
/var/log/mysql/mysqld.log
</code>
</p>
</td>
</tr>
<tr>
<td>
Value of
<a class="link" href="server-system-variables.html#sysvar_secure_file_priv">
<code class="literal">
secure_file_priv
</code>
</a>
</td>
<td>
<code class="filename">
/var/lib/mysql-files
</code>
</td>
</tr>
<tr>
<td>
System V init script
</td>
<td>
<p>
For RHEL, Oracle Linux, CentOS or Fedora platforms:
<code class="filename">
/etc/init.d/mysqld
</code>
</p>
<p>
For SLES:
<code class="filename">
/etc/init.d/mysql
</code>
</p>
</td>
</tr>
<tr>
<td>
Systemd service
</td>
<td>
<p>
For RHEL, Oracle Linux, CentOS or Fedora platforms:
<code class="filename">
mysqld
</code>
</p>
<p>
For SLES:
<code class="filename">
mysql
</code>
</p>
</td>
</tr>
<tr>
<td>
Pid file
</td>
<td>
<code class="filename">
/var/run/mysql/mysqld.pid
</code>
</td>
</tr>
<tr>
<td>
Socket
</td>
<td>
<code class="filename">
/var/lib/mysql/mysql.sock
</code>
</td>
</tr>
<tr>
<td>
Keyring directory
</td>
<td>
<code class="filename">
/var/lib/mysql-keyring
</code>
</td>
</tr>
<tr>
<td>
Unix manual pages
</td>
<td>
<code class="filename">
/usr/share/man
</code>
</td>
</tr>
<tr>
<td>
Include (header) files
</td>
<td>
<code class="filename">
/usr/include/mysql
</code>
</td>
</tr>
<tr>
<td>
Libraries
</td>
<td>
<code class="filename">
/usr/lib/mysql
</code>
</td>
</tr>
<tr>
<td>
Miscellaneous support files (for example, error messages, and character
set files)
</td>
<td>
<code class="filename">
/usr/share/mysql
</code>
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 739px;">
<thead>
<tr>
<th style="width: 405.891px;">
Files or Resources
</th>
<th style="width: 332.109px;">
Location
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<p>
The installation also creates a user named
<code class="literal">
mysql
</code>
and a group named
<code class="literal">
mysql
</code>
on the system.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Notes
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The
<code class="literal">
mysql
</code>
user is created using the
<code class="option">
-r
</code>
and
<code class="option">
-s /bin/false
</code>
options of the
<span class="command">
<strong>
useradd
</strong>
</span>
command, so that it does not have login permissions to your
server host (see
<a class="ulink" href="/doc/mysql-secure-deployment-guide/en/secure-deployment-install.html#secure-deployment-mysql-user" target="_top">
Creating
the mysql User and Group
</a>
for details). To switch to
the
<code class="literal">
mysql
</code>
user on your OS, use the
<code class="option">
--shell=/bin/bash
</code>
option for the
<span class="command">
<strong>
su
</strong>
</span>
command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa50170708"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple">$<span class="token operator">></span> su <span class="token operator">-</span> mysql <span class="token operator">--</span>shell<span class="token operator">=</span><span class="token operator">/</span>bin<span class="token operator">/</span>bash</code></pre>
</div>
<p>
</p>
</li>
<li class="listitem">
<p>
Installation of previous versions of MySQL using older
packages might have created a configuration file named
<code class="filename">
/usr/my.cnf
</code>
. It is highly recommended
that you examine the contents of the file and migrate the
desired settings inside to the file
<code class="filename">
/etc/my.cnf
</code>
file, then remove
<code class="filename">
/usr/my.cnf
</code>
.
</p>
</li>
</ul>
</div>
</div>
<p>
MySQL is NOT automatically started at the end of the installation
process. For Red Hat Enterprise Linux, Oracle Linux, CentOS, and
Fedora systems, use the following command to start MySQL:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa93778825"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">systemctl</span> start mysqld</code></pre>
</div>
<p>
For SLES systems, the command is the same, but the service name is
different:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa22519783"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">systemctl</span> start mysql</code></pre>
</div>
<p>
If the operating system is systemd enabled, standard
<span class="command">
<strong>
systemctl
</strong>
</span>
(or alternatively,
<span class="command">
<strong>
service
</strong>
</span>
with the arguments reversed) commands
such as
<span class="command">
<strong>
stop
</strong>
</span>
,
<span class="command">
<strong>
start
</strong>
</span>
,
<span class="command">
<strong>
status
</strong>
</span>
, and
<a class="link" href="restart.html" title="15.7.8.8 RESTART Statement">
<span class="command">
<strong>
restart
</strong>
</span>
</a>
should
be used to manage the MySQL server service. The
<code class="literal">
mysqld
</code>
service is enabled by default, and it
starts at system reboot. Notice that certain things might work
differently on systemd platforms: for example, changing the
location of the data directory might cause issues. See
<a class="xref" href="using-systemd.html" title="2.5.9 Managing MySQL Server with systemd">
Section 2.5.9, “Managing MySQL Server with systemd”
</a>
for additional information.
</p>
<p>
During an upgrade installation using RPM and DEB packages, if the
MySQL server is running when the upgrade occurs then the MySQL
server is stopped, the upgrade occurs, and the MySQL server is
restarted. One exception: if the edition also changes during an
upgrade (such as community to commercial, or vice-versa), then
MySQL server is not restarted.
</p>
<p>
At the initial start up of the server, the following happens,
given that the data directory of the server is empty:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The server is initialized.
</p>
</li>
<li class="listitem">
<p>
An SSL certificate and key files are generated in the data
directory.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="validate-password.html" title="8.4.3 The Password Validation Component">
<code class="literal">
validate_password
</code>
</a>
is installed and enabled.
</p>
</li>
<li class="listitem">
<p>
A superuser account
<code class="literal">
'root'@'localhost'
</code>
is
created. A password for the superuser is set and stored in the
error log file. To reveal it, use the following command for
RHEL, Oracle Linux, CentOS, and Fedora systems:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa90733018"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> grep <span class="token atrule">'temporary password'</span> /var/log/mysqld<span class="token punctuation">.</span>log</code></pre>
</div>
<p>
Use the following command for SLES systems:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa53326635"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> grep <span class="token atrule">'temporary password'</span> /var/log/mysql/mysqld<span class="token punctuation">.</span>log</code></pre>
</div>
<p>
The next step is to log in with the generated, temporary
password and set a custom password for the superuser account:
</p>
</li>
</ul>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa61630237"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span> <span class="token property">-uroot</span> <span class="token property">-p</span></code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa21459832"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">USER</span> <span class="token string">'root'</span>@<span class="token string">'localhost'</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'MyNewPass4!'</span><span class="token punctuation">;</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<a class="link" href="validate-password.html" title="8.4.3 The Password Validation Component">
<code class="literal">
validate_password
</code>
</a>
is installed by default. The default password policy implemented
by
<code class="literal">
validate_password
</code>
requires that passwords
contain at least one uppercase letter, one lowercase letter, one
digit, and one special character, and that the total password
length is at least 8 characters.
</p>
</div>
<p>
If something goes wrong during installation, you might find debug
information in the error log file
<code class="filename">
/var/log/mysqld.log
</code>
.
</p>
<p>
For some Linux distributions, it might be necessary to increase
the limit on number of file descriptors available to
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
. See
<a class="xref" href="not-enough-file-handles.html" title="B.3.2.16 File Not Found and Similar Errors">
Section B.3.2.16, “File Not Found and Similar Errors”
</a>
</p>
<p>
<b>
Installing Client Libraries from Multiple MySQL Versions.
</b>
It is possible to install multiple client library versions, such
as for the case that you want to maintain compatibility with
older applications linked against previous libraries. To install
an older client library, use the
<code class="option">
--oldpackage
</code>
option with
<span class="command">
<strong>
rpm
</strong>
</span>
. For example, to install
<code class="literal">
mysql-community-libs-5.5
</code>
on an EL6 system
that has
<code class="literal">
libmysqlclient.21
</code>
from MySQL 8.0,
use a command like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa76794320"><div class="copy-help left">Press ⌘+C to 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">rpm</span> <span class="token property">--oldpackage</span> <span class="token property">-ivh</span> mysql-community-libs-5<span class="token punctuation">.</span>5<span class="token punctuation">.</span>50-2<span class="token punctuation">.</span>el6<span class="token punctuation">.</span>x86_64<span class="token punctuation">.</span>rpm</code></pre>
</div>
<p>
<b>
Debug Package.
</b>
A special variant of MySQL Server compiled with the
<a class="link" href="dbug-package.html" title="7.9.4 The DBUG Package">
debug package
</a>
has been
included in the server RPM packages. It performs debugging and
memory allocation checks and produces a trace file when the
server is running. To use that debug version, start MySQL with
<code class="filename">
/usr/sbin/mysqld-debug
</code>
, instead of starting
it as a service or with
<code class="filename">
/usr/sbin/mysqld
</code>
.
See
<a class="xref" href="dbug-package.html" title="7.9.4 The DBUG Package">
Section 7.9.4, “The DBUG Package”
</a>
for the debug options you can
use.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The default plugin directory is
<code class="filename">
/usr/lib64/mysql/plugin/debug
</code>
and is
configurable with
<a class="link" href="server-system-variables.html#sysvar_plugin_dir">
<code class="literal">
plugin_dir
</code>
</a>
.
</p>
</div>
<p>
<b>
Rebuilding RPMs from source SRPMs.
</b>
Source code SRPM packages for MySQL are available for download.
They can be used as-is to rebuild the MySQL RPMs with the
standard
<span class="command">
<strong>
rpmbuild
</strong>
</span>
tool chain.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/alter-function.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="alter-function">
</a>
15.1.4 ALTER FUNCTION Statement
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045189755776">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa98251007"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">FUNCTION</span> <em class="replaceable">func_name</em> <span class="token punctuation">[</span><em class="replaceable">characteristic</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">]</span>
<em class="replaceable">characteristic</em>: {
<span class="token keyword">COMMENT</span> <span class="token string">'<em class="replaceable">string</em>'</span>
<span class="token operator">|</span> <span class="token keyword">LANGUAGE</span> <span class="token keyword">SQL</span>
<span class="token operator">|</span> { <span class="token keyword">CONTAINS</span> <span class="token keyword">SQL</span> <span class="token operator">|</span> <span class="token keyword">NO</span> <span class="token keyword">SQL</span> <span class="token operator">|</span> <span class="token keyword">READS</span> <span class="token keyword">SQL</span> <span class="token keyword">DATA</span> <span class="token operator">|</span> <span class="token keyword">MODIFIES</span> <span class="token keyword">SQL</span> <span class="token keyword">DATA</span> }
<span class="token operator">|</span> <span class="token keyword">SQL</span> <span class="token keyword">SECURITY</span> { <span class="token keyword">DEFINER</span> <span class="token operator">|</span> <span class="token keyword">INVOKER</span> }
}</code></pre>
</div>
<p>
This statement can be used to change the characteristics of a
stored function. More than one change may be specified in an
<a class="link" href="alter-function.html" title="15.1.4 ALTER FUNCTION Statement">
<code class="literal">
ALTER FUNCTION
</code>
</a>
statement. However,
you cannot change the parameters or body of a stored function
using this statement; to make such changes, you must drop and
re-create the function using
<a class="link" href="drop-function.html" title="15.1.26 DROP FUNCTION Statement">
<code class="literal">
DROP
FUNCTION
</code>
</a>
and
<a class="link" href="create-function.html" title="15.1.14 CREATE FUNCTION Statement">
<code class="literal">
CREATE
FUNCTION
</code>
</a>
.
</p>
<p>
You must have the
<a class="link" href="privileges-provided.html#priv_alter-routine">
<code class="literal">
ALTER ROUTINE
</code>
</a>
privilege for the function. (That privilege is granted
automatically to the function creator.) If binary logging is
enabled, the
<a class="link" href="alter-function.html" title="15.1.4 ALTER FUNCTION Statement">
<code class="literal">
ALTER FUNCTION
</code>
</a>
statement might also require the
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege, as described in
<a class="xref" href="stored-programs-logging.html" title="27.7 Stored Program Binary Logging">
Section 27.7, “Stored Program Binary Logging”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/optimizing-memory.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="optimizing-memory">
</a>
10.12.3 Optimizing Memory Use
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="memory-use.html">
10.12.3.1 How MySQL Uses Memory
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="monitor-mysql-memory-use.html">
10.12.3.2 Monitoring MySQL Memory Usage
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="large-page-support.html">
10.12.3.3 Enabling Large Page Support
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045222346880">
</a>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/channels-naming-conventions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="channels-naming-conventions">
</a>
19.2.2.4 Replication Channel Naming Conventions
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045138072720">
</a>
<p>
This section describes how naming conventions are impacted by
replication channels.
</p>
<p>
Each replication channel has a unique name which is a string with
a maximum length of 64 characters and is case-insensitive. Because
channel names are used in the replica's applier metadata
repository table, the character set used for these is always
UTF-8. Although you are generally free to use any name for
channels, the following names are reserved:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
group_replication_applier
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
group_replication_recovery
</code>
</p>
</li>
</ul>
</div>
<p>
The name you choose for a replication channel also influences the
file names used by a multi-source replica. The relay log files and
index files for each channel are named
<code class="filename">
<em class="replaceable">
<code>
relay_log_basename
</code>
</em>
-
<em class="replaceable">
<code>
channel
</code>
</em>
.xxxxxx
</code>
,
where
<em class="replaceable">
<code>
relay_log_basename
</code>
</em>
is a base name
specified using the
<a class="link" href="replication-options-replica.html#sysvar_relay_log">
<code class="literal">
relay_log
</code>
</a>
system variable, and
<em class="replaceable">
<code>
channel
</code>
</em>
is the
name of the channel logged to this file. If you do not specify the
<a class="link" href="replication-options-replica.html#sysvar_relay_log">
<code class="literal">
relay_log
</code>
</a>
system variable, a
default file name is used that also includes the name of the
channel.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/monitor-mysql-memory-use.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="monitor-mysql-memory-use">
</a>
10.12.3.2 Monitoring MySQL Memory Usage
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045222217424">
</a>
<a class="indexterm" name="idm46045222215936">
</a>
<p>
The following example demonstrates how to use
<a class="link" href="performance-schema.html" title="Chapter 29 MySQL Performance Schema">
Performance Schema
</a>
and
<a class="link" href="sys-schema.html" title="Chapter 30 MySQL sys Schema">
sys schema
</a>
to monitor
MySQL memory usage.
</p>
<p>
Most Performance Schema memory instrumentation is disabled by
default. Instruments can be enabled by updating the
<code class="literal">
ENABLED
</code>
column of the Performance Schema
<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. Memory
instruments have names in the form of
<code class="literal">
memory/
<em class="replaceable">
<code>
code_area
</code>
</em>
/
<em class="replaceable">
<code>
instrument_name
</code>
</em>
</code>
,
where
<em class="replaceable">
<code>
code_area
</code>
</em>
is a value such as
<code class="literal">
sql
</code>
or
<code class="literal">
innodb
</code>
, and
<em class="replaceable">
<code>
instrument_name
</code>
</em>
is the instrument
detail.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
To view available MySQL memory instruments, query the
Performance Schema
<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. The
following query returns hundreds of memory instruments for
all code areas.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa26417549"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>setup_instruments
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'%memory%'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
You can narrow results by specifying a code area. For
example, you can limit results to
<code class="literal">
InnoDB
</code>
memory instruments by specifying
<code class="literal">
innodb
</code>
as the code area.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa17360194"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>setup_instruments
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'%memory/innodb%'</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> NAME <span class="token punctuation">|</span> ENABLED <span class="token punctuation">|</span> TIMED <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/adaptive hash index <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/buf_buf_pool <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/dict_stats_bg_recalc_pool_t <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/dict_stats_index_map_t <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/dict_stats_n_diff_on_level <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/other <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/row_log_buf <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/row_merge_sort <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/std <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/trx_sys_t::rw_trx_ids <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
</div>
<p>
Depending on your MySQL installation, code areas may
include
<code class="literal">
performance_schema
</code>
,
<code class="literal">
sql
</code>
,
<code class="literal">
client
</code>
,
<code class="literal">
innodb
</code>
,
<code class="literal">
myisam
</code>
,
<code class="literal">
csv
</code>
,
<code class="literal">
memory
</code>
,
<code class="literal">
blackhole
</code>
,
<code class="literal">
archive
</code>
,
<code class="literal">
partition
</code>
, and others.
</p>
</li>
<li class="listitem">
<p>
To enable memory instruments, add a
<code class="literal">
performance-schema-instrument
</code>
rule to
your MySQL configuration file. For example, to enable all
memory instruments, add this rule to your configuration
file and restart the server:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-ini"><div class="docs-select-all right" id="sa25148192"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token constant">performance-schema-instrument</span><span class="token attr-value"><span class="token punctuation">=</span>'memory/%=COUNTED'</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Enabling memory instruments at startup ensures that
memory allocations that occur at startup are counted.
</p>
</div>
<p>
After restarting the server, the
<code class="literal">
ENABLED
</code>
column of the Performance
Schema
<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 should report
<code class="literal">
YES
</code>
for memory
instruments that you enabled. The
<code class="literal">
TIMED
</code>
column 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 is
ignored for memory instruments because memory operations
are not timed.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa7318312"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>setup_instruments
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'%memory/innodb%'</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> NAME <span class="token punctuation">|</span> ENABLED <span class="token punctuation">|</span> TIMED <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/adaptive hash index <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/buf_buf_pool <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/dict_stats_bg_recalc_pool_t <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/dict_stats_index_map_t <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/dict_stats_n_diff_on_level <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/other <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/row_log_buf <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/row_merge_sort <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/std <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb/trx_sys_t::rw_trx_ids <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Query memory instrument data. In this example, memory
instrument data is queried in the Performance Schema
<a class="link" href="performance-schema-memory-summary-tables.html" title="29.12.20.10 Memory Summary Tables">
<code class="literal">
memory_summary_global_by_event_name
</code>
</a>
table, which summarizes data by
<code class="literal">
EVENT_NAME
</code>
. The
<code class="literal">
EVENT_NAME
</code>
is the name of the
instrument.
</p>
<p>
The following query returns memory data for the
<code class="literal">
InnoDB
</code>
buffer pool. For column
descriptions, see
<a class="xref" href="performance-schema-memory-summary-tables.html" title="29.12.20.10 Memory Summary Tables">
Section 29.12.20.10, “Memory Summary Tables”
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63781750"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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>memory_summary_global_by_event_name
<span class="token keyword">WHERE</span> EVENT_NAME <span class="token operator">LIKE</span> <span class="token string">'memory/innodb/buf_buf_pool'</span>\G
EVENT_NAME: <span class="token keyword">memory</span><span class="token operator">/</span>innodb<span class="token operator">/</span>buf_buf_pool
COUNT_ALLOC: <span class="token number">1</span>
COUNT_FREE: <span class="token number">0</span>
SUM_NUMBER_OF_BYTES_ALLOC: <span class="token number">137428992</span>
SUM_NUMBER_OF_BYTES_FREE: <span class="token number">0</span>
LOW_COUNT_USED: <span class="token number">0</span>
CURRENT_COUNT_USED: <span class="token number">1</span>
HIGH_COUNT_USED: <span class="token number">1</span>
LOW_NUMBER_OF_BYTES_USED: <span class="token number">0</span>
CURRENT_NUMBER_OF_BYTES_USED: <span class="token number">137428992</span>
HIGH_NUMBER_OF_BYTES_USED: <span class="token number">137428992</span></code></pre>
</div>
<p>
The same underlying data can be queried using the
<a class="link" href="sys-schema.html" title="Chapter 30 MySQL sys Schema">
<code class="literal">
sys
</code>
</a>
schema
<a class="link" href="sys-memory-global-by-current-bytes.html" title="30.4.3.19 The memory_global_by_current_bytes and x$memory_global_by_current_bytes Views">
<code class="literal">
memory_global_by_current_bytes
</code>
</a>
table, which shows current memory usage within the server
globally, broken down by allocation type.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa11398658"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> sys<span class="token punctuation">.</span>memory_global_by_current_bytes
<span class="token keyword">WHERE</span> event_name <span class="token operator">LIKE</span> <span class="token string">'memory/innodb/buf_buf_pool'</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>
event_name<span class="token punctuation">:</span> memory/innodb/buf_buf_pool
current_count<span class="token punctuation">:</span> 1
current_alloc<span class="token punctuation">:</span> 131.06 MiB
current_avg_alloc<span class="token punctuation">:</span> 131.06 MiB
high_count<span class="token punctuation">:</span> 1
high_alloc<span class="token punctuation">:</span> 131.06 MiB
high_avg_alloc<span class="token punctuation">:</span> 131.06 MiB</span></code></pre>
</div>
<p>
This
<a class="link" href="sys-schema.html" title="Chapter 30 MySQL sys Schema">
<code class="literal">
sys
</code>
</a>
schema query
aggregates currently allocated memory
(
<code class="literal">
current_alloc
</code>
) by code area:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa43500648"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">SUBSTRING_INDEX</span><span class="token punctuation">(</span>event_name<span class="token punctuation">,</span><span class="token string">'/'</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">)</span> <span class="token keyword">AS</span>
code_area<span class="token punctuation">,</span> FORMAT_BYTES<span class="token punctuation">(</span><span class="token function">SUM</span><span class="token punctuation">(</span>current_alloc<span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token keyword">AS</span> current_alloc
<span class="token keyword">FROM</span> sys<span class="token punctuation">.</span>x$memory_global_by_current_bytes
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token function">SUBSTRING_INDEX</span><span class="token punctuation">(</span>event_name<span class="token punctuation">,</span><span class="token string">'/'</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">)</span>
<span class="token keyword">ORDER</span> <span class="token keyword">BY</span> <span class="token function">SUM</span><span class="token punctuation">(</span>current_alloc<span class="token punctuation">)</span> <span class="token keyword">DESC</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> code_area <span class="token punctuation">|</span> current_alloc <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/innodb <span class="token punctuation">|</span> 843.24 MiB <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/performance_schema <span class="token punctuation">|</span> 81.29 MiB <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/mysys <span class="token punctuation">|</span> 8.20 MiB <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/sql <span class="token punctuation">|</span> 2.47 MiB <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/memory <span class="token punctuation">|</span> 174.01 KiB <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/myisam <span class="token punctuation">|</span> 46.53 KiB <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/blackhole <span class="token punctuation">|</span> 512 bytes <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/federated <span class="token punctuation">|</span> 512 bytes <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/csv <span class="token punctuation">|</span> 512 bytes <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/vio <span class="token punctuation">|</span> 496 bytes <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
For more information about
<a class="link" href="sys-schema.html" title="Chapter 30 MySQL sys Schema">
<code class="literal">
sys
</code>
</a>
schema, see
<a class="xref" href="sys-schema.html" title="Chapter 30 MySQL sys Schema">
Chapter 30,
<i>
MySQL sys Schema
</i>
</a>
.
</p>
</li>
</ol>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-enterprise-monitor.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="mysql-enterprise-monitor">
</a>
32.8 MySQL Enterprise Monitor Overview
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045060187584">
</a>
<a class="indexterm" name="idm46045060186496">
</a>
<a class="indexterm" name="idm46045060184992">
</a>
<a class="indexterm" name="idm46045060183920">
</a>
<p>
For information about MySQL Enterprise Monitor behavior, see the MySQL Enterprise Monitor manual:
<a class="ulink" href="/doc/mysql-monitor/en/" target="_top">
https://dev.mysql.com/doc/mysql-monitor/en/
</a>
.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
MySQL Enterprise Monitor will be end of life and deprecated with obsolescence as
of January 1, 2025.
</p>
</div>
<p>
After this date, MySQL Enterprise Monitor will no longer receive security updates,
non-security updates, bug fixes, or online technical content
updates. It will transition to the
<span class="emphasis">
<em>
Sustaining Support
model
</em>
</span>
.
</p>
<p>
What to expect when MySQL Enterprise Monitor reaches the end of life (EOL):
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
MySQL will cease all bug fix activities for the product
</p>
</li>
<li class="listitem">
<p>
MySQL will cease all security fix activities for the product
</p>
</li>
<li class="listitem">
<p>
MySQL will cease all new feature work for the product
</p>
</li>
</ul>
</div>
<p>
Sustaining Support does not include:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
New program updates, fixes, security alerts, and critical
patch updates
</p>
</li>
<li class="listitem">
<p>
New tax, legal, or regulatory updates
</p>
</li>
<li class="listitem">
<p>
New upgrade scripts
</p>
</li>
<li class="listitem">
<p>
Certification with new third-party products/versions
</p>
</li>
<li class="listitem">
<p>
24 hour commitment and response guidelines for Severity 1
service requests as defined in "Section 9 - Severity
Definitions" in the document titled "Oracle Software Technical
Support Policies"
</p>
</li>
<li class="listitem">
<p>
Previously released fixes or updates that Oracle has withdrawn
from publication. Older or existing published software bundles
will remain available as archived content.
</p>
</li>
</ul>
</div>
<p>
For the set of Oracle Technical Support Policies, visit:
<a class="ulink" href="https://www.oracle.com/support/policies.html" target="_blank">
https://www.oracle.com/support/policies.html
</a>
</p>
<p>
For an explanation of the different support models (like
Sustaining Support), visit:
<a class="ulink" href="https://www.oracle.com/support/lifetime-support/" target="_blank">
https://www.oracle.com/support/lifetime-support/
</a>
</p>
<p>
For customers that are currently using earlier versions of
MySQL Enterprise Monitor, your options include:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Use Enterprise Manager for MySQL. This is a free product for
customers with a valid Oracle Support Contract. For more
information, visit
<a class="ulink" href="https://blogs.oracle.com/observability/post/comprehensive-monitoring-and-compliance-management-for-mysql-databases-using-enterprise-manager" target="_blank">
Comprehensive
Monitoring and Compliance Management for MySQL Databases using
Enterprise Manager
</a>
.
</p>
</li>
<li class="listitem">
<p>
Use the database monitoring capabilities of the OCI Database
Management service. For MySQL on-premises customers, this is a
paid feature that will be released soon. For more information,
visit
<a class="ulink" href="https://blogs.oracle.com/mysql/post/database-management-for-mysql-heatwave" target="_blank">
Database
Management for MySQL HeatWave
</a>
.
</p>
</li>
</ul>
</div>
<h3>
<a name="idm46045060162880">
</a>
Affected deployments
</h3>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
MySQL Enterprise Monitor Service Manager for Linux x86
(64-bit)
</p>
</li>
<li class="listitem">
<p>
MySQL Enterprise Monitor Agent for Linux x86 (64-bit)
</p>
</li>
<li class="listitem">
<p>
MySQL Enterprise Monitor Service Manager for Windows x86
(64-bit)
</p>
</li>
<li class="listitem">
<p>
MySQL Enterprise Monitor Agent for Microsoft Windows x86
(64-bit)
</p>
</li>
<li class="listitem">
<p>
MySQL Enterprise Monitor Service Manager for Mac OS X x86
(64-bit)
</p>
</li>
<li class="listitem">
<p>
MySQL Enterprise Monitor Agent for Mac OS X x86 (64-bit)
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|