url
stringlengths 45
122
| content
stringlengths 380
3.07M
|
---|---|
https://dev.mysql.com/doc/refman/8.4/en/sorted-index-builds.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sorted-index-builds">
</a>
17.6.2.3 Sorted Index Builds
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045165814816">
</a>
<a class="indexterm" name="idm46045165813328">
</a>
<p>
<code class="literal">
InnoDB
</code>
performs a bulk load instead of
inserting one index record at a time when creating or rebuilding
indexes. This method of index creation is also known as a sorted
index build. Sorted index builds are not supported for spatial
indexes.
</p>
<p>
There are three phases to an index build. In the first phase, the
<a class="link" href="glossary.html#glos_clustered_index" title="clustered index">
clustered index
</a>
is
scanned, and index entries are generated and added to the sort
buffer. When the
<a class="link" href="glossary.html#glos_sort_buffer" title="sort buffer">
sort
buffer
</a>
becomes full, entries are sorted and written out to
a temporary intermediate file. This process is also known as a
<span class="quote">
“
<span class="quote">
run
</span>
”
</span>
. In the second phase, with one or more runs
written to the temporary intermediate file, a merge sort is
performed on all entries in the file. In the third and final
phase, the sorted entries are inserted into the
<a class="link" href="glossary.html#glos_b_tree" title="B-tree">
B-tree
</a>
; this final phase is
multithreaded.
</p>
<p>
Prior to the introduction of sorted index builds, index entries
were inserted into the B-tree one record at a time using insert
APIs. This method involved opening a B-tree
<a class="link" href="glossary.html#glos_cursor" title="cursor">
cursor
</a>
to find the insert
position and then inserting entries into a B-tree page using an
<a class="link" href="glossary.html#glos_optimistic" title="optimistic">
optimistic
</a>
insert. If an
insert failed due to a page being full, a
<a class="link" href="glossary.html#glos_pessimistic" title="pessimistic">
pessimistic
</a>
insert would
be performed, which involves opening a B-tree cursor and splitting
and merging B-tree nodes as necessary to find space for the entry.
The drawbacks of this
<span class="quote">
“
<span class="quote">
top-down
</span>
”
</span>
method of building
an index are the cost of searching for an insert position and the
constant splitting and merging of B-tree nodes.
</p>
<p>
Sorted index builds use a
<span class="quote">
“
<span class="quote">
bottom-up
</span>
”
</span>
approach to
building an index. With this approach, a reference to the
right-most leaf page is held at all levels of the B-tree. The
right-most leaf page at the necessary B-tree depth is allocated
and entries are inserted according to their sorted order. Once a
leaf page is full, a node pointer is appended to the parent page
and a sibling leaf page is allocated for the next insert. This
process continues until all entries are inserted, which may result
in inserts up to the root level. When a sibling page is allocated,
the reference to the previously pinned leaf page is released, and
the newly allocated leaf page becomes the right-most leaf page and
new default insert location.
</p>
<h5>
<a name="idm46045165800368">
</a>
Reserving B-tree Page Space for Future Index Growth
</h5>
<p>
To set aside space for future index growth, you can use the
<a class="link" href="innodb-parameters.html#sysvar_innodb_fill_factor">
<code class="literal">
innodb_fill_factor
</code>
</a>
variable to
reserve a percentage of B-tree page space. For example, setting
<a class="link" href="innodb-parameters.html#sysvar_innodb_fill_factor">
<code class="literal">
innodb_fill_factor
</code>
</a>
to 80 reserves
20 percent of the space in B-tree pages during a sorted index
build. This setting applies to both B-tree leaf and non-leaf
pages. It does not apply to external pages used for
<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>
entries. The amount of space
that is reserved may not be exactly as configured, as the
<a class="link" href="innodb-parameters.html#sysvar_innodb_fill_factor">
<code class="literal">
innodb_fill_factor
</code>
</a>
value is
interpreted as a hint rather than a hard limit.
</p>
<h5>
<a name="idm46045165792432">
</a>
Sorted Index Builds and Full-Text Index Support
</h5>
<p>
Sorted index builds are supported for
<a class="link" href="glossary.html#glos_fulltext_index" title="FULLTEXT index">
fulltext indexes
</a>
.
Previously, SQL was used to insert entries into a fulltext index.
</p>
<h5>
<a name="idm46045165790208">
</a>
Sorted Index Builds and Compressed Tables
</h5>
<p>
For
<a class="link" href="glossary.html#glos_compression" title="compression">
compressed tables
</a>
, the
previous index creation method appended entries to both compressed
and uncompressed pages. When the modification log (representing
free space on the compressed page) became full, the compressed
page would be recompressed. If compression failed due to a lack of
space, the page would be split. With sorted index builds, entries
are only appended to uncompressed pages. When an uncompressed page
becomes full, it is compressed. Adaptive padding is used to ensure
that compression succeeds in most cases, but if compression fails,
the page is split and compression is attempted again. This process
continues until compression is successful. For more information
about compression of B-Tree pages, see
<a class="xref" href="innodb-compression-internals.html" title="17.9.1.5 How Compression Works for InnoDB Tables">
Section 17.9.1.5, “How Compression Works for InnoDB Tables”
</a>
.
</p>
<h5>
<a name="idm46045165786688">
</a>
Sorted Index Builds and Redo Logging
</h5>
<p>
<a class="link" href="glossary.html#glos_redo_log" title="redo log">
Redo logging
</a>
is disabled
during a sorted index build. Instead, there is a
<a class="link" href="glossary.html#glos_checkpoint" title="checkpoint">
checkpoint
</a>
to ensure that
the index build can withstand an unexpected exit or failure. The
checkpoint forces a write of all dirty pages to disk. During a
sorted index build, the
<a class="link" href="glossary.html#glos_page_cleaner" title="page cleaner">
page
cleaner
</a>
thread is signaled periodically to flush
<a class="link" href="glossary.html#glos_dirty_page" title="dirty page">
dirty pages
</a>
to ensure that
the checkpoint operation can be processed quickly. Normally, the
page cleaner thread flushes dirty pages when the number of clean
pages falls below a set threshold. For sorted index builds, dirty
pages are flushed promptly to reduce checkpoint overhead and to
parallelize I/O and CPU activity.
</p>
<h5>
<a name="idm46045165781520">
</a>
Sorted Index Builds and Optimizer Statistics
</h5>
<p>
Sorted index builds may result in
<a class="link" href="glossary.html#glos_optimizer" title="optimizer">
optimizer
</a>
statistics that
differ from those generated by the previous method of index
creation. The difference in statistics, which is not expected to
affect workload performance, is due to the different algorithm
used to populate the index.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-data-lock-waits-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-data-lock-waits-table">
</a>
29.12.13.2 The data_lock_waits Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045070431840">
</a>
<a class="indexterm" name="idm46045070430352">
</a>
<p>
The
<a class="link" href="performance-schema-data-lock-waits-table.html" title="29.12.13.2 The data_lock_waits Table">
<code class="literal">
data_lock_waits
</code>
</a>
table
implements a many-to-many relationship showing which data lock
requests in 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
are blocked by which held data locks in 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. Held locks in
<a class="link" href="performance-schema-data-locks-table.html" title="29.12.13.1 The data_locks Table">
<code class="literal">
data_locks
</code>
</a>
appear in
<a class="link" href="performance-schema-data-lock-waits-table.html" title="29.12.13.2 The data_lock_waits Table">
<code class="literal">
data_lock_waits
</code>
</a>
only if they
block some lock request.
</p>
<p>
This information enables you to understand data lock
dependencies between sessions. The table exposes not only
which lock a session or transaction is waiting for, but which
session or transaction currently holds that lock.
</p>
<p>
Example data lock wait information:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa44509122"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>data_lock_waits\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
ENGINE<span class="token punctuation">:</span> INNODB
REQUESTING_ENGINE_LOCK_ID<span class="token punctuation">:</span> 140211201964816<span class="token punctuation">:</span>2<span class="token punctuation">:</span>4<span class="token punctuation">:</span>2<span class="token punctuation">:</span>140211086465800
REQUESTING_ENGINE_TRANSACTION_ID<span class="token punctuation">:</span> 1555
REQUESTING_THREAD_ID<span class="token punctuation">:</span> 47
REQUESTING_EVENT_ID<span class="token punctuation">:</span> 5
REQUESTING_OBJECT_INSTANCE_BEGIN<span class="token punctuation">:</span> 140211086465800
BLOCKING_ENGINE_LOCK_ID<span class="token punctuation">:</span> 140211201963888<span class="token punctuation">:</span>2<span class="token punctuation">:</span>4<span class="token punctuation">:</span>2<span class="token punctuation">:</span>140211086459880
BLOCKING_ENGINE_TRANSACTION_ID<span class="token punctuation">:</span> 1554
BLOCKING_THREAD_ID<span class="token punctuation">:</span> 46
BLOCKING_EVENT_ID<span class="token punctuation">:</span> 12
BLOCKING_OBJECT_INSTANCE_BEGIN<span class="token punctuation">:</span> 140211086459880</span></code></pre>
</div>
<p>
Unlike most Performance Schema data collection, there are no
instruments for controlling whether data lock information is
collected or system variables for controlling data lock table
sizes. The Performance Schema collects information that is
already available in the server, so there is no memory or CPU
overhead to generate this information or need for parameters
that control its collection.
</p>
<p>
Use the
<a class="link" href="performance-schema-data-lock-waits-table.html" title="29.12.13.2 The data_lock_waits Table">
<code class="literal">
data_lock_waits
</code>
</a>
table to
help diagnose performance problems that occur during times of
heavy concurrent load. For
<code class="literal">
InnoDB
</code>
, see the
discussion of this topic at
<a class="xref" href="innodb-information-schema-transactions.html" title="17.15.2 InnoDB INFORMATION_SCHEMA Transaction and Locking Information">
Section 17.15.2, “InnoDB INFORMATION_SCHEMA Transaction and Locking Information”
</a>
.
</p>
<p>
Because the columns in the
<a class="link" href="performance-schema-data-lock-waits-table.html" title="29.12.13.2 The data_lock_waits Table">
<code class="literal">
data_lock_waits
</code>
</a>
table are similar
to those in 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,
the column descriptions here are abbreviated. For more
detailed column descriptions, see
<a class="xref" href="performance-schema-data-locks-table.html" title="29.12.13.1 The data_locks Table">
Section 29.12.13.1, “The data_locks Table”
</a>
.
</p>
<p>
The
<a class="link" href="performance-schema-data-lock-waits-table.html" title="29.12.13.2 The data_lock_waits Table">
<code class="literal">
data_lock_waits
</code>
</a>
table has
these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
ENGINE
</code>
</p>
<p>
The storage engine that requested the lock.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
REQUESTING_ENGINE_LOCK_ID
</code>
</p>
<p>
The ID of the lock requested by the storage engine. To
obtain details about the lock, join this column with the
<code class="literal">
ENGINE_LOCK_ID
</code>
column of the
<a class="link" href="performance-schema-data-locks-table.html" title="29.12.13.1 The data_locks Table">
<code class="literal">
data_locks
</code>
</a>
table.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
REQUESTING_ENGINE_TRANSACTION_ID
</code>
</p>
<p>
The storage engine internal ID of the transaction that
requested the lock.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
REQUESTING_THREAD_ID
</code>
</p>
<p>
The thread ID of the session that requested the lock.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
REQUESTING_EVENT_ID
</code>
</p>
<p>
The Performance Schema event that caused the lock request
in the session that requested the lock.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
REQUESTING_OBJECT_INSTANCE_BEGIN
</code>
</p>
<p>
The address in memory of the requested lock.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
BLOCKING_ENGINE_LOCK_ID
</code>
</p>
<p>
The ID of the blocking lock. To obtain details about the
lock, join this column with the
<code class="literal">
ENGINE_LOCK_ID
</code>
column of the
<a class="link" href="performance-schema-data-locks-table.html" title="29.12.13.1 The data_locks Table">
<code class="literal">
data_locks
</code>
</a>
table.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
BLOCKING_ENGINE_TRANSACTION_ID
</code>
</p>
<p>
The storage engine internal ID of the transaction that
holds the blocking lock.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
BLOCKING_THREAD_ID
</code>
</p>
<p>
The thread ID of the session that holds the blocking lock.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
BLOCKING_EVENT_ID
</code>
</p>
<p>
The Performance Schema event that caused the blocking lock
in the session that holds it.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
BLOCKING_OBJECT_INSTANCE_BEGIN
</code>
</p>
<p>
The address in memory of the blocking lock.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-data-lock-waits-table.html" title="29.12.13.2 The data_lock_waits Table">
<code class="literal">
data_lock_waits
</code>
</a>
table has
these indexes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Index on (
<code class="literal">
REQUESTING_ENGINE_LOCK_ID
</code>
,
<code class="literal">
ENGINE
</code>
)
</p>
</li>
<li class="listitem">
<p>
Index on (
<code class="literal">
BLOCKING_ENGINE_LOCK_ID
</code>
,
<code class="literal">
ENGINE
</code>
)
</p>
</li>
<li class="listitem">
<p>
Index on
(
<code class="literal">
REQUESTING_ENGINE_TRANSACTION_ID
</code>
,
<code class="literal">
ENGINE
</code>
)
</p>
</li>
<li class="listitem">
<p>
Index on
(
<code class="literal">
BLOCKING_ENGINE_TRANSACTION_ID
</code>
,
<code class="literal">
ENGINE
</code>
)
</p>
</li>
<li class="listitem">
<p>
Index on (
<code class="literal">
REQUESTING_THREAD_ID
</code>
,
<code class="literal">
REQUESTING_EVENT_ID
</code>
)
</p>
</li>
<li class="listitem">
<p>
Index on (
<code class="literal">
BLOCKING_THREAD_ID
</code>
,
<code class="literal">
BLOCKING_EVENT_ID
</code>
)
</p>
</li>
</ul>
</div>
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
is not permitted
for the
<a class="link" href="performance-schema-data-lock-waits-table.html" title="29.12.13.2 The data_lock_waits Table">
<code class="literal">
data_lock_waits
</code>
</a>
table.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/geometry-well-formedness-validity.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="geometry-well-formedness-validity">
</a>
13.4.4 Geometry Well-Formedness and Validity
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045211682272">
</a>
<a class="indexterm" name="idm46045211680768">
</a>
<a class="indexterm" name="idm46045211679264">
</a>
<a class="indexterm" name="idm46045211677776">
</a>
<a class="indexterm" name="idm46045211676288">
</a>
<a class="indexterm" name="idm46045211674800">
</a>
<a class="indexterm" name="idm46045211673312">
</a>
<a class="indexterm" name="idm46045211671824">
</a>
<a class="indexterm" name="idm46045211670336">
</a>
<a class="indexterm" name="idm46045211668832">
</a>
<p>
For geometry values, MySQL distinguishes between the concepts of
syntactically well-formed and geometrically valid.
</p>
<p>
A geometry is syntactically well-formed if it satisfies
conditions such as those in this (nonexhaustive) list:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Linestrings have at least two points
</p>
</li>
<li class="listitem">
<p>
Polygons have at least one ring
</p>
</li>
<li class="listitem">
<p>
Polygon rings are closed (first and last points the same)
</p>
</li>
<li class="listitem">
<p>
Polygon rings have at least 4 points (minimum polygon is a
triangle with first and last points the same)
</p>
</li>
<li class="listitem">
<p>
Collections are not empty (except
<code class="literal">
GeometryCollection
</code>
)
</p>
</li>
</ul>
</div>
<p>
A geometry is geometrically valid if it is syntactically
well-formed and satisfies conditions such as those in this
(nonexhaustive) list:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Polygons are not self-intersecting
</p>
</li>
<li class="listitem">
<p>
Polygon interior rings are inside the exterior ring
</p>
</li>
<li class="listitem">
<p>
Multipolygons do not have overlapping polygons
</p>
</li>
</ul>
</div>
<p>
Spatial functions fail if a geometry is not syntactically
well-formed. Spatial import functions that parse WKT or WKB
values raise an error for attempts to create a geometry that is
not syntactically well-formed. Syntactic well-formedness is also
checked for attempts to store geometries into tables.
</p>
<p>
It is permitted to insert, select, and update geometrically
invalid geometries, but they must be syntactically well-formed.
Due to the computational expense, MySQL does not check
explicitly for geometric validity. Spatial computations may
detect some cases of invalid geometries and raise an error, but
they may also return an undefined result without detecting the
invalidity. Applications that require geometrically-valid
geometries should check them using the
<a class="link" href="spatial-convenience-functions.html#function_st-isvalid">
<code class="literal">
ST_IsValid()
</code>
</a>
function.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/conditions-and-parameters.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="conditions-and-parameters">
</a>
15.6.7.8 Condition Handling and OUT or INOUT Parameters
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045175226224">
</a>
<a class="indexterm" name="idm46045175224736">
</a>
<a class="indexterm" name="idm46045175223248">
</a>
<a class="indexterm" name="idm46045175221760">
</a>
<p>
If a stored procedure exits with an unhandled exception,
modified values of
<code class="literal">
OUT
</code>
and
<code class="literal">
INOUT
</code>
parameters are not propagated back to
the caller.
</p>
<p>
If an exception is handled by a
<code class="literal">
CONTINUE
</code>
or
<code class="literal">
EXIT
</code>
handler that contains a
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
statement, execution of
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
pops the Diagnostics
Area stack, thus signalling the exception (that is, the
information that existed before entry into the handler). If the
exception is an error, the values of
<code class="literal">
OUT
</code>
and
<code class="literal">
INOUT
</code>
parameters are not propagated back to
the caller.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/ipv6-brokers.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="ipv6-brokers">
</a>
7.1.13.5 Obtaining an IPv6 Address from a Broker
</h4>
</div>
</div>
</div>
<p>
If you do not have a public IPv6 address that enables your
system to communicate over IPv6 outside your local network, you
can obtain one from an IPv6 broker. The
<a class="ulink" href="http://en.wikipedia.org/wiki/List_of_IPv6_tunnel_brokers" target="_blank">
Wikipedia
IPv6 Tunnel Broker page
</a>
lists several brokers and their
features, such as whether they provide static addresses and the
supported routing protocols.
</p>
<p>
After configuring your server host to use a broker-supplied IPv6
address, start the MySQL server with an appropriate
<a class="link" href="server-system-variables.html#sysvar_bind_address">
<code class="literal">
bind_address
</code>
</a>
setting to permit
the server to accept IPv6 connections. You can specify * (or
<code class="literal">
::
</code>
) as the
<a class="link" href="server-system-variables.html#sysvar_bind_address">
<code class="literal">
bind_address
</code>
</a>
value, or bind the
server to the specific IPv6 address provided by the broker. For
more information, see the
<a class="link" href="server-system-variables.html#sysvar_bind_address">
<code class="literal">
bind_address
</code>
</a>
description in
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
.
</p>
<p>
Note that if the broker allocates dynamic addresses, the address
provided for your system might change the next time you connect
to the broker. If so, any accounts you create that name the
original address become invalid. To bind to a specific address
but avoid this change-of-address problem, you might be able to
arrange with the broker for a static IPv6 address.
</p>
<p>
The following example shows how to use Freenet6 as the broker
and the
<span class="command">
<strong>
gogoc
</strong>
</span>
IPv6 client package on Gentoo
Linux.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Create an account at Freenet6 by visiting this URL and
signing up:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa23507324"><div class="copy-help left">Press ⌘+C to 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">http<span class="token operator">:</span><span class="token operator">/</span><span class="token operator">/</span>gogonet<span class="token punctuation">.</span>gogo6<span class="token punctuation">.</span>com</code></pre>
</div>
</li>
<li class="listitem">
<p>
After creating the account, go to this URL, sign in, and
create a user ID and password for the IPv6 broker:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa82500841"><div class="copy-help left">Press ⌘+C to 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">http<span class="token operator">:</span><span class="token operator">/</span><span class="token operator">/</span>gogonet<span class="token punctuation">.</span>gogo6<span class="token punctuation">.</span>com<span class="token operator">/</span>page<span class="token operator">/</span>freenet6<span class="token operator">-</span>registration</code></pre>
</div>
<p>
</p>
</li>
<li class="listitem">
<p>
As
<code class="literal">
root
</code>
, install
<span class="command">
<strong>
gogoc
</strong>
</span>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa33734784"><div class="copy-help left">Press ⌘+C to 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">emerge</span> gogoc</code></pre>
</div>
</li>
<li class="listitem">
<p>
Edit
<code class="filename">
/etc/gogoc/gogoc.conf
</code>
to set the
<code class="literal">
userid
</code>
and
<code class="literal">
password
</code>
values. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa90888482"><div class="copy-help left">Press ⌘+C to 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">userid</span><span class="token attr-value"><span class="token punctuation">=</span>gogouser</span>
<span class="token constant">passwd</span><span class="token attr-value"><span class="token punctuation">=</span>gogopass</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Start
<span class="command">
<strong>
gogoc
</strong>
</span>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa78841657"><div class="copy-help left">Press ⌘+C to 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">/etc/init.d/gogoc</span> start</code></pre>
</div>
<p>
To start
<span class="command">
<strong>
gogoc
</strong>
</span>
each time your system
boots, execute this command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa8858076"><div class="copy-help left">Press ⌘+C to 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">rc-update</span> add gogoc default</code></pre>
</div>
</li>
<li class="listitem">
<p>
Use
<span class="command">
<strong>
ping6
</strong>
</span>
to try to ping a host:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa54538433"><div class="copy-help left">Press ⌘+C to 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">ping6</span> ipv6<span class="token punctuation">.</span>google<span class="token punctuation">.</span>com</code></pre>
</div>
</li>
<li class="listitem">
<p>
To see your IPv6 address:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa28275214"><div class="copy-help left">Press ⌘+C to 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">ifconfig</span> tun</code></pre>
</div>
</li>
</ol>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/constraints.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="constraints">
</a>
1.7.3 How MySQL Deals with Constraints
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="constraint-primary-key.html">
1.7.3.1 PRIMARY KEY and UNIQUE Index Constraints
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="constraint-foreign-key.html">
1.7.3.2 FOREIGN KEY Constraints
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="constraint-enum.html">
1.7.3.3 ENUM and SET Constraints
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045333156480">
</a>
<p>
MySQL enables you to work both with transactional tables that
permit rollback and with nontransactional tables that do not.
Because of this, constraint handling is a bit different in MySQL
than in other DBMSs. We must handle the case when you have
inserted or updated a lot of rows in a nontransactional table
for which changes cannot be rolled back when an error occurs.
</p>
<p>
The basic philosophy is that MySQL Server tries to produce an
error for anything that it can detect while parsing a statement
to be executed, and tries to recover from any errors that occur
while executing the statement. We do this in most cases, but not
yet for all.
</p>
<p>
The options MySQL has when an error occurs are to stop the
statement in the middle or to recover as well as possible from
the problem and continue. By default, the server follows the
latter course. This means, for example, that the server may
coerce invalid values to the closest valid values.
</p>
<p>
Several SQL mode options are available to provide greater
control over handling of bad data values and whether to continue
statement execution or abort when errors occur. Using these
options, you can configure MySQL Server to act in a more
traditional fashion that is like other DBMSs that reject
improper input. The SQL mode can be set globally at server
startup to affect all clients. Individual clients can set the
SQL mode at runtime, which enables each client to select the
behavior most appropriate for its requirements. See
<a class="xref" href="sql-mode.html" title="7.1.11 Server SQL Modes">
Section 7.1.11, “Server SQL Modes”
</a>
.
</p>
<p>
The following sections describe how MySQL Server handles
different types of constraints.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/show-binlog-events.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="show-binlog-events">
</a>
15.7.7.3 SHOW BINLOG EVENTS Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045171182224">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa49966678"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">BINLOG</span> <span class="token keyword">EVENTS</span>
<span class="token punctuation">[</span><span class="token keyword">IN</span> <span class="token string">'<em class="replaceable">log_name</em>'</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">FROM</span> <em class="replaceable">pos</em><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">LIMIT</span> <span class="token punctuation">[</span><span class="token keyword"><em class="replaceable">offset</em></span><span class="token punctuation">,</span><span class="token punctuation">]</span> <span class="token keyword"><em class="replaceable">row_count</em></span><span class="token punctuation">]</span></code></pre>
</div>
<p>
Shows the events in the binary log. If you do not specify
<code class="literal">
'
<em class="replaceable">
<code>
log_name
</code>
</em>
'
</code>
, the
first binary log is displayed.
<code class="literal">
SHOW BINLOG
EVENTS
</code>
requires the
<a class="link" href="privileges-provided.html#priv_replication-slave">
<code class="literal">
REPLICATION
SLAVE
</code>
</a>
privilege.
</p>
<p>
The
<code class="literal">
LIMIT
</code>
clause has the same syntax as for
the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement. See
<a class="xref" href="select.html" title="15.2.13 SELECT Statement">
Section 15.2.13, “SELECT Statement”
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Issuing a
<a class="link" href="show-binlog-events.html" title="15.7.7.3 SHOW BINLOG EVENTS Statement">
<code class="literal">
SHOW BINLOG EVENTS
</code>
</a>
with no
<code class="literal">
LIMIT
</code>
clause could start a very
time- and resource-consuming process because the server
returns to the client the complete contents of the binary log
(which includes all statements executed by the server that
modify data). As an alternative to
<a class="link" href="show-binlog-events.html" title="15.7.7.3 SHOW BINLOG EVENTS Statement">
<code class="literal">
SHOW
BINLOG EVENTS
</code>
</a>
, use the
<a class="link" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
<span class="command">
<strong>
mysqlbinlog
</strong>
</span>
</a>
utility to save the binary log
to a text file for later examination and analysis. See
<a class="xref" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
Section 6.6.9, “mysqlbinlog — Utility for Processing Binary Log Files”
</a>
.
</p>
</div>
<p>
<a class="link" href="show-binlog-events.html" title="15.7.7.3 SHOW BINLOG EVENTS Statement">
<code class="literal">
SHOW BINLOG EVENTS
</code>
</a>
displays the
following fields for each event in the binary log:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
Log_name
</code>
</p>
<p>
The name of the file that is being listed.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Pos
</code>
</p>
<p>
The position at which the event occurs.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Event_type
</code>
</p>
<p>
An identifier that describes the event type.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Server_id
</code>
</p>
<p>
The server ID of the server on which the event originated.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
End_log_pos
</code>
</p>
<p>
The position at which the next event begins, which is equal
to
<code class="literal">
Pos
</code>
plus the size of the event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Info
</code>
</p>
<p>
More detailed information about the event type. The format
of this information depends on the event type.
</p>
</li>
</ul>
</div>
<p>
For compressed transaction payloads, the
<code class="literal">
Transaction_payload_event
</code>
is first printed as
a single unit, then it is unpacked and each event inside it is
printed.
</p>
<p>
Some events relating to the setting of user and system variables
are not included in the output from
<a class="link" href="show-binlog-events.html" title="15.7.7.3 SHOW BINLOG EVENTS Statement">
<code class="literal">
SHOW
BINLOG EVENTS
</code>
</a>
. To get complete coverage of events
within a binary log, use
<a class="link" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
<span class="command">
<strong>
mysqlbinlog
</strong>
</span>
</a>
.
</p>
<p>
<a class="link" href="show-binlog-events.html" title="15.7.7.3 SHOW BINLOG EVENTS Statement">
<code class="literal">
SHOW BINLOG EVENTS
</code>
</a>
does
<span class="emphasis">
<em>
not
</em>
</span>
work with relay log files. You can use
<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>
for this
purpose.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/clone-plugin-encrypted-data.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="clone-plugin-encrypted-data">
</a>
7.6.7.5 Cloning Encrypted Data
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045255424080">
</a>
<p>
Cloning of encrypted data is supported. The following
requirements apply:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A secure connection is required when cloning remote data to
ensure safe transfer of unencrypted tablespace keys over the
network. Tablespace keys are decrypted at the donor before
transport and re-encrypted at the recipient using the
recipient master key. An error is reported if an encrypted
connection is not available or the
<code class="literal">
REQUIRE NO
SSL
</code>
clause is used in the
<a class="link" href="clone.html" title="15.7.5 CLONE Statement">
<code class="literal">
CLONE
INSTANCE
</code>
</a>
statement. For information about
configuring an encrypted connection for cloning, see
<a class="xref" href="clone-plugin-remote.html#clone-plugin-remote-ssl" title="Configuring an Encrypted Connection for Cloning">
Configuring an Encrypted Connection for Cloning
</a>
.
</p>
</li>
<li class="listitem">
<p>
When cloning data to a local data directory that uses a
locally managed keyring, the same keyring must be used when
starting the MySQL server on the clone directory.
</p>
</li>
<li class="listitem">
<p>
When cloning data to a remote data directory (the recipient
directory) that uses a locally managed keyring, the
recipient keyring must be used when starting the MySQL sever
on the cloned directory.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_redo_log_encrypt">
<code class="literal">
innodb_redo_log_encrypt
</code>
</a>
and
<a class="link" href="innodb-parameters.html#sysvar_innodb_undo_log_encrypt">
<code class="literal">
innodb_undo_log_encrypt
</code>
</a>
variable settings cannot be modified while a cloning operation
is in progress.
</p>
</div>
<p>
For information about the data encryption feature, 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>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/stored-programs-defining.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="stored-programs-defining">
</a>
27.1 Defining Stored Programs
</h2>
</div>
</div>
</div>
<p>
Each stored program contains a body that consists of an SQL
statement. This statement may be a compound statement made up of
several statements separated by semicolon (
<code class="literal">
;
</code>
)
characters. For example, the following stored procedure has a body
made up of a
<a class="link" href="begin-end.html" title="15.6.1 BEGIN ... END Compound Statement">
<code class="literal">
BEGIN ...
END
</code>
</a>
block that contains a
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
statement and a
<a class="link" href="repeat.html" title="15.6.5.6 REPEAT Statement">
<code class="literal">
REPEAT
</code>
</a>
loop that
itself contains another
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa66409300"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">PROCEDURE</span> dorepeat<span class="token punctuation">(</span>p1 <span class="token datatype">INT</span><span class="token punctuation">)</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">SET</span> <span class="token variable">@x</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token keyword">REPEAT</span> <span class="token keyword">SET</span> <span class="token variable">@x</span> <span class="token operator">=</span> <span class="token variable">@x</span> <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">;</span> <span class="token keyword">UNTIL</span> <span class="token variable">@x</span> <span class="token operator">></span> p1 <span class="token keyword">END</span> <span class="token keyword">REPEAT</span><span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If you use the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client program to define a
stored program containing semicolon characters, a problem arises.
By default,
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
itself recognizes the
semicolon as a statement delimiter, so you must redefine the
delimiter temporarily to cause
<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 pass
the entire stored program definition to the server.
</p>
<p>
To redefine 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>
delimiter, use the
<code class="literal">
delimiter
</code>
command. The following example shows
how to do this for the
<code class="literal">
dorepeat()
</code>
procedure
just shown. The delimiter is changed to
<code class="literal">
//
</code>
to
enable the entire definition to be passed to the server as a
single statement, and then restored to
<code class="literal">
;
</code>
before
invoking the procedure. This enables the
<code class="literal">
;
</code>
delimiter used in the procedure body to be passed through to the
server rather than being interpreted by
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
itself.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa35841050"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">delimiter</span> <span class="token comment" spellcheck="true">//</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">PROCEDURE</span> dorepeat<span class="token punctuation">(</span>p1 <span class="token datatype">INT</span><span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token keyword">BEGIN</span>
<span class="token prompt"> -></span> <span class="token keyword">SET</span> <span class="token variable">@x</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token keyword">REPEAT</span> <span class="token keyword">SET</span> <span class="token variable">@x</span> <span class="token operator">=</span> <span class="token variable">@x</span> <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">;</span> <span class="token keyword">UNTIL</span> <span class="token variable">@x</span> <span class="token operator">></span> p1 <span class="token keyword">END</span> <span class="token keyword">REPEAT</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token keyword">END</span>
<span class="token prompt"> -></span> <span class="token comment" spellcheck="true">//</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">delimiter</span> <span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">CALL</span> dorepeat<span class="token punctuation">(</span><span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@x</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @x <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1001 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
You can redefine the delimiter to a string other than
<code class="literal">
//
</code>
, and the delimiter can consist of a single
character or multiple characters. You should avoid the use of the
backslash (
<code class="literal">
\
</code>
) character because that is the
escape character for MySQL.
</p>
<p>
The following is an example of a function that takes a parameter,
performs an operation using an SQL function, and returns the
result. In this case, it is unnecessary to use
<code class="literal">
delimiter
</code>
because the function definition
contains no internal
<code class="literal">
;
</code>
statement delimiters:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa30022022"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> hello <span class="token punctuation">(</span>s <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token prompt">mysql></span> <span class="token keyword">RETURNS</span> <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">50</span><span class="token punctuation">)</span> <span class="token keyword">DETERMINISTIC</span>
<span class="token prompt"> -></span> <span class="token keyword">RETURN</span> <span class="token function">CONCAT</span><span class="token punctuation">(</span><span class="token string">'Hello, '</span><span class="token punctuation">,</span>s<span class="token punctuation">,</span><span class="token string">'!'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> hello<span class="token punctuation">(</span><span class="token string">'world'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> hello('world') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Hello, world! <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-shell-tutorial-python.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="mysql-shell-tutorial-python">
</a>
22.4 Python Quick-Start Guide: MySQL Shell for Document Store
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<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>
</div>
<a class="indexterm" name="idm46045127420880">
</a>
<p>
This quick-start guide provides instructions to begin prototyping
document store applications interactively with MySQL Shell. The
guide includes the following topics:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Introduction to MySQL functionality, MySQL Shell, and the
<code class="literal">
world_x
</code>
example schema.
</p>
</li>
<li class="listitem">
<p>
Operations to manage collections and documents.
</p>
</li>
<li class="listitem">
<p>
Operations to manage relational tables.
</p>
</li>
<li class="listitem">
<p>
Operations that apply to documents within tables.
</p>
</li>
</ul>
</div>
<p>
To follow this quick-start guide you need a MySQL server with
X Plugin installed, the default in 8.4, and
MySQL Shell to use as the client. MySQL Shell includes X DevAPI,
implemented in both JavaScript and Python, which enables you to
connect to the MySQL server instance using X Protocol and use the
server as a Document Store.
</p>
<h3>
<a name="idm46045127414048">
</a>
Related Information
</h3>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="ulink" href="/doc/mysql-shell/8.4/en/" target="_top">
MySQL Shell 8.4
</a>
provides more in-depth information
about MySQL Shell.
</p>
</li>
<li class="listitem">
<p>
See
<a class="ulink" href="/doc/mysql-shell/8.4/en/mysql-shell-install.html" target="_top">
Installing MySQL Shell
</a>
and
<a class="xref" href="x-plugin.html" title="22.5 X Plugin">
Section 22.5, “X Plugin”
</a>
for more information about the tools
used in this quick-start guide.
</p>
</li>
<li class="listitem">
<p>
See
<a class="ulink" href="/doc/mysql-shell/8.4/en/mysql-shell-features.html#shell-supported-languages" target="_top">
Supported Languages
</a>
for more
information about the languages MySQL Shell supports.
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="/doc/x-devapi-userguide/en/" target="_top">
X DevAPI User Guide
</a>
provides more examples of
using X DevAPI to develop applications which use MySQL as a
Document Store.
</p>
</li>
<li class="listitem">
<p>
A
<a class="link" href="mysql-shell-tutorial-javascript.html" title="22.3 JavaScript Quick-Start Guide: MySQL Shell for Document Store">
JavaScript
</a>
quick-start guide is also available.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication.html | <div id="docs-body">
<div class="chapter">
<div class="titlepage">
<div>
<div>
<h1 class="title">
<a name="group-replication">
</a>
Chapter 20 Group Replication
</h1>
</div>
</div>
</div>
<div class="toc">
<p>
<b>
Table of Contents
</b>
</p>
<dl class="toc">
<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>
</div>
<a class="indexterm" name="idm46045134619568">
</a>
<a class="indexterm" name="idm46045134618496">
</a>
<p>
This chapter explains Group Replication in MySQL 8.4,
and how to install, configure and monitor groups. MySQL Group
Replication enables you to create elastic, highly-available,
fault-tolerant replication topologies.
</p>
<p>
Groups can operate in a single-primary mode with automatic primary
election, where only one server accepts updates at a time.
Alternatively, groups can be deployed in multi-primary mode, where
all servers can accept updates, even if they are issued
concurrently.
</p>
<p>
There is a built-in group membership service that keeps the view of
the group consistent and available for all servers at any given
point in time. Servers can leave and join the group and the view is
updated accordingly. Sometimes servers can leave the group
unexpectedly, in which case the failure detection mechanism detects
this and notifies the group that the view has changed. This is all
automatic.
</p>
<p>
Group Replication guarantees that the database service is
continuously available. However, it is important to understand that
if one of the group members becomes unavailable, the clients
connected to that group member must be redirected, or failed over,
to a different server in the group, using a connector, load
balancer, router, or some form of middleware. Group Replication does
not have an inbuilt method to do this. For example, see
<a class="ulink" href="/doc/mysql-router/8.4/en/" target="_top">
MySQL Router 8.4
</a>
.
</p>
<p>
Group Replication is provided as a plugin to MySQL Server. You can
follow the instructions in this chapter to configure the plugin on
each of the server instances that you want in the group, start up
the group, and monitor and administer the group. An alternative way
to deploy a group of MySQL server instances is by using
InnoDB Cluster.
</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>
<p>
The chapter is structured as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="group-replication-background.html" title="20.1 Group Replication Background">
Section 20.1, “Group Replication Background”
</a>
provides an
introduction to groups and how Group Replication works.
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="group-replication-getting-started.html" title="20.2 Getting Started">
Section 20.2, “Getting Started”
</a>
explains how
to configure multiple MySQL Server instances to create a group.
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="group-replication-requirements-and-limitations.html" title="20.3 Requirements and Limitations">
Section 20.3, “Requirements and Limitations”
</a>
explains architecture and setup requirements and limitations for
Group Replication.
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="group-replication-monitoring.html" title="20.4 Monitoring Group Replication">
Section 20.4, “Monitoring Group Replication”
</a>
explains how to
monitor a group.
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="group-replication-operations.html" title="20.5 Group Replication Operations">
Section 20.5, “Group Replication Operations”
</a>
explains how to
work with a group.
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="group-replication-security.html" title="20.6 Group Replication Security">
Section 20.6, “Group Replication Security”
</a>
explains how to
secure a group.
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="group-replication-performance.html" title="20.7 Group Replication Performance and Troubleshooting">
Section 20.7, “Group Replication Performance and Troubleshooting”
</a>
explains how to
fine tune performance for a group.
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="group-replication-upgrade.html" title="20.8 Upgrading Group Replication">
Section 20.8, “Upgrading Group Replication”
</a>
explains how to
upgrade a group.
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="group-replication-options.html" title="20.9 Group Replication Variables">
Section 20.9, “Group Replication Variables”
</a>
is a reference for
the system variables specific to Group Replication.
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="group-replication-frequently-asked-questions.html" title="20.10 Frequently Asked Questions">
Section 20.10, “Frequently Asked Questions”
</a>
provides answers to some technical questions about deploying and
operating Group Replication.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-performance-xcom-cache.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="group-replication-performance-xcom-cache">
</a>
20.7.6 XCom Cache Management
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="group-replication-performance-xcom-cache-increase.html">
20.7.6.1 Increasing the cache size
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-performance-xcom-cache-reduce.html">
20.7.6.2 Reducing the cache size
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045132104672">
</a>
<p>
The group communication engine for Group Replication (XCom, a
Paxos variant) includes a cache for messages (and their metadata)
exchanged between the group members as a part of the consensus
protocol. Among other functions, the message cache is used for
recovery of missed messages by members that reconnect with the
group after a period where they were unable to communicate with
the other group members.
</p>
<p>
A cache size limit can be set for XCom's message cache using the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_message_cache_size">
<code class="literal">
group_replication_message_cache_size
</code>
</a>
system variable. If the cache size limit is reached, XCom removes
the oldest entries that have been decided and delivered. The same
cache size limit should be set on all group members, because an
unreachable member that is attempting to reconnect selects any
other member at random for recovery of missed messages. The same
messages should therefore be available in each member's cache.
</p>
<p>
Ensure that sufficient memory is available on your system for your
chosen cache size limit, considering the size of MySQL Server's
other caches and object pools. Note that the limit set using
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_message_cache_size">
<code class="literal">
group_replication_message_cache_size
</code>
</a>
applies only to the data stored in the cache, and the cache
structures require an additional 50 MB of memory.
</p>
<p>
When choosing the value for
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_message_cache_size">
<code class="literal">
group_replication_message_cache_size
</code>
</a>
,
do so with regard to the expected volume of messages in the period
before a member is expelled. The length of this period is
controlled by the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_member_expel_timeout">
<code class="literal">
group_replication_member_expel_timeout
</code>
</a>
system variable, which determines the waiting period (up to an
hour) that is allowed
<span class="emphasis">
<em>
in addition to
</em>
</span>
the
initial 5-second detection period for members to return to the
group rather than being expelled. The timeout defaults to 5
seconds, so by default a member is not expelled until it has been
absent for at least 10 seconds.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/xa-statements.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="xa-statements">
</a>
15.3.8.1 XA Transaction SQL Statements
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045178110320">
</a>
<a class="indexterm" name="idm46045178109280">
</a>
<a class="indexterm" name="idm46045178107792">
</a>
<a class="indexterm" name="idm46045178106720">
</a>
<a class="indexterm" name="idm46045178105232">
</a>
<a class="indexterm" name="idm46045178104160">
</a>
<a class="indexterm" name="idm46045178102672">
</a>
<a class="indexterm" name="idm46045178101600">
</a>
<a class="indexterm" name="idm46045178100112">
</a>
<a class="indexterm" name="idm46045178099040">
</a>
<a class="indexterm" name="idm46045178097552">
</a>
<a class="indexterm" name="idm46045178096480">
</a>
<a class="indexterm" name="idm46045178094992">
</a>
<a class="indexterm" name="idm46045178093520">
</a>
<p>
To perform XA transactions in MySQL, use the following
statements:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa88661301"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">XA</span> {<span class="token keyword">START</span><span class="token operator">|</span><span class="token keyword">BEGIN</span>} <span class="token keyword"><em class="replaceable">xid</em></span> <span class="token punctuation">[</span><span class="token keyword">JOIN</span><span class="token operator">|</span><span class="token keyword">RESUME</span><span class="token punctuation">]</span>
<span class="token keyword">XA</span> <span class="token keyword">END</span> <span class="token keyword"><em class="replaceable">xid</em></span> <span class="token punctuation">[</span><span class="token keyword">SUSPEND</span> <span class="token punctuation">[</span><span class="token keyword">FOR</span> <span class="token keyword">MIGRATE</span><span class="token punctuation">]</span><span class="token punctuation">]</span>
<span class="token keyword">XA</span> <span class="token keyword">PREPARE</span> <span class="token keyword"><em class="replaceable">xid</em></span>
<span class="token keyword">XA</span> <span class="token keyword">COMMIT</span> <span class="token keyword"><em class="replaceable">xid</em></span> <span class="token punctuation">[</span><span class="token keyword">ONE</span> <span class="token keyword">PHASE</span><span class="token punctuation">]</span>
<span class="token keyword">XA</span> <span class="token keyword">ROLLBACK</span> <span class="token keyword"><em class="replaceable">xid</em></span>
<span class="token keyword">XA</span> <span class="token keyword">RECOVER</span> <span class="token punctuation">[</span>CONVERT <span class="token keyword">XID</span><span class="token punctuation">]</span></code></pre>
</div>
<p>
For
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA
START
</code>
</a>
, the
<code class="literal">
JOIN
</code>
and
<code class="literal">
RESUME
</code>
clauses are recognized but have no
effect.
</p>
<p>
For
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA
END
</code>
</a>
the
<code class="literal">
SUSPEND [FOR MIGRATE]
</code>
clause is recognized but has no effect.
</p>
<p>
Each XA statement begins with the
<code class="literal">
XA
</code>
keyword,
and most of them require an
<em class="replaceable">
<code>
xid
</code>
</em>
value. An
<em class="replaceable">
<code>
xid
</code>
</em>
is an XA transaction
identifier. It indicates which transaction the statement applies
to.
<em class="replaceable">
<code>
xid
</code>
</em>
values are supplied by the
client, or generated by the MySQL server. An
<em class="replaceable">
<code>
xid
</code>
</em>
value has from one to three
parts:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa73051315"><div class="copy-help left">Press ⌘+C to 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"><em class="replaceable">xid</em>: <em class="replaceable">gtrid</em> [, <em class="replaceable">bqual</em> [, <em class="replaceable">formatID</em> ]]</code></pre>
</div>
<p>
<em class="replaceable">
<code>
gtrid
</code>
</em>
is a global transaction
identifier,
<em class="replaceable">
<code>
bqual
</code>
</em>
is a branch
qualifier, and
<em class="replaceable">
<code>
formatID
</code>
</em>
is a number
that identifies the format used by the
<em class="replaceable">
<code>
gtrid
</code>
</em>
and
<em class="replaceable">
<code>
bqual
</code>
</em>
values. As indicated by the
syntax,
<em class="replaceable">
<code>
bqual
</code>
</em>
and
<em class="replaceable">
<code>
formatID
</code>
</em>
are optional. The default
<em class="replaceable">
<code>
bqual
</code>
</em>
value is
<code class="literal">
''
</code>
if not given. The default
<em class="replaceable">
<code>
formatID
</code>
</em>
value is 1 if not given.
</p>
<p>
<em class="replaceable">
<code>
gtrid
</code>
</em>
and
<em class="replaceable">
<code>
bqual
</code>
</em>
must be string literals, each
up to 64 bytes (not characters) long.
<em class="replaceable">
<code>
gtrid
</code>
</em>
and
<em class="replaceable">
<code>
bqual
</code>
</em>
can be specified in several
ways. You can use a quoted string (
<code class="literal">
'ab'
</code>
), hex
string (
<code class="literal">
X'6162'
</code>
,
<code class="literal">
0x6162
</code>
),
or bit value
(
<code class="literal">
b'
<em class="replaceable">
<code>
nnnn
</code>
</em>
'
</code>
).
</p>
<p>
<em class="replaceable">
<code>
formatID
</code>
</em>
is an unsigned integer.
</p>
<p>
The
<em class="replaceable">
<code>
gtrid
</code>
</em>
and
<em class="replaceable">
<code>
bqual
</code>
</em>
values are interpreted in bytes
by the MySQL server's underlying XA support routines. However,
while an SQL statement containing an XA statement is being
parsed, the server works with some specific character set. To be
safe, write
<em class="replaceable">
<code>
gtrid
</code>
</em>
and
<em class="replaceable">
<code>
bqual
</code>
</em>
as hex strings.
</p>
<p>
<em class="replaceable">
<code>
xid
</code>
</em>
values typically are generated by
the Transaction Manager. Values generated by one TM must be
different from values generated by other TMs. A given TM must be
able to recognize its own
<em class="replaceable">
<code>
xid
</code>
</em>
values
in a list of values returned by the
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA
RECOVER
</code>
</a>
statement.
</p>
<p>
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA START
<em class="replaceable">
<code>
xid
</code>
</em>
</code>
</a>
starts an XA
transaction with the given
<em class="replaceable">
<code>
xid
</code>
</em>
value.
Each XA transaction must have a unique
<em class="replaceable">
<code>
xid
</code>
</em>
value, so the value must not
currently be used by another XA transaction. Uniqueness is
assessed using the
<em class="replaceable">
<code>
gtrid
</code>
</em>
and
<em class="replaceable">
<code>
bqual
</code>
</em>
values. All following XA
statements for the XA transaction must be specified using the
same
<em class="replaceable">
<code>
xid
</code>
</em>
value as that given in the
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA
START
</code>
</a>
statement. If you use any of those statements
but specify an
<em class="replaceable">
<code>
xid
</code>
</em>
value that does
not correspond to some existing XA transaction, an error occurs.
</p>
<p>
<code class="literal">
XA START
</code>
,
<code class="literal">
XA BEGIN
</code>
,
<code class="literal">
XA END
</code>
,
<code class="literal">
XA COMMIT
</code>
, and
<code class="literal">
XA ROLLBACK
</code>
statements are not filtered by
the default database when the server is running with
<a class="link" href="replication-options-replica.html#option_mysqld_replicate-do-db">
<code class="option">
--replicate-do-db
</code>
</a>
or
<a class="link" href="replication-options-replica.html#option_mysqld_replicate-ignore-db">
<code class="option">
--replicate-ignore-db
</code>
</a>
.
</p>
<p>
One or more XA transactions can be part of the same global
transaction. All XA transactions within a given global
transaction must use the same
<em class="replaceable">
<code>
gtrid
</code>
</em>
value in the
<em class="replaceable">
<code>
xid
</code>
</em>
value. For this
reason,
<em class="replaceable">
<code>
gtrid
</code>
</em>
values must be globally
unique so that there is no ambiguity about which global
transaction a given XA transaction is part of. The
<em class="replaceable">
<code>
bqual
</code>
</em>
part of the
<em class="replaceable">
<code>
xid
</code>
</em>
value must be different for each
XA transaction within a global transaction. (The requirement
that
<em class="replaceable">
<code>
bqual
</code>
</em>
values be different is a
limitation of the current MySQL XA implementation. It is not
part of the XA specification.)
</p>
<p>
The
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA
RECOVER
</code>
</a>
statement returns information for those XA
transactions on the MySQL server that are in the
<code class="literal">
PREPARED
</code>
state. (See
<a class="xref" href="xa-states.html" title="15.3.8.2 XA Transaction States">
Section 15.3.8.2, “XA Transaction States”
</a>
.) The output includes a row for each
such XA transaction on the server, regardless of which client
started it.
</p>
<p>
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA
RECOVER
</code>
</a>
requires the
<a class="link" href="privileges-provided.html#priv_xa-recover-admin">
<code class="literal">
XA_RECOVER_ADMIN
</code>
</a>
privilege. This
privilege requirement prevents users from discovering the XID
values for outstanding prepared XA transactions other than their
own. It does not affect normal commit or rollback of an XA
transaction because the user who started it knows its XID.
</p>
<p>
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA
RECOVER
</code>
</a>
output rows look like this (for an example
<em class="replaceable">
<code>
xid
</code>
</em>
value consisting of the parts
<code class="literal">
'abc'
</code>
,
<code class="literal">
'def'
</code>
, and
<code class="literal">
7
</code>
):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa72239386"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">XA</span> <span class="token keyword">RECOVER</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> formatID <span class="token punctuation">|</span> gtrid_length <span class="token punctuation">|</span> bqual_length <span class="token punctuation">|</span> data <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 7 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> abcdef <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 output columns have the following meanings:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
formatID
</code>
is the
<em class="replaceable">
<code>
formatID
</code>
</em>
part of the transaction
<em class="replaceable">
<code>
xid
</code>
</em>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
gtrid_length
</code>
is the length in bytes of
the
<em class="replaceable">
<code>
gtrid
</code>
</em>
part of the
<em class="replaceable">
<code>
xid
</code>
</em>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
bqual_length
</code>
is the length in bytes of
the
<em class="replaceable">
<code>
bqual
</code>
</em>
part of the
<em class="replaceable">
<code>
xid
</code>
</em>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
data
</code>
is the concatenation of the
<em class="replaceable">
<code>
gtrid
</code>
</em>
and
<em class="replaceable">
<code>
bqual
</code>
</em>
parts of the
<em class="replaceable">
<code>
xid
</code>
</em>
</p>
</li>
</ul>
</div>
<p>
XID values may contain nonprintable characters.
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA
RECOVER
</code>
</a>
permits an optional
<code class="literal">
CONVERT
XID
</code>
clause so that clients can request XID values in
hexadecimal.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-setup-objects-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-setup-objects-table">
</a>
29.12.2.4 The setup_objects Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045073749936">
</a>
<a class="indexterm" name="idm46045073748448">
</a>
<p>
The
<a class="link" href="performance-schema-setup-objects-table.html" title="29.12.2.4 The setup_objects Table">
<code class="literal">
setup_objects
</code>
</a>
table controls
whether the Performance Schema monitors particular objects.
This table has a maximum size of 100 rows by default. To
change the table size, modify the
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_setup_objects_size">
<code class="literal">
performance_schema_setup_objects_size
</code>
</a>
system variable at server startup.
</p>
<p>
The initial
<a class="link" href="performance-schema-setup-objects-table.html" title="29.12.2.4 The setup_objects Table">
<code class="literal">
setup_objects
</code>
</a>
contents look like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa94365108"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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_objects<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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> OBJECT_SCHEMA <span class="token punctuation">|</span> OBJECT_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>
<span class="token output"><span class="token punctuation">|</span> EVENT <span class="token punctuation">|</span> mysql <span class="token punctuation">|</span> % <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> EVENT <span class="token punctuation">|</span> performance_schema <span class="token punctuation">|</span> % <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> EVENT <span class="token punctuation">|</span> information_schema <span class="token punctuation">|</span> % <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> EVENT <span class="token punctuation">|</span> % <span class="token punctuation">|</span> % <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> FUNCTION <span class="token punctuation">|</span> mysql <span class="token punctuation">|</span> % <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> FUNCTION <span class="token punctuation">|</span> performance_schema <span class="token punctuation">|</span> % <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> FUNCTION <span class="token punctuation">|</span> information_schema <span class="token punctuation">|</span> % <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> FUNCTION <span class="token punctuation">|</span> % <span class="token punctuation">|</span> % <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> PROCEDURE <span class="token punctuation">|</span> mysql <span class="token punctuation">|</span> % <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> PROCEDURE <span class="token punctuation">|</span> performance_schema <span class="token punctuation">|</span> % <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> PROCEDURE <span class="token punctuation">|</span> information_schema <span class="token punctuation">|</span> % <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> PROCEDURE <span class="token punctuation">|</span> % <span class="token punctuation">|</span> % <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> TABLE <span class="token punctuation">|</span> mysql <span class="token punctuation">|</span> % <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> TABLE <span class="token punctuation">|</span> performance_schema <span class="token punctuation">|</span> % <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> TABLE <span class="token punctuation">|</span> information_schema <span class="token punctuation">|</span> % <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> TABLE <span class="token punctuation">|</span> % <span class="token punctuation">|</span> % <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> TRIGGER <span class="token punctuation">|</span> mysql <span class="token punctuation">|</span> % <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> TRIGGER <span class="token punctuation">|</span> performance_schema <span class="token punctuation">|</span> % <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> TRIGGER <span class="token punctuation">|</span> information_schema <span class="token punctuation">|</span> % <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> TRIGGER <span class="token punctuation">|</span> % <span class="token punctuation">|</span> % <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
Modifications to the
<a class="link" href="performance-schema-setup-objects-table.html" title="29.12.2.4 The setup_objects Table">
<code class="literal">
setup_objects
</code>
</a>
table affect object
monitoring immediately.
</p>
<p>
For object types listed in
<a class="link" href="performance-schema-setup-objects-table.html" title="29.12.2.4 The setup_objects Table">
<code class="literal">
setup_objects
</code>
</a>
, the Performance
Schema uses the table to how to monitor them. Object matching
is based on the
<code class="literal">
OBJECT_SCHEMA
</code>
and
<code class="literal">
OBJECT_NAME
</code>
columns. Objects for which
there is no match are not monitored.
</p>
<p>
The effect of the default object configuration is to
instrument all tables except those in the
<code class="literal">
mysql
</code>
,
<code class="literal">
INFORMATION_SCHEMA
</code>
, and
<code class="literal">
performance_schema
</code>
databases. (Tables in
the
<code class="literal">
INFORMATION_SCHEMA
</code>
database are not
instrumented regardless of the contents of
<a class="link" href="performance-schema-setup-objects-table.html" title="29.12.2.4 The setup_objects Table">
<code class="literal">
setup_objects
</code>
</a>
; the row for
<code class="literal">
information_schema.%
</code>
simply makes this
default explicit.)
</p>
<p>
When the Performance Schema checks for a match in
<a class="link" href="performance-schema-setup-objects-table.html" title="29.12.2.4 The setup_objects Table">
<code class="literal">
setup_objects
</code>
</a>
, it tries to find
more specific matches first. For example, with a table
<code class="literal">
db1.t1
</code>
, it looks for a match for
<code class="literal">
'db1'
</code>
and
<code class="literal">
't1'
</code>
, then for
<code class="literal">
'db1'
</code>
and
<code class="literal">
'%'
</code>
, then for
<code class="literal">
'%'
</code>
and
<code class="literal">
'%'
</code>
. The order
in which matching occurs matters because different matching
<a class="link" href="performance-schema-setup-objects-table.html" title="29.12.2.4 The setup_objects Table">
<code class="literal">
setup_objects
</code>
</a>
rows can have
different
<code class="literal">
ENABLED
</code>
and
<code class="literal">
TIMED
</code>
values.
</p>
<p>
Rows can be inserted into or deleted from
<a class="link" href="performance-schema-setup-objects-table.html" title="29.12.2.4 The setup_objects Table">
<code class="literal">
setup_objects
</code>
</a>
by users with the
<a class="link" href="privileges-provided.html#priv_insert">
<code class="literal">
INSERT
</code>
</a>
or
<a class="link" href="privileges-provided.html#priv_delete">
<code class="literal">
DELETE
</code>
</a>
privilege on the table.
For existing rows, only the
<code class="literal">
ENABLED
</code>
and
<code class="literal">
TIMED
</code>
columns can be modified, by users
with the
<a class="link" href="privileges-provided.html#priv_update">
<code class="literal">
UPDATE
</code>
</a>
privilege on
the table.
</p>
<p>
For more information about the role of the
<a class="link" href="performance-schema-setup-objects-table.html" title="29.12.2.4 The setup_objects Table">
<code class="literal">
setup_objects
</code>
</a>
table in event
filtering, see
<a class="xref" href="performance-schema-pre-filtering.html" title="29.4.3 Event Pre-Filtering">
Section 29.4.3, “Event Pre-Filtering”
</a>
.
</p>
<p>
The
<a class="link" href="performance-schema-setup-objects-table.html" title="29.12.2.4 The setup_objects Table">
<code class="literal">
setup_objects
</code>
</a>
table has these
columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
OBJECT_TYPE
</code>
</p>
<p>
The type of object to instrument. The value is one of
<code class="literal">
'EVENT'
</code>
(Event Scheduler event),
<code class="literal">
'FUNCTION'
</code>
(stored function),
<code class="literal">
'PROCEDURE'
</code>
(stored procedure),
<code class="literal">
'TABLE'
</code>
(base table), or
<code class="literal">
'TRIGGER'
</code>
(trigger).
</p>
<p>
<code class="literal">
TABLE
</code>
filtering affects table I/O
events (
<code class="literal">
wait/io/table/sql/handler
</code>
instrument) and table lock events
(
<code class="literal">
wait/lock/table/sql/handler
</code>
instrument).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
OBJECT_SCHEMA
</code>
</p>
<p>
The schema that contains the object. This should be a
literal name, or
<code class="literal">
'%'
</code>
to mean
<span class="quote">
“
<span class="quote">
any
schema.
</span>
”
</span>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
OBJECT_NAME
</code>
</p>
<p>
The name of the instrumented object. This should be a
literal name, or
<code class="literal">
'%'
</code>
to mean
<span class="quote">
“
<span class="quote">
any
object.
</span>
”
</span>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ENABLED
</code>
</p>
<p>
Whether events for the object are instrumented. The value
is
<code class="literal">
YES
</code>
or
<code class="literal">
NO
</code>
. This
column can be modified.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
TIMED
</code>
</p>
<p>
Whether events for the object are timed. This column can
be modified.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-setup-objects-table.html" title="29.12.2.4 The setup_objects Table">
<code class="literal">
setup_objects
</code>
</a>
table has these
indexes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Index on (
<code class="literal">
OBJECT_TYPE
</code>
,
<code class="literal">
OBJECT_SCHEMA
</code>
,
<code class="literal">
OBJECT_NAME
</code>
)
</p>
</li>
</ul>
</div>
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
is permitted for
the
<a class="link" href="performance-schema-setup-objects-table.html" title="29.12.2.4 The setup_objects Table">
<code class="literal">
setup_objects
</code>
</a>
table. It
removes the rows.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/server-shutdown.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="server-shutdown">
</a>
7.1.19 The Server Shutdown Process
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045259983360">
</a>
<a class="indexterm" name="idm46045259981904">
</a>
<p>
The server shutdown process takes place as follows:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
The shutdown process is initiated.
</p>
<p>
This can occur initiated several ways. For example, a user
with the
<a class="link" href="privileges-provided.html#priv_shutdown">
<code class="literal">
SHUTDOWN
</code>
</a>
privilege can
execute a
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin shutdown
</strong>
</span>
</a>
command.
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
</strong>
</span>
</a>
can be used on any platform
supported by MySQL. Other operating system-specific shutdown
initiation methods are possible as well: The server shuts down
on Unix when it receives a
<code class="literal">
SIGTERM
</code>
signal.
A server running as a service on Windows shuts down when the
services manager tells it to.
</p>
</li>
<li class="listitem">
<p>
The server creates a shutdown thread if necessary.
</p>
<p>
Depending on how shutdown was initiated, the server might
create a thread to handle the shutdown process. If shutdown
was requested by a client, a shutdown thread is created. If
shutdown is the result of receiving a
<code class="literal">
SIGTERM
</code>
signal, the signal thread might
handle shutdown itself, or it might create a separate thread
to do so. If the server tries to create a shutdown thread and
cannot (for example, if memory is exhausted), it issues a
diagnostic message that appears in the error log:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa42207714"><div class="copy-help left">Press ⌘+C to 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">Error<span class="token operator">:</span> Can't create thread to kill server</code></pre>
</div>
</li>
<li class="listitem">
<p>
The server stops accepting new connections.
</p>
<p>
To prevent new activity from being initiated during shutdown,
the server stops accepting new client connections by closing
the handlers for the network interfaces to which it normally
listens for connections: the TCP/IP port, the Unix socket
file, the Windows named pipe, and shared memory on Windows.
</p>
</li>
<li class="listitem">
<p>
The server terminates current activity.
</p>
<p>
For each thread associated with a client connection, the
server breaks the connection to the client and marks the
thread as killed. Threads die when they notice that they are
so marked. Threads for idle connections die quickly. Threads
that currently are processing statements check their state
periodically and take longer to die. For additional
information about thread termination, see
<a class="xref" href="kill.html" title="15.7.8.4 KILL Statement">
Section 15.7.8.4, “KILL Statement”
</a>
, in particular for the instructions
about killed
<a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
<code class="literal">
REPAIR TABLE
</code>
</a>
or
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
operations on
<code class="literal">
MyISAM
</code>
tables.
</p>
<p>
For threads that have an open transaction, the transaction is
rolled back. If a thread is updating a nontransactional table,
an operation such as a multiple-row
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
or
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
may leave the table
partially updated because the operation can terminate before
completion.
</p>
<p>
If the server is a replication source server, it treats
threads associated with currently connected replicas like
other client threads. That is, each one is marked as killed
and exits when it next checks its state.
</p>
<p>
If the server is a replica server, it stops the replication
I/O and SQL threads, if they are active, before marking client
threads as killed. The SQL thread is permitted to finish its
current statement (to avoid causing replication problems), and
then stops. If the SQL thread is in the middle of a
transaction at this point, the server waits until the current
replication event group (if any) has finished executing, or
until the user issues a
<a class="link" href="kill.html" title="15.7.8.4 KILL Statement">
<code class="literal">
KILL QUERY
</code>
</a>
or
<a class="link" href="kill.html" title="15.7.8.4 KILL Statement">
<code class="literal">
KILL
CONNECTION
</code>
</a>
statement. See also
<a class="xref" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
Section 15.4.2.5, “STOP REPLICA Statement”
</a>
. Since nontransactional
statements cannot be rolled back, in order to guarantee
crash-safe replication, only transactional tables should be
used.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
To guarantee crash safety on the replica, you must run the
replica with
<a class="link" href="replication-options-replica.html#sysvar_relay_log_recovery">
<code class="option">
--relay-log-recovery
</code>
</a>
enabled.
</p>
</div>
<p>
See also
<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>
</li>
<li class="listitem">
<p>
The server shuts down or closes storage engines.
</p>
<p>
At this stage, the server flushes the table cache and closes
all open tables.
</p>
<p>
Each storage engine performs any actions necessary for tables
that it manages.
<code class="literal">
InnoDB
</code>
flushes its buffer pool to disk
(unless
<a class="link" href="innodb-parameters.html#sysvar_innodb_fast_shutdown">
<code class="literal">
innodb_fast_shutdown
</code>
</a>
is 2), writes the current LSN to the tablespace, and
terminates its own internal threads.
<code class="literal">
MyISAM
</code>
flushes any pending index writes for a table.
</p>
</li>
<li class="listitem">
<p>
The server exits.
</p>
</li>
</ol>
</div>
<a class="indexterm" name="idm46045259945120">
</a>
<a class="indexterm" name="idm46045259943632">
</a>
<p>
To provide information to management processes, the server returns
one of the exit codes described in the following list. The phrase
in parentheses indicates the action taken by systemd in response
to the code, for platforms on which systemd is used to manage the
server.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
0 = successful termination (no restart done)
</p>
</li>
<li class="listitem">
<p>
1 = unsuccessful termination (no restart done)
</p>
</li>
<li class="listitem">
<p>
2 = unsuccessful termination (restart done)
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/multiple-servers.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="multiple-servers">
</a>
7.8 Running Multiple MySQL Instances on One Machine
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<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>
</div>
<a class="indexterm" name="idm46045254134944">
</a>
<a class="indexterm" name="idm46045254133488">
</a>
<a class="indexterm" name="idm46045254132416">
</a>
<a class="indexterm" name="idm46045254131344">
</a>
<a class="indexterm" name="idm46045254129856">
</a>
<p>
In some cases, you might want to run multiple instances of MySQL on
a single machine. You might want to test a new MySQL release while
leaving an existing production setup undisturbed. Or you might want
to give different users access to different
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
servers that they manage themselves. (For
example, you might be an Internet Service Provider that wants to
provide independent MySQL installations for different customers.)
</p>
<p>
It is possible to use a different MySQL server binary per instance,
or use the same binary for multiple instances, or any combination of
the two approaches. For example, you might run a server from MySQL
8.3 and one from MySQL 8.4, to see how
different versions handle a given workload. Or you might run
multiple instances of the current production version, each managing
a different set of databases.
</p>
<p>
Whether or not you use distinct server binaries, each instance that
you run must be configured with unique values for several operating
parameters. This eliminates the potential for conflict between
instances. Parameters can be set on the command line, in option
files, or by setting environment variables. See
<a class="xref" href="program-options.html" title="6.2.2 Specifying Program Options">
Section 6.2.2, “Specifying Program Options”
</a>
. To see the values used by a given
instance, connect to it and execute a
<a class="link" href="show-variables.html" title="15.7.7.41 SHOW VARIABLES Statement">
<code class="literal">
SHOW
VARIABLES
</code>
</a>
statement.
</p>
<p>
The primary resource managed by a MySQL instance is the data
directory. Each instance should use a different data directory, the
location of which is specified using the
<a class="link" href="server-system-variables.html#sysvar_datadir">
<code class="option">
--datadir=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
option. For methods of configuring each instance with its own data
directory, and warnings about the dangers of failing to do so, see
<a class="xref" href="multiple-data-directories.html" title="7.8.1 Setting Up Multiple Data Directories">
Section 7.8.1, “Setting Up Multiple Data Directories”
</a>
.
</p>
<p>
In addition to using different data directories, several other
options must have different values for each server instance:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="server-options.html#option_mysqld_port">
<code class="option">
--port=
<em class="replaceable">
<code>
port_num
</code>
</em>
</code>
</a>
</p>
<a class="indexterm" name="idm46045254117264">
</a>
<p>
<a class="link" href="server-options.html#option_mysqld_port">
<code class="option">
--port
</code>
</a>
controls the port number
for TCP/IP connections. Alternatively, if the host has multiple
network addresses, you can set the
<a class="link" href="server-system-variables.html#sysvar_bind_address">
<code class="literal">
bind_address
</code>
</a>
system variable to
cause each server to listen to a different address.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-options.html#option_mysqld_socket">
<code class="option">
--socket={
<em class="replaceable">
<code>
file_name
</code>
</em>
|
<em class="replaceable">
<code>
pipe_name
</code>
</em>
}
</code>
</a>
</p>
<p>
<a class="link" href="server-options.html#option_mysqld_socket">
<code class="option">
--socket
</code>
</a>
controls the Unix socket
file path on Unix or the named-pipe name on Windows. On Windows,
it is necessary to specify distinct pipe names only for those
servers configured to permit named-pipe connections.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_shared_memory_base_name">
<code class="option">
--shared-memory-base-name=
<em class="replaceable">
<code>
name
</code>
</em>
</code>
</a>
</p>
<p>
This option is used only on Windows. It designates the
shared-memory name used by a Windows server to permit clients to
connect using shared memory. It is necessary to specify distinct
shared-memory names only for those servers configured to permit
shared-memory connections.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_pid_file">
<code class="option">
--pid-file=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
</p>
<p>
This option indicates the path name of the file in which the
server writes its process ID.
</p>
</li>
</ul>
</div>
<p>
If you use the following log file options, their values must differ
for each server:
</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_general_log_file">
<code class="option">
--general_log_file=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="replication-options-binary-log.html#option_mysqld_log-bin">
<code class="option">
--log-bin[=
<em class="replaceable">
<code>
file_name
</code>
</em>
]
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_slow_query_log_file">
<code class="option">
--slow_query_log_file=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-options.html#option_mysqld_log-error">
<code class="option">
--log-error[=
<em class="replaceable">
<code>
file_name
</code>
</em>
]
</code>
</a>
</p>
</li>
</ul>
</div>
<p>
For further discussion of log file options, see
<a class="xref" href="server-logs.html" title="7.4 MySQL Server Logs">
Section 7.4, “MySQL Server Logs”
</a>
.
</p>
<p>
To achieve better performance, you can specify the following option
differently for each server, to spread the load between several
physical disks:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="server-options.html#option_mysqld_tmpdir">
<code class="option">
--tmpdir=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
</p>
</li>
</ul>
</div>
<p>
Having different temporary directories also makes it easier to
determine which MySQL server created any given temporary file.
</p>
<p>
If you have multiple MySQL installations in different locations, you
can specify the base directory for each installation with the
<a class="link" href="server-system-variables.html#sysvar_basedir">
<code class="option">
--basedir=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
option. This causes each instance to automatically use a different
data directory, log files, and PID file because the default for each
of those parameters is relative to the base directory. In that case,
the only other options you need to specify are the
<a class="link" href="server-options.html#option_mysqld_socket">
<code class="option">
--socket
</code>
</a>
and
<a class="link" href="server-options.html#option_mysqld_port">
<code class="option">
--port
</code>
</a>
options. Suppose that you
install different versions of MySQL using
<code class="filename">
tar
</code>
file binary distributions. These install in different locations, so
you can start the server for each installation using the command
<span class="command">
<strong>
bin/mysqld_safe
</strong>
</span>
under its corresponding base
directory.
<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>
determines the proper
<a class="link" href="server-system-variables.html#sysvar_basedir">
<code class="option">
--basedir
</code>
</a>
option to pass to
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
, and you need specify only the
<a class="link" href="mysqld-safe.html#option_mysqld_safe_socket">
<code class="option">
--socket
</code>
</a>
and
<a class="link" href="mysqld-safe.html#option_mysqld_safe_port">
<code class="option">
--port
</code>
</a>
options to
<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>
<p>
As discussed in the following sections, it is possible to start
additional servers by specifying appropriate command options or by
setting environment variables. However, if you need to run multiple
servers on a more permanent basis, it is more convenient to use
option files to specify for each server those option values that
must be unique to it. The
<a class="link" href="option-file-options.html#option_general_defaults-file">
<code class="option">
--defaults-file
</code>
</a>
option is useful for
this purpose.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/processlist-access.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="processlist-access">
</a>
10.14.1 Accessing the Process List
</h3>
</div>
</div>
</div>
<p>
The following discussion enumerates the sources of process
information, the privileges required to see process information,
and describes the content of process list entries.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="processlist-access.html#processlist-sources" title="Sources of Process Information">
Sources of Process Information
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="processlist-access.html#processlist-privileges" title="Privileges Required to Access the Process List">
Privileges Required to Access the Process List
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="processlist-access.html#processlist-content" title="Content of Process List Entries">
Content of Process List Entries
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="processlist-sources">
</a>
Sources of Process Information
</h4>
</div>
</div>
</div>
<p>
Process information is available from these sources:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW PROCESSLIST
</code>
</a>
statement:
<a class="xref" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
Section 15.7.7.31, “SHOW PROCESSLIST Statement”
</a>
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin processlist
</strong>
</span>
</a>
command:
<a class="xref" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
Section 6.5.2, “mysqladmin — A MySQL Server Administration Program”
</a>
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
INFORMATION_SCHEMA
</code>
<a class="link" href="information-schema-processlist-table.html" title="28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table">
<code class="literal">
PROCESSLIST
</code>
</a>
table:
<a class="xref" href="information-schema-processlist-table.html" title="28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table">
Section 28.3.23, “The INFORMATION_SCHEMA PROCESSLIST Table”
</a>
</p>
</li>
<li class="listitem">
<p>
The Performance Schema
<a class="link" href="performance-schema-processlist-table.html" title="29.12.22.7 The processlist Table">
<code class="literal">
processlist
</code>
</a>
table:
<a class="xref" href="performance-schema-processlist-table.html" title="29.12.22.7 The processlist Table">
Section 29.12.22.7, “The processlist Table”
</a>
</p>
</li>
<li class="listitem">
<p>
The Performance Schema
<a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
<code class="literal">
threads
</code>
</a>
table columns with
names having a prefix of
<code class="literal">
PROCESSLIST_
</code>
:
<a class="xref" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
Section 29.12.22.8, “The threads Table”
</a>
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
sys
</code>
schema
<a class="link" href="sys-processlist.html" title="30.4.3.22 The processlist and x$processlist Views">
<code class="literal">
processlist
</code>
</a>
and
<a class="link" href="sys-session.html" title="30.4.3.33 The session and x$session Views">
<code class="literal">
session
</code>
</a>
views:
<a class="xref" href="sys-processlist.html" title="30.4.3.22 The processlist and x$processlist Views">
Section 30.4.3.22, “The processlist and x$processlist Views”
</a>
, and
<a class="xref" href="sys-session.html" title="30.4.3.33 The session and x$session Views">
Section 30.4.3.33, “The session and x$session Views”
</a>
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
<code class="literal">
threads
</code>
</a>
table compares to
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW PROCESSLIST
</code>
</a>
,
<code class="literal">
INFORMATION_SCHEMA
</code>
<a class="link" href="information-schema-processlist-table.html" title="28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table">
<code class="literal">
PROCESSLIST
</code>
</a>
, and
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin processlist
</strong>
</span>
</a>
as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Access to the
<a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
<code class="literal">
threads
</code>
</a>
table
does not require a mutex and has minimal impact on server
performance. The other sources have negative performance
consequences because they require a mutex.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
An alternative implementation for
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW PROCESSLIST
</code>
</a>
is
available based on the Performance Schema
<a class="link" href="performance-schema-processlist-table.html" title="29.12.22.7 The processlist Table">
<code class="literal">
processlist
</code>
</a>
table, which,
like the
<a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
<code class="literal">
threads
</code>
</a>
table,
does not require a mutex and has better performance
characteristics. For details, see
<a class="xref" href="performance-schema-processlist-table.html" title="29.12.22.7 The processlist Table">
Section 29.12.22.7, “The processlist Table”
</a>
.
</p>
</div>
</li>
<li class="listitem">
<p>
The
<a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
<code class="literal">
threads
</code>
</a>
table displays
background threads, which the other sources do not. It
also provides additional information for each thread that
the other sources do not, such as whether the thread is a
foreground or background thread, and the location within
the server associated with the thread. This means that the
<a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
<code class="literal">
threads
</code>
</a>
table can be used to
monitor thread activity the other sources cannot.
</p>
</li>
<li class="listitem">
<p>
You can enable or disable Performance Schema thread
monitoring, as described in
<a class="xref" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
Section 29.12.22.8, “The threads Table”
</a>
.
</p>
</li>
</ul>
</div>
<p>
For these reasons, DBAs who perform server monitoring using
one of the other thread information sources may wish to
monitor using the
<a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
<code class="literal">
threads
</code>
</a>
table
instead.
</p>
<p>
The
<code class="literal">
sys
</code>
schema
<a class="link" href="sys-processlist.html" title="30.4.3.22 The processlist and x$processlist Views">
<code class="literal">
processlist
</code>
</a>
view presents
information from the Performance Schema
<a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
<code class="literal">
threads
</code>
</a>
table in a more
accessible format. The
<code class="literal">
sys
</code>
schema
<a class="link" href="sys-session.html" title="30.4.3.33 The session and x$session Views">
<code class="literal">
session
</code>
</a>
view presents
information about user sessions like the
<code class="literal">
sys
</code>
schema
<a class="link" href="sys-processlist.html" title="30.4.3.22 The processlist and x$processlist Views">
<code class="literal">
processlist
</code>
</a>
view, but with
background processes filtered out.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="processlist-privileges">
</a>
Privileges Required to Access the Process List
</h4>
</div>
</div>
</div>
<p>
For most sources of process information, if you have the
<a class="link" href="privileges-provided.html#priv_process">
<code class="literal">
PROCESS
</code>
</a>
privilege, you can see
all threads, even those belonging to other users. Otherwise
(without the
<a class="link" href="privileges-provided.html#priv_process">
<code class="literal">
PROCESS
</code>
</a>
privilege), nonanonymous users have access to information
about their own threads but not threads for other users, and
anonymous users have no access to thread information.
</p>
<p>
The Performance Schema
<a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
<code class="literal">
threads
</code>
</a>
table also provides thread information, but table access uses
a different privilege model. See
<a class="xref" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
Section 29.12.22.8, “The threads Table”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="processlist-content">
</a>
Content of Process List Entries
</h4>
</div>
</div>
</div>
<p>
Each process list entry contains several pieces of
information. The following list describes them using the
labels from
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW PROCESSLIST
</code>
</a>
output. Other process information sources use similar labels.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
Id
</code>
is the connection identifier for the
client associated with the thread.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
User
</code>
and
<code class="literal">
Host
</code>
indicate the account associated with the thread.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
db
</code>
is the default database for the
thread, or
<code class="literal">
NULL
</code>
if none has been
selected.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Command
</code>
and
<code class="literal">
State
</code>
indicate what the thread is doing.
</p>
<p>
Most states correspond to very quick operations. If a
thread stays in a given state for many seconds, there
might be a problem that needs to be investigated.
</p>
<p>
The following sections list the possible
<code class="literal">
Command
</code>
values, and
<code class="literal">
State
</code>
values grouped by category. The
meaning for some of these values is self-evident. For
others, additional description is provided.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Applications that examine process list information
should be aware that the commands and states are subject
to change.
</p>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
Time
</code>
indicates how long the thread has
been in its current state. The thread's notion of the
current time may be altered in some cases: The thread can
change the time with
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
TIMESTAMP =
<em class="replaceable">
<code>
value
</code>
</em>
</code>
</a>
.
For a replica SQL thread, the value is the number of
seconds between the timestamp of the last replicated event
and the real time of the replica host. See
<a class="xref" href="replication-threads.html" title="19.2.3 Replication Threads">
Section 19.2.3, “Replication Threads”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Info
</code>
indicates the statement the thread
is executing, or
<code class="literal">
NULL
</code>
if it is
executing no statement. For
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW
PROCESSLIST
</code>
</a>
, this value contains only the first
100 characters of the statement. To see complete
statements, use
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW
FULL PROCESSLIST
</code>
</a>
(or query a different process
information source).
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/faqs-migration.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="faqs-migration">
</a>
A.8 MySQL 8.4 FAQ: Migration
</h2>
</div>
</div>
</div>
<div class="qandaset">
<a name="idm46045056132720">
</a>
<dl>
<dt>
A.8.1.
<a href="faqs-migration.html#faq-mysql-how-migration-mysql">
Where can I find information on how to upgrade or downgrade
MySQL?
</a>
</dt>
</dl>
<table border="0" style="width: 100%;">
<colgroup>
<col align="left" width="1%"/>
<col/>
</colgroup>
<tbody>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-how-migration-mysql">
</a>
<a name="idm46045056131968">
</a>
<p>
<b>
A.8.1.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Where can I find information on how to upgrade or downgrade
MySQL?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
For detailed upgrade information, see
<a class="xref" href="upgrading.html" title="Chapter 3 Upgrading MySQL">
Chapter 3,
<i>
Upgrading MySQL
</i>
</a>
. Do not skip a major version when
upgrading, but rather complete the process in steps, upgrading
from one major version to the next in each step. This may seem
more complicated, but ultimately saves time and trouble. If you
encounter problems during the upgrade, their origin is easier to
identify, either by you or, if you have a MySQL Enterprise
subscription, by MySQL support.
</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/revoke.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="revoke">
</a>
15.7.1.8 REVOKE Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045173161120">
</a>
<a class="indexterm" name="idm46045173160048">
</a>
<a class="indexterm" name="idm46045173159008">
</a>
<a class="indexterm" name="idm46045173157520">
</a>
<a class="indexterm" name="idm46045173156448">
</a>
<a class="indexterm" name="idm46045173154960">
</a>
<a class="indexterm" name="idm46045173153472">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa7158117"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">REVOKE</span> <span class="token punctuation">[</span><span class="token keyword">IF</span> <span class="token keyword">EXISTS</span><span class="token punctuation">]</span>
<em class="replaceable">priv_type</em> <span class="token punctuation">[</span><span class="token punctuation">(</span><em class="replaceable">column_list</em><span class="token punctuation">)</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">priv_type</em> <span class="token punctuation">[</span><span class="token punctuation">(</span><em class="replaceable">column_list</em><span class="token punctuation">)</span><span class="token punctuation">]</span><span class="token punctuation">]</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token keyword">ON</span> <span class="token punctuation">[</span><em class="replaceable">object_type</em><span class="token punctuation">]</span> <em class="replaceable">priv_level</em>
<span class="token keyword">FROM</span> <em class="replaceable">user_or_role</em> <span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">user_or_role</em><span class="token punctuation">]</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token punctuation">[</span><span class="token keyword">IGNORE</span> <span class="token keyword">UNKNOWN</span> <span class="token keyword">USER</span><span class="token punctuation">]</span>
<span class="token keyword">REVOKE</span> <span class="token punctuation">[</span><span class="token keyword">IF</span> <span class="token keyword">EXISTS</span><span class="token punctuation">]</span> <span class="token keyword">ALL</span> <span class="token punctuation">[</span><span class="token keyword">PRIVILEGES</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token keyword">GRANT</span> <span class="token keyword">OPTION</span>
<span class="token keyword">FROM</span> <em class="replaceable">user_or_role</em> <span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">user_or_role</em><span class="token punctuation">]</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token punctuation">[</span><span class="token keyword">IGNORE</span> <span class="token keyword">UNKNOWN</span> <span class="token keyword">USER</span><span class="token punctuation">]</span>
<span class="token keyword">REVOKE</span> <span class="token punctuation">[</span><span class="token keyword">IF</span> <span class="token keyword">EXISTS</span><span class="token punctuation">]</span> <span class="token keyword">PROXY</span> <span class="token keyword">ON</span> <em class="replaceable">user_or_role</em>
<span class="token keyword">FROM</span> <em class="replaceable">user_or_role</em> <span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">user_or_role</em><span class="token punctuation">]</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token punctuation">[</span><span class="token keyword">IGNORE</span> <span class="token keyword">UNKNOWN</span> <span class="token keyword">USER</span><span class="token punctuation">]</span>
<span class="token keyword">REVOKE</span> <span class="token punctuation">[</span><span class="token keyword">IF</span> <span class="token keyword">EXISTS</span><span class="token punctuation">]</span> <span class="token keyword"><em class="replaceable">role</em></span> <span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token keyword"><em class="replaceable">role</em></span> <span class="token punctuation">]</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token keyword">FROM</span> <em class="replaceable">user_or_role</em> <span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">user_or_role</em> <span class="token punctuation">]</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token punctuation">[</span><span class="token keyword">IGNORE</span> <span class="token keyword">UNKNOWN</span> <span class="token keyword">USER</span><span class="token punctuation">]</span>
<em class="replaceable">user_or_role</em>: {
<span class="token function"><em class="replaceable">user</em></span> <span class="token punctuation">(</span>see Section <span class="token number">8.2</span><span class="token punctuation">.</span><span class="token number">4</span><span class="token punctuation">,</span> “Specifying <span class="token keyword">Account</span> <span class="token keyword">Names</span>”<span class="token punctuation">)</span>
<span class="token operator">|</span> <span class="token keyword"><em class="replaceable">role</em></span> <span class="token punctuation">(</span>see Section <span class="token number">8.2</span><span class="token punctuation">.</span><span class="token number">5</span><span class="token punctuation">,</span> “Specifying <span class="token keyword">Role</span> <span class="token keyword">Names</span>”
}</code></pre>
</div>
<p>
The
<a class="link" href="revoke.html" title="15.7.1.8 REVOKE Statement">
<code class="literal">
REVOKE
</code>
</a>
statement enables
system administrators to revoke privileges and roles, which can
be revoked from user accounts and roles.
</p>
<p>
For details on the levels at which privileges exist, the
permissible
<em class="replaceable">
<code>
priv_type
</code>
</em>
,
<em class="replaceable">
<code>
priv_level
</code>
</em>
, and
<em class="replaceable">
<code>
object_type
</code>
</em>
values, and the syntax
for specifying users and passwords, see
<a class="xref" href="grant.html" title="15.7.1.6 GRANT Statement">
Section 15.7.1.6, “GRANT Statement”
</a>
.
</p>
<p>
For information about roles, see
<a class="xref" href="roles.html" title="8.2.10 Using Roles">
Section 8.2.10, “Using Roles”
</a>
.
</p>
<p>
When the
<a class="link" href="server-system-variables.html#sysvar_read_only">
<code class="literal">
read_only
</code>
</a>
system
variable is enabled,
<a class="link" href="revoke.html" title="15.7.1.8 REVOKE Statement">
<code class="literal">
REVOKE
</code>
</a>
requires the
<a class="link" href="privileges-provided.html#priv_connection-admin">
<code class="literal">
CONNECTION_ADMIN
</code>
</a>
or
privilege (or the deprecated
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege), in addition to
any other required privileges described in the following
discussion.
</p>
<p>
All the forms shown for
<code class="literal">
REVOKE
</code>
support an
<code class="literal">
IF EXISTS
</code>
option as well as an
<code class="literal">
IGNORE UNKNOWN USER
</code>
option. With neither of
these modifications,
<a class="link" href="revoke.html" title="15.7.1.8 REVOKE Statement">
<code class="literal">
REVOKE
</code>
</a>
either succeeds for all named users and roles, or rolls back and
has no effect if any error occurs; the statement is written to
the binary log only if it succeeds for all named users and
roles. The precise effects of
<code class="literal">
IF EXISTS
</code>
and
<code class="literal">
IGNORE UNKNOWN USER
</code>
are discussed later in
this section.
</p>
<p>
Each account name uses the format described in
<a class="xref" href="account-names.html" title="8.2.4 Specifying Account Names">
Section 8.2.4, “Specifying Account Names”
</a>
. Each role name uses the format
described in
<a class="xref" href="role-names.html" title="8.2.5 Specifying Role Names">
Section 8.2.5, “Specifying Role Names”
</a>
. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa90556889"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">REVOKE</span> <span class="token keyword">INSERT</span> <span class="token keyword">ON</span> <span class="token operator">*</span><span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">FROM</span> <span class="token string">'jeffrey'</span>@<span class="token string">'localhost'</span><span class="token punctuation">;</span>
<span class="token keyword">REVOKE</span> <span class="token string">'role1'</span><span class="token punctuation">,</span> <span class="token string">'role2'</span> <span class="token keyword">FROM</span> <span class="token string">'user1'</span>@<span class="token string">'localhost'</span><span class="token punctuation">,</span> <span class="token string">'user2'</span>@<span class="token string">'localhost'</span><span class="token punctuation">;</span>
<span class="token keyword">REVOKE</span> <span class="token keyword">SELECT</span> <span class="token keyword">ON</span> world<span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">FROM</span> <span class="token string">'role3'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The host name part of the account or role name, if omitted,
defaults to
<code class="literal">
'%'
</code>
.
</p>
<p>
To use the first
<a class="link" href="revoke.html" title="15.7.1.8 REVOKE Statement">
<code class="literal">
REVOKE
</code>
</a>
syntax,
you must have the
<a class="link" href="privileges-provided.html#priv_grant-option">
<code class="literal">
GRANT OPTION
</code>
</a>
privilege, and you must have the privileges that you are
revoking.
</p>
<p>
To revoke all privileges from a user, use one of the following
statements; either of these statements drops all global,
database, table, column, and routine privileges for the named
users or roles:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa95320333"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">REVOKE</span> <span class="token keyword">ALL</span> <span class="token keyword">PRIVILEGES</span><span class="token punctuation">,</span> <span class="token keyword">GRANT</span> <span class="token keyword">OPTION</span>
<span class="token keyword">FROM</span> <em class="replaceable">user_or_role</em> <span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">user_or_role</em><span class="token punctuation">]</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token keyword">REVOKE</span> <span class="token keyword">ALL</span> <span class="token keyword">ON</span> <span class="token operator">*</span><span class="token punctuation">.</span><span class="token operator">*</span>
<span class="token keyword">FROM</span> <em class="replaceable">user_or_role</em> <span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">user_or_role</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>
Neither of the two statements just shown revokes any roles.
</p>
<p>
To use these
<a class="link" href="revoke.html" title="15.7.1.8 REVOKE Statement">
<code class="literal">
REVOKE
</code>
</a>
statements,
you must have the global
<a class="link" href="privileges-provided.html#priv_create-user">
<code class="literal">
CREATE
USER
</code>
</a>
privilege, or the
<a class="link" href="privileges-provided.html#priv_update">
<code class="literal">
UPDATE
</code>
</a>
privilege for the
<code class="literal">
mysql
</code>
system schema.
</p>
<p>
The syntax for which the
<a class="link" href="revoke.html" title="15.7.1.8 REVOKE Statement">
<code class="literal">
REVOKE
</code>
</a>
keyword is followed by one or more role names takes a
<code class="literal">
FROM
</code>
clause indicating one or more users or
roles from which to revoke the roles.
</p>
<p>
The
<code class="literal">
IF EXISTS
</code>
and
<code class="literal">
IGNORE UNKNOWN
USER
</code>
options have the effects listed here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
IF EXISTS
</code>
means that, if the target user
or role exists but no such privilege or role is found
assigned to the target for any reason, a warning is raised,
instead of an error; if no privilege or role named by the
statement is assigned to the target, the statement has no
(other) effect. Otherwise,
<code class="literal">
REVOKE
</code>
executes normally; if the user does not exist, the statement
raises an error.
</p>
<p>
<span class="emphasis">
<em>
Example
</em>
</span>
: Given table
<code class="literal">
t1
</code>
in database
<code class="literal">
test
</code>
,
we execute the following statements, with the results shown.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa14524165"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">USER</span> jerry<span class="token variable">@localhost</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.01 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">REVOKE</span> <span class="token keyword">SELECT</span> <span class="token keyword">ON</span> test<span class="token punctuation">.</span>t1 <span class="token keyword">FROM</span> jerry<span class="token variable">@localhost</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1147 (42000)<span class="token punctuation">:</span> There is no such grant defined for user 'jerry' on host
'localhost' on table 't1' </span>
<span class="token prompt">mysql></span> <span class="token keyword">REVOKE</span> <span class="token keyword">IF</span> <span class="token keyword">EXISTS</span> <span class="token keyword">SELECT</span> <span class="token keyword">ON</span> test<span class="token punctuation">.</span>t1 <span class="token keyword">FROM</span> jerry<span class="token variable">@localhost</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected, 1 warning (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Level<span class="token punctuation">:</span> Warning
Code<span class="token punctuation">:</span> 1147
Message<span class="token punctuation">:</span> There is no such grant defined for user 'jerry' on host 'localhost' on
table 't1'
</span><span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
<code class="literal">
IF EXISTS
</code>
causes an error to be demoted
to a warning even if the privilege or role named does not
exist, or the statement attempts to assign it at the wrong
level.
</p>
</li>
<li class="listitem">
<p>
If the
<code class="literal">
REVOKE
</code>
statement includes
<code class="literal">
IGNORE UNKNOWN USER
</code>
, the statement raises
a warning for any target user or role named in the statement
but not found; if no target named by the statement exists,
<code class="literal">
REVOKE
</code>
succeeds but has no actual effect.
Otherwise, the statement executes as usual, and attempting
to revoke a privilege not assigned to the target for
whatever reason raises an error, as expected.
</p>
<p>
<span class="emphasis">
<em>
Example
</em>
</span>
(continuing from the previous
example):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa94668104"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">USER</span> <span class="token keyword">IF</span> <span class="token keyword">EXISTS</span> jerry<span class="token variable">@localhost</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.01 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">REVOKE</span> <span class="token keyword">SELECT</span> <span class="token keyword">ON</span> test<span class="token punctuation">.</span>t1 <span class="token keyword">FROM</span> jerry<span class="token variable">@localhost</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1147 (42000)<span class="token punctuation">:</span> There is no such grant defined for user 'jerry' on host
'localhost' on table 't1' </span>
<span class="token prompt">mysql></span> <span class="token keyword">REVOKE</span> <span class="token keyword">SELECT</span> <span class="token keyword">ON</span> test<span class="token punctuation">.</span>t1 <span class="token keyword">FROM</span> jerry<span class="token variable">@localhost</span> <span class="token keyword">IGNORE</span> <span class="token keyword">UNKNOWN</span> <span class="token keyword">USER</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected, 1 warning (0.01 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Level<span class="token punctuation">:</span> Warning
Code<span class="token punctuation">:</span> 3162
Message<span class="token punctuation">:</span> Authorization ID jerry does not exist.
</span><span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
The combination of
<code class="literal">
IF EXISTS
</code>
and
<code class="literal">
IGNORE UNKNOWN USER
</code>
means that
<code class="literal">
REVOKE
</code>
never raises an error for an
unknown target user or role or for an unassigned or
unavailable privilege, and the statement as whole in such
cases succeeds; roles or privileges are removed from
existing target users or roles whenever possible, and any
revocation which is not possible raises a warning and
executes as a
<code class="literal">
NOOP
</code>
.
</p>
<p>
<span class="emphasis">
<em>
Example
</em>
</span>
(again continuing from example
in the previous item):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa35459549"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token comment" spellcheck="true"># No such user, no such role</span>
<span class="token prompt">mysql></span> <span class="token keyword">DROP</span> <span class="token keyword">ROLE</span> <span class="token keyword">IF</span> <span class="token keyword">EXISTS</span> Bogus<span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected, 1 warning (0.02 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Level <span class="token punctuation">|</span> Code <span class="token punctuation">|</span> Message <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Note <span class="token punctuation">|</span> 3162 <span class="token punctuation">|</span> Authorization ID 'Bogus'@'%' does not exist. <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span>
<span class="token comment" spellcheck="true"># This statement attempts to revoke a nonexistent role from a nonexistent user</span>
<span class="token prompt">mysql></span> <span class="token keyword">REVOKE</span> Bogus <span class="token keyword">ON</span> test <span class="token keyword">FROM</span> jerry<span class="token variable">@localhost</span><span class="token punctuation">;</span>
<span class="token output">ERROR 3619 (HY000)<span class="token punctuation">:</span> Illegal privilege level specified for test
# The same, with IF EXISTS</span>
<span class="token prompt">mysql></span> <span class="token keyword">REVOKE</span> <span class="token keyword">IF</span> <span class="token keyword">EXISTS</span> Bogus <span class="token keyword">ON</span> test <span class="token keyword">FROM</span> jerry<span class="token variable">@localhost</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1147 (42000)<span class="token punctuation">:</span> There is no such grant defined for user 'jerry' on host
'localhost' on table 'test'
# The same, with IGNORE UNKNOWN USER</span>
<span class="token prompt">mysql></span> <span class="token keyword">REVOKE</span> Bogus <span class="token keyword">ON</span> test <span class="token keyword">FROM</span> jerry<span class="token variable">@localhost</span> <span class="token keyword">IGNORE</span> <span class="token keyword">UNKNOWN</span> <span class="token keyword">USER</span><span class="token punctuation">;</span>
<span class="token output">ERROR 3619 (HY000)<span class="token punctuation">:</span> Illegal privilege level specified for test
# The same, with both options</span>
<span class="token prompt">mysql></span> <span class="token keyword">REVOKE</span> <span class="token keyword">IF</span> <span class="token keyword">EXISTS</span> Bogus <span class="token keyword">ON</span> test <span class="token keyword">FROM</span> jerry<span class="token variable">@localhost</span> <span class="token keyword">IGNORE</span> <span class="token keyword">UNKNOWN</span> <span class="token keyword">USER</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected, 2 warnings (0.01 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Level <span class="token punctuation">|</span> Code <span class="token punctuation">|</span> Message <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Warning <span class="token punctuation">|</span> 3619 <span class="token punctuation">|</span> Illegal privilege level specified for test <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Warning <span class="token punctuation">|</span> 3162 <span class="token punctuation">|</span> Authorization ID jerry does not exist. <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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>
</li>
</ul>
</div>
<p>
Roles named in the
<a class="link" href="server-system-variables.html#sysvar_mandatory_roles">
<code class="literal">
mandatory_roles
</code>
</a>
system variable
value cannot be revoked. When
<code class="literal">
IF EXISTS
</code>
and
<code class="literal">
IGNORE UNKNOWN USER
</code>
are used together in a
statement that tries to remove a mandatory privilege, the error
normally raised by attempting to do this is demoted to a
warning; the statement executes successfully, but does not make
any changes.
</p>
<p>
A revoked role immediately affects any user account from which
it was revoked, such that within any current session for the
account, its privileges are adjusted for the next statement
executed.
</p>
<p>
Revoking a role revokes the role itself, not the privileges that
it represents. Suppose that an account is granted a role that
includes a given privilege, and is also granted the privilege
explicitly or another role that includes the privilege. In this
case, the account still possesses that privilege if the first
role is revoked. For example, if an account is granted two roles
that each include
<a class="link" href="privileges-provided.html#priv_select">
<code class="literal">
SELECT
</code>
</a>
, the
account still can select after either role is revoked.
</p>
<p>
<code class="literal">
REVOKE ALL ON *.*
</code>
(at the global level)
revokes all granted static global privileges and all granted
dynamic privileges.
</p>
<p>
A revoked privilege that is granted but not known to the server
is revoked with a warning. This situation can occur for dynamic
privileges. For example, a dynamic privilege can be granted
while the component that registers it is installed, but if that
component is subsequently uninstalled, the privilege becomes
unregistered, although accounts that possess the privilege still
possess it and it can be revoked from them.
</p>
<p>
<a class="link" href="revoke.html" title="15.7.1.8 REVOKE Statement">
<code class="literal">
REVOKE
</code>
</a>
removes privileges, but
does not remove rows from the
<code class="literal">
mysql.user
</code>
system table. To remove a user account entirely, use
<a class="link" href="drop-user.html" title="15.7.1.5 DROP USER Statement">
<code class="literal">
DROP USER
</code>
</a>
. See
<a class="xref" href="drop-user.html" title="15.7.1.5 DROP USER Statement">
Section 15.7.1.5, “DROP USER Statement”
</a>
.
</p>
<p>
If the grant tables hold privilege rows that contain mixed-case
database or table names and the
<a class="link" href="server-system-variables.html#sysvar_lower_case_table_names">
<code class="literal">
lower_case_table_names
</code>
</a>
system
variable is set to a nonzero value,
<a class="link" href="revoke.html" title="15.7.1.8 REVOKE Statement">
<code class="literal">
REVOKE
</code>
</a>
cannot be used to revoke
these privileges. It is necessary in such cases to manipulate
the grant tables directly. (
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
does not create such rows when
<a class="link" href="server-system-variables.html#sysvar_lower_case_table_names">
<code class="literal">
lower_case_table_names
</code>
</a>
is set,
but such rows might have been created prior to setting the
variable. The
<a class="link" href="server-system-variables.html#sysvar_lower_case_table_names">
<code class="literal">
lower_case_table_names
</code>
</a>
setting
can only be configured when initializing the server.)
</p>
<p>
When successfully executed 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>
program,
<a class="link" href="revoke.html" title="15.7.1.8 REVOKE Statement">
<code class="literal">
REVOKE
</code>
</a>
responds with
<code class="literal">
Query OK, 0 rows affected
</code>
. To determine what
privileges remain after the operation, use
<a class="link" href="show-grants.html" title="15.7.7.22 SHOW GRANTS Statement">
<code class="literal">
SHOW GRANTS
</code>
</a>
. See
<a class="xref" href="show-grants.html" title="15.7.7.22 SHOW GRANTS Statement">
Section 15.7.7.22, “SHOW GRANTS Statement”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/distinct-optimization.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="distinct-optimization">
</a>
10.2.1.18 DISTINCT Optimization
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045228693120">
</a>
<a class="indexterm" name="idm46045228692048">
</a>
<p>
<code class="literal">
DISTINCT
</code>
combined with
<code class="literal">
ORDER
BY
</code>
needs a temporary table in many cases.
</p>
<p>
Because
<code class="literal">
DISTINCT
</code>
may use
<code class="literal">
GROUP
BY
</code>
, learn how MySQL works with columns in
<code class="literal">
ORDER BY
</code>
or
<code class="literal">
HAVING
</code>
clauses that are not part of the selected columns. See
<a class="xref" href="group-by-handling.html" title="14.19.3 MySQL Handling of GROUP BY">
Section 14.19.3, “MySQL Handling of GROUP BY”
</a>
.
</p>
<p>
In most cases, a
<code class="literal">
DISTINCT
</code>
clause can be
considered as a special case of
<code class="literal">
GROUP BY
</code>
.
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="sa95092955"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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 punctuation">,</span> c3 <span class="token keyword">FROM</span> t1
<span class="token keyword">WHERE</span> c1 <span class="token operator">></span> <em class="replaceable">const</em><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> c1<span class="token punctuation">,</span> c2<span class="token punctuation">,</span> c3 <span class="token keyword">FROM</span> t1
<span class="token keyword">WHERE</span> c1 <span class="token operator">></span> <em class="replaceable">const</em> <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> c1<span class="token punctuation">,</span> c2<span class="token punctuation">,</span> c3<span class="token punctuation">;</span></code></pre>
</div>
<p>
Due to this equivalence, the optimizations applicable to
<code class="literal">
GROUP BY
</code>
queries can be also applied to
queries with a
<code class="literal">
DISTINCT
</code>
clause. Thus, for
more details on the optimization possibilities for
<code class="literal">
DISTINCT
</code>
queries, see
<a class="xref" href="group-by-optimization.html" title="10.2.1.17 GROUP BY Optimization">
Section 10.2.1.17, “GROUP BY Optimization”
</a>
.
</p>
<p>
When combining
<code class="literal">
LIMIT
<em class="replaceable">
<code>
row_count
</code>
</em>
</code>
with
<code class="literal">
DISTINCT
</code>
, MySQL stops as soon as it finds
<em class="replaceable">
<code>
row_count
</code>
</em>
unique rows.
</p>
<p>
If you do not use columns from all tables named in a query,
MySQL stops scanning any unused tables as soon as it finds the
first match. In the following case, assuming that
<code class="literal">
t1
</code>
is used before
<code class="literal">
t2
</code>
(which you can check with
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
), MySQL stops reading
from
<code class="literal">
t2
</code>
(for any particular row in
<code class="literal">
t1
</code>
) when it finds the first row in
<code class="literal">
t2
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa25567755"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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> t1<span class="token punctuation">.</span>a <span class="token keyword">FROM</span> t1<span class="token punctuation">,</span> t2 <span class="token keyword">where</span> t1<span class="token punctuation">.</span>a<span class="token operator">=</span>t2<span class="token punctuation">.</span>a<span class="token punctuation">;</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/enterprise-encryption.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="enterprise-encryption">
</a>
8.6 MySQL Enterprise Encryption
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<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>
</div>
<a class="indexterm" name="idm46045231986768">
</a>
<a class="indexterm" name="idm46045231985712">
</a>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
MySQL Enterprise Encryption is an extension included in MySQL Enterprise Edition, a commercial
product. To learn more about commercial products,
<a class="ulink" href="https://www.mysql.com/products/" target="_blank">
https://www.mysql.com/products/
</a>
.
</p>
</div>
<p>
MySQL Enterprise Edition includes a set of encryption functions that expose OpenSSL
capabilities at the SQL level. The functions enable Enterprise
applications to perform the following operations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Implement added data protection using public-key asymmetric
cryptography
</p>
</li>
<li class="listitem">
<p>
Create public and private keys and digital signatures
</p>
</li>
<li class="listitem">
<p>
Perform asymmetric encryption and decryption
</p>
</li>
<li class="listitem">
<p>
Use cryptographic hashing for digital signing and data
verification and validation
</p>
</li>
</ul>
</div>
<p>
These functions are provided by the MySQL
<code class="literal">
component_enterprise_encryption
</code>
component.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/tracing-memory-usage.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="tracing-memory-usage">
</a>
10.15.5 Tracing Memory Usage
</h3>
</div>
</div>
</div>
<p>
Each stored trace is a string, which is extended (using
<code class="literal">
realloc()
</code>
) as optimization progresses by
appending more data to it. The
<a class="link" href="server-system-variables.html#sysvar_optimizer_trace_max_mem_size">
<code class="literal">
optimizer_trace_max_mem_size
</code>
</a>
server system variable sets a limit on the total amount of memory
used by all traces currently being stored. If this limit is
reached, the current trace is not extended, which means the trace
is incomplete; in this case the
<code class="literal">
MISSING_BYTES_BEYOND_MAX_MEM_SIZE
</code>
column shows
the number of bytes missing from the trace.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-multi-source-adding-gtid-master.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-multi-source-adding-gtid-master">
</a>
19.1.5.3 Adding GTID-Based Sources to a Multi-Source Replica
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045145226416">
</a>
<p>
These steps assume you have enabled GTIDs for transactions on the
sources using
<a class="link" href="replication-options-gtids.html#sysvar_gtid_mode">
<code class="literal">
gtid_mode=ON
</code>
</a>
,
created a replication user, ensured that the replica is using
<code class="literal">
TABLE
</code>
based replication applier metadata
repositories, and provisioned the replica with data from the
sources if appropriate.
</p>
<p>
Use
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE REPLICATION SOURCE TO
</code>
</a>
to
configure a replication channel for each source on the replica
(see
<a class="xref" href="replication-channels.html" title="19.2.2 Replication Channels">
Section 19.2.2, “Replication Channels”
</a>
). The
<code class="literal">
FOR
CHANNEL
</code>
clause is used to specify the channel. For
GTID-based replication, GTID auto-positioning is used to
synchronize with the source (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>
). The
<code class="literal">
SOURCE_AUTO_POSITION
</code>
option is set to specify
the use of auto-positioning.
</p>
<p>
For example, to add
<code class="literal">
source1
</code>
and
<code class="literal">
source2
</code>
as sources to the replica, use 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 issue the statement twice on
the replica, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa57249422"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CHANGE</span> <span class="token keyword">REPLICATION</span> <span class="token keyword">SOURCE</span> <span class="token keyword">TO</span> <span class="token keyword">SOURCE_HOST</span><span class="token operator">=</span><span class="token string">"source1"</span><span class="token punctuation">,</span> <span class="token keyword">SOURCE_USER</span><span class="token operator">=</span><span class="token string">"ted"</span><span class="token punctuation">,</span> \
<span class="token keyword">SOURCE_PASSWORD</span><span class="token operator">=</span><span class="token string">"<em class="replaceable">password</em>"</span><span class="token punctuation">,</span> <span class="token keyword">SOURCE_AUTO_POSITION</span><span class="token operator">=</span><span class="token number">1</span> <span class="token keyword">FOR</span> <span class="token keyword">CHANNEL</span> <span class="token string">"source_1"</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">CHANGE</span> <span class="token keyword">REPLICATION</span> <span class="token keyword">SOURCE</span> <span class="token keyword">TO</span> <span class="token keyword">SOURCE_HOST</span><span class="token operator">=</span><span class="token string">"source2"</span><span class="token punctuation">,</span> <span class="token keyword">SOURCE_USER</span><span class="token operator">=</span><span class="token string">"ted"</span><span class="token punctuation">,</span> \
<span class="token keyword">SOURCE_PASSWORD</span><span class="token operator">=</span><span class="token string">"<em class="replaceable">password</em>"</span><span class="token punctuation">,</span> <span class="token keyword">SOURCE_AUTO_POSITION</span><span class="token operator">=</span><span class="token number">1</span> <span class="token keyword">FOR</span> <span class="token keyword">CHANNEL</span> <span class="token string">"source_2"</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
To make the replica replicate only database
<code class="literal">
db1
</code>
from
<code class="literal">
source1
</code>
, and only database
<code class="literal">
db2
</code>
from
<code class="literal">
source2
</code>
, use 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 issue the
<a class="link" href="change-replication-filter.html" title="15.4.2.1 CHANGE REPLICATION FILTER Statement">
<code class="literal">
CHANGE REPLICATION FILTER
</code>
</a>
statement
for each channel, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa5565345"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CHANGE</span> <span class="token keyword">REPLICATION</span> <span class="token keyword">FILTER</span> <span class="token keyword">REPLICATE_WILD_DO_TABLE</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token string">'db1.%'</span><span class="token punctuation">)</span> <span class="token keyword">FOR</span> <span class="token keyword">CHANNEL</span> <span class="token string">"source_1"</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">CHANGE</span> <span class="token keyword">REPLICATION</span> <span class="token keyword">FILTER</span> <span class="token keyword">REPLICATE_WILD_DO_TABLE</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token string">'db2.%'</span><span class="token punctuation">)</span> <span class="token keyword">FOR</span> <span class="token keyword">CHANNEL</span> <span class="token string">"source_2"</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For the full syntax of the
<a class="link" href="change-replication-filter.html" title="15.4.2.1 CHANGE REPLICATION FILTER Statement">
<code class="literal">
CHANGE REPLICATION
FILTER
</code>
</a>
statement and other available options, see
<a class="xref" href="change-replication-filter.html" title="15.4.2.1 CHANGE REPLICATION FILTER Statement">
Section 15.4.2.1, “CHANGE REPLICATION FILTER Statement”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/myisam-table-close.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="myisam-table-close">
</a>
18.2.4.2 Problems from Tables Not Being Closed Properly
</h4>
</div>
</div>
</div>
<p>
Each
<code class="literal">
MyISAM
</code>
index file
(
<code class="filename">
.MYI
</code>
file) has a counter in the header
that can be used to check whether a table has been closed
properly. If you get the following warning from
<a class="link" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
<code class="literal">
CHECK TABLE
</code>
</a>
or
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
, it means that this counter has
gone out of sync:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa63213416"><div class="copy-help left">Press ⌘+C to 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">clients are using or haven't closed the table properly</code></pre>
</div>
<p>
This warning doesn't necessarily mean that the table is
corrupted, but you should at least check the table.
</p>
<p>
The counter works as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The first time a table is updated in MySQL, a counter in the
header of the index files is incremented.
</p>
</li>
<li class="listitem">
<p>
The counter is not changed during further updates.
</p>
</li>
<li class="listitem">
<p>
When the last instance of a table is closed (because a
<a class="link" href="flush.html#flush-tables">
<code class="literal">
FLUSH TABLES
</code>
</a>
operation was
performed or because there is no room in the table cache),
the counter is decremented if the table has been updated at
any point.
</p>
</li>
<li class="listitem">
<p>
When you repair the table or check the table and it is found
to be okay, the counter is reset to zero.
</p>
</li>
<li class="listitem">
<p>
To avoid problems with interaction with other processes that
might check the table, the counter is not decremented on
close if it was zero.
</p>
</li>
</ul>
</div>
<p>
In other words, the counter can become incorrect only under
these conditions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A
<code class="literal">
MyISAM
</code>
table is copied without first
issuing
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
and
<a class="link" href="flush.html#flush-tables">
<code class="literal">
FLUSH TABLES
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
MySQL has crashed between an update and the final close.
(The table may still be okay because MySQL always issues
writes for everything between each statement.)
</p>
</li>
<li class="listitem">
<p>
A table was modified by
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
--recover
</strong>
</span>
</a>
or
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
--update-state
</strong>
</span>
</a>
at the same time that it was in use
by
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
.
</p>
</li>
<li class="listitem">
<p>
Multiple
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
servers are using the
table and one server performed a
<a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
<code class="literal">
REPAIR
TABLE
</code>
</a>
or
<a class="link" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
<code class="literal">
CHECK
TABLE
</code>
</a>
on the table while it was in use by another
server. In this setup, it is safe to use
<a class="link" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
<code class="literal">
CHECK TABLE
</code>
</a>
, although you
might get the warning from other servers. However,
<a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
<code class="literal">
REPAIR TABLE
</code>
</a>
should be
avoided because when one server replaces the data file with
a new one, this is not known to the other servers.
</p>
<p>
In general, it is a bad idea to share a data directory among
multiple servers. See
<a class="xref" href="multiple-servers.html" title="7.8 Running Multiple MySQL Instances on One Machine">
Section 7.8, “Running Multiple MySQL Instances on One Machine”
</a>
,
for additional discussion.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/spatial-analysis-functions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="spatial-analysis-functions">
</a>
14.16 Spatial Analysis Functions
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<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>
</div>
<p>
MySQL provides functions to perform various operations on spatial
data. These functions can be grouped into several major categories
according to the type of operation they perform:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Functions that create geometries in various formats (WKT, WKB,
internal)
</p>
</li>
<li class="listitem">
<p>
Functions that convert geometries between formats
</p>
</li>
<li class="listitem">
<p>
Functions that access qualitative or quantitative properties of
a geometry
</p>
</li>
<li class="listitem">
<p>
Functions that describe relations between two geometries
</p>
</li>
<li class="listitem">
<p>
Functions that create new geometries from existing ones
</p>
</li>
</ul>
</div>
<p>
For general background about MySQL support for using spatial data,
see
<a class="xref" href="spatial-types.html" title="13.4 Spatial Data Types">
Section 13.4, “Spatial Data Types”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-table-handles-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-table-handles-table">
</a>
29.12.13.4 The table_handles Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045070243152">
</a>
<a class="indexterm" name="idm46045070241664">
</a>
<p>
The Performance Schema exposes table lock information through
the
<a class="link" href="performance-schema-table-handles-table.html" title="29.12.13.4 The table_handles Table">
<code class="literal">
table_handles
</code>
</a>
table to show
the table locks currently in effect for each opened table
handle.
<a class="link" href="performance-schema-table-handles-table.html" title="29.12.13.4 The table_handles Table">
<code class="literal">
table_handles
</code>
</a>
reports
what is recorded by the table lock instrumentation. This
information shows which table handles the server has open, how
they are locked, and by which sessions.
</p>
<p>
The
<a class="link" href="performance-schema-table-handles-table.html" title="29.12.13.4 The table_handles Table">
<code class="literal">
table_handles
</code>
</a>
table is read
only and cannot be updated. It is autosized by default; to
configure the table size, set the
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_table_handles">
<code class="literal">
performance_schema_max_table_handles
</code>
</a>
system variable at server startup.
</p>
<p>
Table lock instrumentation uses the
<code class="literal">
wait/lock/table/sql/handler
</code>
instrument,
which is enabled by default.
</p>
<p>
To control table lock instrumentation state at server startup,
use lines like these in your
<code class="filename">
my.cnf
</code>
file:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Enable:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa3856122"><div class="copy-help left">Press ⌘+C to 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">performance-schema-instrument</span><span class="token attr-value"><span class="token punctuation">=</span>'wait/lock/table/sql/handler=ON'</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Disable:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa95880921"><div class="copy-help left">Press ⌘+C to 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">performance-schema-instrument</span><span class="token attr-value"><span class="token punctuation">=</span>'wait/lock/table/sql/handler=OFF'</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
To control table lock instrumentation state at runtime, update
the
<a class="link" href="performance-schema-setup-instruments-table.html" title="29.12.2.3 The setup_instruments Table">
<code class="literal">
setup_instruments
</code>
</a>
table:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Enable:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34564289"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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> performance_schema<span class="token punctuation">.</span>setup_instruments
<span class="token keyword">SET</span> ENABLED <span class="token operator">=</span> <span class="token string">'YES'</span><span class="token punctuation">,</span> TIMED <span class="token operator">=</span> <span class="token string">'YES'</span>
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">=</span> <span class="token string">'wait/lock/table/sql/handler'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Disable:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34924734"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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> performance_schema<span class="token punctuation">.</span>setup_instruments
<span class="token keyword">SET</span> ENABLED <span class="token operator">=</span> <span class="token string">'NO'</span><span class="token punctuation">,</span> TIMED <span class="token operator">=</span> <span class="token string">'NO'</span>
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">=</span> <span class="token string">'wait/lock/table/sql/handler'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-table-handles-table.html" title="29.12.13.4 The table_handles Table">
<code class="literal">
table_handles
</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">
OBJECT_TYPE
</code>
</p>
<p>
The table opened by a table handle.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
OBJECT_SCHEMA
</code>
</p>
<p>
The schema that contains the object.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
OBJECT_NAME
</code>
</p>
<p>
The name of the instrumented object.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
OBJECT_INSTANCE_BEGIN
</code>
</p>
<p>
The table handle address in memory.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
OWNER_THREAD_ID
</code>
</p>
<p>
The thread owning the table handle.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
OWNER_EVENT_ID
</code>
</p>
<p>
The event which caused the table handle to be opened.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
INTERNAL_LOCK
</code>
</p>
<p>
The table lock used at the SQL level. The value is one of
<code class="literal">
READ
</code>
,
<code class="literal">
READ WITH SHARED
LOCKS
</code>
,
<code class="literal">
READ HIGH PRIORITY
</code>
,
<code class="literal">
READ NO INSERT
</code>
,
<code class="literal">
WRITE ALLOW
WRITE
</code>
,
<code class="literal">
WRITE CONCURRENT
INSERT
</code>
,
<code class="literal">
WRITE LOW PRIORITY
</code>
,
or
<code class="literal">
WRITE
</code>
. For information about these
lock types, see the
<code class="filename">
include/thr_lock.h
</code>
source file.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
EXTERNAL_LOCK
</code>
</p>
<p>
The table lock used at the storage engine level. The value
is one of
<code class="literal">
READ EXTERNAL
</code>
or
<code class="literal">
WRITE EXTERNAL
</code>
.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-table-handles-table.html" title="29.12.13.4 The table_handles Table">
<code class="literal">
table_handles
</code>
</a>
table has these
indexes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
OBJECT_INSTANCE_BEGIN
</code>
)
</p>
</li>
<li class="listitem">
<p>
Index on (
<code class="literal">
OBJECT_TYPE
</code>
,
<code class="literal">
OBJECT_SCHEMA
</code>
,
<code class="literal">
OBJECT_NAME
</code>
)
</p>
</li>
<li class="listitem">
<p>
Index on (
<code class="literal">
OWNER_THREAD_ID
</code>
,
<code class="literal">
OWNER_EVENT_ID
</code>
)
</p>
</li>
</ul>
</div>
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
is not permitted
for the
<a class="link" href="performance-schema-table-handles-table.html" title="29.12.13.4 The table_handles Table">
<code class="literal">
table_handles
</code>
</a>
table.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/clone-plugin-limitations.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="clone-plugin-limitations">
</a>
7.6.7.14 Clone Plugin Limitations
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045254549728">
</a>
<p>
The clone plugin is subject to these limitations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
An instance cannot be cloned from a different MySQL server
series. For example, you cannot clone between MySQL 8.0 and
MySQL 8.4, but can clone within a series such as MySQL 8.4.1
and MySQL 8.4.13.
</p>
</li>
<li class="listitem">
<p>
Only a single MySQL instance can be cloned at a time.
Cloning multiple MySQL instances in a single cloning
operation is not supported.
</p>
</li>
<li class="listitem">
<p>
The X Protocol port specified by
<a class="link" href="x-plugin-options-system-variables.html#sysvar_mysqlx_port">
<code class="literal">
mysqlx_port
</code>
</a>
is not
supported for remote cloning operations (when specifying the
port number of the donor MySQL server instance in a
<a class="link" href="clone.html" title="15.7.5 CLONE Statement">
<code class="literal">
CLONE
INSTANCE
</code>
</a>
statement).
</p>
</li>
<li class="listitem">
<p>
The clone plugin does not support cloning of MySQL server
configurations. The recipient MySQL server instance retains
its configuration, including persisted system variable
settings (see
<a class="xref" href="persisted-system-variables.html" title="7.1.9.3 Persisted System Variables">
Section 7.1.9.3, “Persisted System Variables”
</a>
.)
</p>
</li>
<li class="listitem">
<p>
The clone plugin does not support cloning of binary logs.
</p>
</li>
<li class="listitem">
<p>
The clone plugin only clones data stored in
<code class="literal">
InnoDB
</code>
. Other storage engine data is not
cloned.
<a class="link" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
<code class="literal">
MyISAM
</code>
</a>
and
<a class="link" href="csv-storage-engine.html" title="18.4 The CSV Storage Engine">
<code class="literal">
CSV
</code>
</a>
tables stored in any schema
including the
<code class="literal">
sys
</code>
schema are cloned as
empty tables.
</p>
</li>
<li class="listitem">
<p>
Connecting to the donor MySQL server instance through
MySQL Router is not supported.
</p>
</li>
<li class="listitem">
<p>
Local cloning operations do not support cloning of general
tablespaces that were created with an absolute path. A
cloned tablespace file with the same path as the source
tablespace file would cause a conflict.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/charset-applications.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="charset-applications">
</a>
12.5 Configuring Application Character Set and Collation
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045217278528">
</a>
<p>
For applications that store data using the default MySQL character
set and collation (
<code class="literal">
utf8mb4
</code>
,
<code class="literal">
utf8mb4_0900_ai_ci
</code>
), no special configuration
should be needed. If applications require data storage using a
different character set or collation, you can configure character
set information several ways:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Specify character settings per database. For example,
applications that use one database might use the default of
<code class="literal">
utf8mb4
</code>
, whereas applications that use
another database might use
<code class="literal">
sjis
</code>
.
</p>
</li>
<li class="listitem">
<p>
Specify character settings at server startup. This causes the
server to use the given settings for all applications that do
not make other arrangements.
</p>
</li>
<li class="listitem">
<p>
Specify character settings at configuration time, if you build
MySQL from source. This causes the server to use the given
settings as the defaults for all applications, without having
to specify them at server startup.
</p>
</li>
</ul>
</div>
<p>
When different applications require different character settings,
the per-database technique provides a good deal of flexibility. If
most or all applications use the same character set, specifying
character settings at server startup or configuration time may be
most convenient.
</p>
<p>
For the per-database or server-startup techniques, the settings
control the character set for data storage. Applications must also
tell the server which character set to use for client/server
communications, as described in the following instructions.
</p>
<p>
The examples shown here assume use of the
<code class="literal">
latin1
</code>
character set and
<code class="literal">
latin1_swedish_ci
</code>
collation in particular
contexts as an alternative to the defaults of
<code class="literal">
utf8mb4
</code>
and
<code class="literal">
utf8mb4_0900_ai_ci
</code>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<b>
Specify character settings per database.
</b>
To create a database such that its tables use a given
default character set and collation for data storage, use a
<a class="link" href="create-database.html" title="15.1.12 CREATE DATABASE Statement">
<code class="literal">
CREATE DATABASE
</code>
</a>
statement
like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa10168135"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">DATABASE</span> mydb
<span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> latin1
<span class="token keyword">COLLATE</span> latin1_swedish_ci<span class="token punctuation">;</span></code></pre>
</div>
<p>
Tables created in the database use
<code class="literal">
latin1
</code>
and
<code class="literal">
latin1_swedish_ci
</code>
by default for any
character columns.
</p>
<p>
Applications that use the database should also configure their
connection to the server each time they connect. This can be
done by executing a
<code class="literal">
SET NAMES 'latin1'
</code>
statement after connecting. The statement can be used
regardless of connection method (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, PHP scripts, and so forth).
</p>
<p>
In some cases, it may be possible to configure the connection
to use the desired character set some other way. For example,
to connect using
<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 specify the
<a class="link" href="mysql-command-options.html#option_mysql_default-character-set">
<code class="option">
--default-character-set=latin1
</code>
</a>
command-line option to achieve the same effect as
<code class="literal">
SET
NAMES 'latin1'
</code>
.
</p>
<p>
For more information about configuring client connections, 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 class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If you use
<a class="link" href="alter-database.html" title="15.1.2 ALTER DATABASE Statement">
<code class="literal">
ALTER DATABASE
</code>
</a>
to
change the database default character set or collation,
existing stored routines in the database that use those
defaults must be dropped and recreated so that they use the
new defaults. (In a stored routine, variables with character
data types use the database defaults if the character set or
collation are not specified explicitly. See
<a class="xref" href="create-procedure.html" title="15.1.17 CREATE PROCEDURE and CREATE FUNCTION Statements">
Section 15.1.17, “CREATE PROCEDURE and CREATE FUNCTION Statements”
</a>
.)
</p>
</div>
</li>
<li class="listitem">
<p>
<b>
Specify character settings at server startup.
</b>
To select a character set and collation at server startup,
use the
<a class="link" href="server-system-variables.html#sysvar_character_set_server">
<code class="option">
--character-set-server
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_collation_server">
<code class="option">
--collation-server
</code>
</a>
options.
For example, to specify the options in an option file,
include these lines:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa61965647"><div class="copy-help left">Press ⌘+C to 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">character-set-server</span><span class="token attr-value"><span class="token punctuation">=</span>latin1</span>
<span class="token constant">collation-server</span><span class="token attr-value"><span class="token punctuation">=</span>latin1_swedish_ci</span></code></pre>
</div>
<p>
These settings apply server-wide and apply as the defaults for
databases created by any application, and for tables created
in those databases.
</p>
<p>
It is still necessary for applications to configure their
connection using
<a class="link" href="set-names.html" title="15.7.6.3 SET NAMES Statement">
<code class="literal">
SET NAMES
</code>
</a>
or
equivalent after they connect, as described previously. You
might be tempted to start the server with the
<a class="link" href="server-system-variables.html#sysvar_init_connect">
<code class="option">
--init_connect="SET NAMES
'latin1'"
</code>
</a>
option to cause
<a class="link" href="set-names.html" title="15.7.6.3 SET NAMES Statement">
<code class="literal">
SET
NAMES
</code>
</a>
to be executed automatically for each client
that connects. However, this may yield inconsistent results
because the
<a class="link" href="server-system-variables.html#sysvar_init_connect">
<code class="literal">
init_connect
</code>
</a>
value is not executed for users who have the
<a class="link" href="privileges-provided.html#priv_connection-admin">
<code class="literal">
CONNECTION_ADMIN
</code>
</a>
privilege (or
the deprecated
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege).
</p>
</li>
<li class="listitem">
<p>
<b>
Specify character settings at MySQL configuration time.
</b>
To select a character set and collation if you configure and
build MySQL from source, use the
<a class="link" href="source-configuration-options.html#option_cmake_default_charset">
<code class="option">
DEFAULT_CHARSET
</code>
</a>
and
<a class="link" href="source-configuration-options.html#option_cmake_default_collation">
<code class="option">
DEFAULT_COLLATION
</code>
</a>
<span class="command">
<strong>
CMake
</strong>
</span>
options:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa27836952"><div class="copy-help left">Press ⌘+C to 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">cmake <span class="token punctuation">.</span> <span class="token constant">-DDEFAULT_CHARSET</span><span class="token attr-value"><span class="token punctuation">=</span>latin1</span> \
<span class="token constant">-DDEFAULT_COLLATION</span><span class="token attr-value"><span class="token punctuation">=</span>latin1_swedish_ci</span></code></pre>
</div>
<p>
The resulting server uses
<code class="literal">
latin1
</code>
and
<code class="literal">
latin1_swedish_ci
</code>
as the default for
databases and tables and for client connections. It is
unnecessary to use
<a class="link" href="server-system-variables.html#sysvar_character_set_server">
<code class="option">
--character-set-server
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_collation_server">
<code class="option">
--collation-server
</code>
</a>
to specify
those defaults at server startup. It is also unnecessary for
applications to configure their connection using
<a class="link" href="set-names.html" title="15.7.6.3 SET NAMES Statement">
<code class="literal">
SET NAMES
</code>
</a>
or equivalent after
they connect to the server.
</p>
</li>
</ul>
</div>
<p>
Regardless of how you configure the MySQL character set for
application use, you must also consider the environment within
which those applications execute. For example, if you intend to
send statements using UTF-8 text taken from a file that you create
in an editor, you should edit the file with the locale of your
environment set to UTF-8 so that the file encoding is correct and
so that the operating system handles it correctly. If you use 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 from within a terminal window, the
window must be configured to use UTF-8 or characters may not
display properly. For a script that executes in a Web environment,
the script must handle character encoding properly for its
interaction with the MySQL server, and it must generate pages that
correctly indicate the encoding so that browsers know how to
display the content of the pages. For example, you can include
this
<code class="literal">
<meta>
</code>
tag within your
<code class="literal">
<head>
</code>
element:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-html"><div class="docs-select-all right" id="sa12094245"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>meta</span> <span class="token attr-name">http-equiv</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Content-Type<span class="token punctuation">"</span></span> <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>text/html; charset<span class="token punctuation">=</span>utf-8<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-features-views.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-features-views">
</a>
19.5.1.40 Replication and Views
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045134754448">
</a>
<a class="indexterm" name="idm46045134752960">
</a>
<p>
Views are always replicated to replicas. Views are filtered by
their own name, not by the tables they refer to. This means that
a view can be replicated to the replica even if the view
contains a table that would normally be filtered out by
<code class="option">
replication-ignore-table
</code>
rules. Care should
therefore be taken to ensure that views do not replicate table
data that would normally be filtered for security reasons.
</p>
<p>
Replication from a table to a same-named view is supported using
statement-based logging, but not when using row-based logging.
Trying to do so when row-based logging is in effect causes an
error.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/fulltext-restrictions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="fulltext-restrictions">
</a>
14.9.5 Full-Text Restrictions
</h3>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Full-text searches are supported for
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
and
<a class="link" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
<code class="literal">
MyISAM
</code>
</a>
tables only.
</p>
</li>
<li class="listitem">
<p>
Full-text searches are not supported for partitioned tables.
See
<a class="xref" href="partitioning-limitations.html" title="26.6 Restrictions and Limitations on Partitioning">
Section 26.6, “Restrictions and Limitations on Partitioning”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Full-text searches can be used with most multibyte character
sets. The exception is that for Unicode, the
<code class="literal">
utf8mb3
</code>
or
<code class="literal">
utf8mb4
</code>
character set can be used, but not the
<code class="literal">
ucs2
</code>
character set. Although
<code class="literal">
FULLTEXT
</code>
indexes on
<code class="literal">
ucs2
</code>
columns cannot be used, you can
perform
<code class="literal">
IN BOOLEAN MODE
</code>
searches on a
<code class="literal">
ucs2
</code>
column that has no such index.
</p>
<p>
The remarks for
<code class="literal">
utf8mb3
</code>
also apply to
<code class="literal">
utf8mb4
</code>
, and the remarks for
<code class="literal">
ucs2
</code>
also apply to
<code class="literal">
utf16
</code>
,
<code class="literal">
utf16le
</code>
, and
<code class="literal">
utf32
</code>
.
</p>
</li>
<li class="listitem">
<p>
Ideographic languages such as Chinese and Japanese do not
have word delimiters. Therefore, the built-in full-text
parser
<span class="emphasis">
<em>
cannot determine where words begin and end
in these and other such languages
</em>
</span>
.
</p>
<p>
A character-based ngram full-text parser that supports
Chinese, Japanese, and Korean (CJK), and a word-based MeCab
parser plugin that supports Japanese are provided for use
with
<code class="literal">
InnoDB
</code>
and
<code class="literal">
MyISAM
</code>
tables.
</p>
</li>
<li class="listitem">
<p>
Although the use of multiple character sets within a single
table is supported, all columns in a
<code class="literal">
FULLTEXT
</code>
index must use the same
character set and collation.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="fulltext-search.html#function_match">
<code class="literal">
MATCH()
</code>
</a>
column list must
match exactly the column list in some
<code class="literal">
FULLTEXT
</code>
index definition for the table,
unless this
<a class="link" href="fulltext-search.html#function_match">
<code class="literal">
MATCH()
</code>
</a>
is
<code class="literal">
IN BOOLEAN MODE
</code>
on a
<code class="literal">
MyISAM
</code>
table. For
<code class="literal">
MyISAM
</code>
tables, boolean-mode searches can
be done on nonindexed columns, although they are likely to
be slow.
</p>
</li>
<li class="listitem">
<p>
The argument to
<code class="literal">
AGAINST()
</code>
must be a
string value that is constant during query evaluation. This
rules out, for example, a table column because that can
differ for each row.
</p>
<p>
The argument to
<a class="link" href="fulltext-search.html#function_match">
<code class="literal">
MATCH()
</code>
</a>
cannot use a rollup column.
</p>
</li>
<li class="listitem">
<p>
Index hints are more limited for
<code class="literal">
FULLTEXT
</code>
searches than for non-
<code class="literal">
FULLTEXT
</code>
searches.
See
<a class="xref" href="index-hints.html" title="10.9.4 Index Hints">
Section 10.9.4, “Index Hints”
</a>
.
</p>
</li>
<li class="listitem">
<p>
For
<code class="literal">
InnoDB
</code>
, all DML operations
(
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
,
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
,
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
) involving columns
with full-text indexes are processed at transaction commit
time. For example, for an
<code class="literal">
INSERT
</code>
operation, an inserted string is tokenized and decomposed
into individual words. The individual words are then added
to full-text index tables when the transaction is committed.
As a result, full-text searches only return committed data.
</p>
</li>
<li class="listitem">
<p>
The '%' character is not a supported wildcard character for
full-text searches.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/programs-admin-utils.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="programs-admin-utils">
</a>
6.6 Administrative and Utility Programs
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<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>
</div>
<p>
This section describes administrative programs and programs that
perform miscellaneous utility operations.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-security.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="group-replication-security">
</a>
20.6 Group Replication Security
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<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>
</div>
<a class="indexterm" name="idm46045132646064">
</a>
<p>
This section explains how to secure a group, securing the
connections between members of a group, or by establishing a
security perimeter using an IP address allowlist.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/multiple-column-indexes.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="multiple-column-indexes">
</a>
10.3.6 Multiple-Column Indexes
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045227369536">
</a>
<a class="indexterm" name="idm46045227368464">
</a>
<a class="indexterm" name="idm46045227366976">
</a>
<p>
MySQL can create composite indexes (that is, indexes on multiple
columns). An index may consist of up to 16 columns. For certain
data types, you can index a prefix of the column (see
<a class="xref" href="column-indexes.html" title="10.3.5 Column Indexes">
Section 10.3.5, “Column Indexes”
</a>
).
</p>
<p>
MySQL can use multiple-column indexes for queries that test all
the columns in the index, or queries that test just the first
column, the first two columns, the first three columns, and so
on. If you specify the columns in the right order in the index
definition, a single composite index can speed up several kinds
of queries on the same table.
</p>
<p>
A multiple-column index can be considered a sorted array, the
rows of which contain values that are created by concatenating
the values of the indexed columns.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
As an alternative to a composite index, you can introduce a
column that is
<span class="quote">
“
<span class="quote">
hashed
</span>
”
</span>
based on information from
other columns. If this column is short, reasonably unique, and
indexed, it might be faster than a
<span class="quote">
“
<span class="quote">
wide
</span>
”
</span>
index
on many columns. In MySQL, it is very easy to use this extra
column:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa35762859"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em>
<span class="token keyword">WHERE</span> <em class="replaceable">hash_col</em><span class="token operator">=</span><span class="token function">MD5</span><span class="token punctuation">(</span><span class="token function">CONCAT</span><span class="token punctuation">(</span><em class="replaceable">val1</em><span class="token punctuation">,</span><em class="replaceable">val2</em><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token operator">AND</span> <em class="replaceable">col1</em><span class="token operator">=</span><em class="replaceable">val1</em> <span class="token operator">AND</span> <em class="replaceable">col2</em><span class="token operator">=</span><em class="replaceable">val2</em><span class="token punctuation">;</span></code></pre>
</div>
</div>
<p>
Suppose that a table has the following specification:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa43179551"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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> test <span class="token punctuation">(</span>
id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
last_name <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
first_name <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span>id<span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">INDEX</span> <span class="token keyword">name</span> <span class="token punctuation">(</span>last_name<span class="token punctuation">,</span>first_name<span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The
<code class="literal">
name
</code>
index is an index over the
<code class="literal">
last_name
</code>
and
<code class="literal">
first_name
</code>
columns. The index can be used for lookups in queries that
specify values in a known range for combinations of
<code class="literal">
last_name
</code>
and
<code class="literal">
first_name
</code>
values. It can also be used for queries that specify just a
<code class="literal">
last_name
</code>
value because that column is a
leftmost prefix of the index (as described later in this
section). Therefore, the
<code class="literal">
name
</code>
index is used
for lookups in the following queries:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa25230771"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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> test <span class="token keyword">WHERE</span> last_name<span class="token operator">=</span><span class="token string">'Jones'</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> test
<span class="token keyword">WHERE</span> last_name<span class="token operator">=</span><span class="token string">'Jones'</span> <span class="token operator">AND</span> first_name<span class="token operator">=</span><span class="token string">'John'</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> test
<span class="token keyword">WHERE</span> last_name<span class="token operator">=</span><span class="token string">'Jones'</span>
<span class="token operator">AND</span> <span class="token punctuation">(</span>first_name<span class="token operator">=</span><span class="token string">'John'</span> <span class="token operator">OR</span> first_name<span class="token operator">=</span><span class="token string">'Jon'</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> test
<span class="token keyword">WHERE</span> last_name<span class="token operator">=</span><span class="token string">'Jones'</span>
<span class="token operator">AND</span> first_name <span class="token operator">>=</span><span class="token string">'M'</span> <span class="token operator">AND</span> first_name <span class="token operator"><</span> <span class="token string">'N'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
However, the
<code class="literal">
name
</code>
index is
<span class="emphasis">
<em>
not
</em>
</span>
used for lookups in the following
queries:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa94625877"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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> test <span class="token keyword">WHERE</span> first_name<span class="token operator">=</span><span class="token string">'John'</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> test
<span class="token keyword">WHERE</span> last_name<span class="token operator">=</span><span class="token string">'Jones'</span> <span class="token operator">OR</span> first_name<span class="token operator">=</span><span class="token string">'John'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Suppose that you issue the following
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa91375606"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em>
<span class="token keyword">WHERE</span> col1<span class="token operator">=</span><em class="replaceable">val1</em> <span class="token operator">AND</span> col2<span class="token operator">=</span><em class="replaceable">val2</em><span class="token punctuation">;</span></code></pre>
</div>
<p>
If a multiple-column index exists on
<code class="literal">
col1
</code>
and
<code class="literal">
col2
</code>
, the appropriate rows can be fetched
directly. If separate single-column indexes exist on
<code class="literal">
col1
</code>
and
<code class="literal">
col2
</code>
, the
optimizer attempts to use the Index Merge optimization (see
<a class="xref" href="index-merge-optimization.html" title="10.2.1.3 Index Merge Optimization">
Section 10.2.1.3, “Index Merge Optimization”
</a>
), or attempts to find
the most restrictive index by deciding which index excludes more
rows and using that index to fetch the rows.
</p>
<a class="indexterm" name="idm46045227336528">
</a>
<a class="indexterm" name="idm46045227335040">
</a>
<p>
If the table has a multiple-column index, any leftmost prefix of
the index can be used by the optimizer to look up rows. For
example, if you have a three-column index on
<code class="literal">
(col1,
col2, col3)
</code>
, you have indexed search capabilities on
<code class="literal">
(col1)
</code>
,
<code class="literal">
(col1, col2)
</code>
, and
<code class="literal">
(col1, col2, col3)
</code>
.
</p>
<p>
MySQL cannot use the index to perform lookups if the columns do
not form a leftmost prefix of the index. Suppose that you have
the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa29841118"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em> <span class="token keyword">WHERE</span> col1<span class="token operator">=</span><em class="replaceable">val1</em><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em> <span class="token keyword">WHERE</span> col1<span class="token operator">=</span><em class="replaceable">val1</em> <span class="token operator">AND</span> col2<span class="token operator">=</span><em class="replaceable">val2</em><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em> <span class="token keyword">WHERE</span> col2<span class="token operator">=</span><em class="replaceable">val2</em><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em> <span class="token keyword">WHERE</span> col2<span class="token operator">=</span><em class="replaceable">val2</em> <span class="token operator">AND</span> col3<span class="token operator">=</span><em class="replaceable">val3</em><span class="token punctuation">;</span></code></pre>
</div>
<p>
If an index exists on
<code class="literal">
(col1, col2, col3)
</code>
,
only the first two queries use the index. The third and fourth
queries do involve indexed columns, but do not use an index to
perform lookups because
<code class="literal">
(col2)
</code>
and
<code class="literal">
(col2, col3)
</code>
are not leftmost prefixes of
<code class="literal">
(col1, col2, col3)
</code>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/nontransactional-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="nontransactional-tables">
</a>
B.3.4.5 Rollback Failure for Nontransactional Tables
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045053507504">
</a>
<p>
If you receive the following message when trying to perform a
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
ROLLBACK
</code>
</a>
, it
means that one or more of the tables you used in the
transaction do not support transactions:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa89662393"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">Warning: Some non-transactional changed tables couldn't be rolled back</code></pre>
</div>
<p>
These nontransactional tables are not affected by the
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
ROLLBACK
</code>
</a>
statement.
</p>
<p>
If you were not deliberately mixing transactional and
nontransactional tables within the transaction, the most
likely cause for this message is that a table you thought was
transactional actually is not. This can happen if you try to
create a table using a transactional storage engine that is
not supported by your
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server (or
that was disabled with a startup option). If
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
does not support a storage engine,
it instead creates the table as a
<code class="literal">
MyISAM
</code>
table, which is nontransactional.
</p>
<p>
You can check the storage engine for a table by using either
of these statements:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa33129858"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">TABLE</span> <span class="token keyword">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'<em class="replaceable">tbl_name</em>'</span><span class="token punctuation">;</span>
<span class="token keyword">SHOW</span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> <em class="replaceable">tbl_name</em><span class="token punctuation">;</span></code></pre>
</div>
<p>
See
<a class="xref" href="show-table-status.html" title="15.7.7.38 SHOW TABLE STATUS Statement">
Section 15.7.7.38, “SHOW TABLE STATUS Statement”
</a>
, and
<a class="xref" href="show-create-table.html" title="15.7.7.11 SHOW CREATE TABLE Statement">
Section 15.7.7.11, “SHOW CREATE TABLE Statement”
</a>
.
</p>
<p>
To check which storage engines your
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server supports, use this statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa10454031"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">ENGINES</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
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>
for full details.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/faqs-views.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="faqs-views">
</a>
A.6 MySQL 8.4 FAQ: Views
</h2>
</div>
</div>
</div>
<div class="qandaset">
<a name="idm46045056174800">
</a>
<dl>
<dt>
A.6.1.
<a href="faqs-views.html#faq-mysql-where-docs-views">
Where can I find documentation covering MySQL Views?
</a>
</dt>
<dt>
A.6.2.
<a href="faqs-views.html#faq-mysql-where-views-forum">
Is there a discussion forum for MySQL Views?
</a>
</dt>
<dt>
A.6.3.
<a href="faqs-views.html#faq-mysql-where-view-dropped-table">
What happens to a view if an underlying table is dropped or
renamed?
</a>
</dt>
<dt>
A.6.4.
<a href="faqs-views.html#faq-mysql-have-table-snapshots">
Does MySQL have table snapshots?
</a>
</dt>
<dt>
A.6.5.
<a href="faqs-views.html#faq-mysql-have-materialized-views">
Does MySQL have materialized views?
</a>
</dt>
<dt>
A.6.6.
<a href="faqs-views.html#faq-mysql-can-insert-joins-views">
Can you insert into views that are based on joins?
</a>
</dt>
</dl>
<table border="0" style="width: 100%;">
<colgroup>
<col align="left" width="1%"/>
<col/>
</colgroup>
<tbody>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-where-docs-views">
</a>
<a name="idm46045056174032">
</a>
<p>
<b>
A.6.1.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Where can I find documentation covering MySQL Views?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
See
<a class="xref" href="views.html" title="27.5 Using Views">
Section 27.5, “Using Views”
</a>
.
</p>
<p>
You may also find the
<a class="ulink" href="https://forums.mysql.com/list.php?20" target="_blank">
MySQL User Forums
</a>
to be helpful.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-where-views-forum">
</a>
<a name="idm46045056170080">
</a>
<p>
<b>
A.6.2.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Is there a discussion forum for MySQL Views?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
See the
<a class="ulink" href="https://forums.mysql.com/list.php?20" target="_blank">
MySQL User
Forums
</a>
.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-where-view-dropped-table">
</a>
<a name="idm46045056167296">
</a>
<p>
<b>
A.6.3.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
What happens to a view if an underlying table is dropped or
renamed?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
After a view has been created, it is possible to drop or alter a
table or view to which the definition refers. To check a view
definition for problems of this kind, use the
<a class="link" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
<code class="literal">
CHECK TABLE
</code>
</a>
statement. (See
<a class="xref" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
Section 15.7.3.2, “CHECK TABLE Statement”
</a>
.)
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-have-table-snapshots">
</a>
<a name="idm46045056163120">
</a>
<p>
<b>
A.6.4.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Does MySQL have table snapshots?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
No.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-have-materialized-views">
</a>
<a name="idm46045056161168">
</a>
<p>
<b>
A.6.5.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Does MySQL have materialized views?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
No.
</p>
</td>
</tr>
<tr class="question">
<td align="left" valign="top">
<a name="faq-mysql-can-insert-joins-views">
</a>
<a name="idm46045056159152">
</a>
<p>
<b>
A.6.6.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Can you insert into views that are based on joins?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
It is possible, provided that your
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statement has a column
list that makes it clear there is only one table involved.
</p>
<p>
You
<span class="emphasis">
<em>
cannot
</em>
</span>
insert into multiple tables with
a single insert on a view.
</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-shell-tutorial-python-collections-operations.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-shell-tutorial-python-collections-operations">
</a>
22.4.3.1 Create, List, and Drop Collections
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045127245216">
</a>
<p>
In MySQL Shell, you can create new collections, get a list of
the existing collections in a schema, and remove an existing
collection from a schema. Collection names are case-sensitive
and each collection name must be unique.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="idm46045127243040">
</a>
Confirm the Schema
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045127242368">
</a>
<p>
To show the value that is assigned to the schema variable,
issue:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-mysqlsh"><div class="docs-select-all right" id="sa51964250"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-py></span> db</code></pre>
</div>
<p>
If the schema value is not
<code class="literal">
Schema:world_x
</code>
,
then set the
<code class="literal">
db
</code>
variable by issuing:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-mysqlsh"><div class="docs-select-all right" id="sa32049510"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-py></span> \use world_x</code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="mysql-shell-tutorial-python-collections-create">
</a>
Create a Collection
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045127233952">
</a>
<p>
To create a new collection in an existing schema, use the
<code class="literal">
db
</code>
object's
<code class="literal">
createCollection()
</code>
method. The following
example creates a collection called
<code class="literal">
flags
</code>
in the
<code class="literal">
world_x
</code>
schema.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-mysqlsh"><div class="docs-select-all right" id="sa82186867"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-py></span> db<span class="token punctuation">.</span><span class="token function">create_collection</span><span class="token punctuation">(</span><span class="token string">"flags"</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
The method returns a collection object.
</p>
<pre class="screen"><Collection:flags></pre>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="mysql-shell-tutorial-python-collections-get">
</a>
List Collections
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045127224944">
</a>
<p>
To display all collections in the
<code class="literal">
world_x
</code>
schema, use the
<code class="literal">
db
</code>
object's
<code class="literal">
get_collections()
</code>
method. Collections
returned by the server you are currently connected to appear
between brackets.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-mysqlsh"><div class="docs-select-all right" id="sa13836416"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-py></span> db<span class="token punctuation">.</span><span class="token function">get_collections</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">[</span>
<span class="token operator"><</span>Collection<span class="token punctuation">:</span>countryinfo<span class="token operator">></span><span class="token punctuation">,</span>
<span class="token operator"><</span>Collection<span class="token punctuation">:</span>flags<span class="token operator">></span>
<span class="token punctuation">]</span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="mysql-shell-tutorial-python-collections-drop">
</a>
Drop a Collection
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045127217648">
</a>
<p>
To drop an existing collection from a schema, use the
<code class="literal">
db
</code>
object's
<code class="literal">
drop_collection()
</code>
method. For example, to
drop the
<code class="literal">
flags
</code>
collection from the current
schema, issue:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-mysqlsh"><div class="docs-select-all right" id="sa38089652"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-py></span> db<span class="token punctuation">.</span><span class="token function">drop_collection</span><span class="token punctuation">(</span><span class="token string">"flags"</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
The
<code class="literal">
drop_collection()
</code>
method is also used
in MySQL Shell to drop a relational table from a schema.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="idm46045127210512">
</a>
Related Information
</h5>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
See
<a class="ulink" href="/doc/x-devapi-userguide/en/collection-objects.html" target="_top">
Collection Objects
</a>
for more
examples.
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-setup-threads-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-setup-threads-table">
</a>
29.12.2.5 The setup_threads Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045073677184">
</a>
<a class="indexterm" name="idm46045073675696">
</a>
<p>
The
<a class="link" href="performance-schema-setup-threads-table.html" title="29.12.2.5 The setup_threads Table">
<code class="literal">
setup_threads
</code>
</a>
table lists
instrumented thread classes. It exposes thread class names and
attributes:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18186981"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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_threads\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
NAME<span class="token punctuation">:</span> thread/performance_schema/setup
ENABLED<span class="token punctuation">:</span> YES
HISTORY<span class="token punctuation">:</span> YES
PROPERTIES<span class="token punctuation">:</span> singleton
VOLATILITY<span class="token punctuation">:</span> 0
DOCUMENTATION<span class="token punctuation">:</span> NULL
...
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 4. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
NAME<span class="token punctuation">:</span> thread/sql/main
ENABLED<span class="token punctuation">:</span> YES
HISTORY<span class="token punctuation">:</span> YES
PROPERTIES<span class="token punctuation">:</span> singleton
VOLATILITY<span class="token punctuation">:</span> 0
DOCUMENTATION<span class="token punctuation">:</span> NULL
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 5. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
NAME<span class="token punctuation">:</span> thread/sql/one_connection
ENABLED<span class="token punctuation">:</span> YES
HISTORY<span class="token punctuation">:</span> YES
PROPERTIES<span class="token punctuation">:</span> user
VOLATILITY<span class="token punctuation">:</span> 0
DOCUMENTATION<span class="token punctuation">:</span> NULL
...
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 10. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
NAME<span class="token punctuation">:</span> thread/sql/event_scheduler
ENABLED<span class="token punctuation">:</span> YES
HISTORY<span class="token punctuation">:</span> YES
PROPERTIES<span class="token punctuation">:</span> singleton
VOLATILITY<span class="token punctuation">:</span> 0
DOCUMENTATION<span class="token punctuation">:</span> NULL</span></code></pre>
</div>
<p>
The
<a class="link" href="performance-schema-setup-threads-table.html" title="29.12.2.5 The setup_threads Table">
<code class="literal">
setup_threads
</code>
</a>
table has these
columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
NAME
</code>
</p>
<p>
The instrument name. Thread instruments begin with
<code class="literal">
thread
</code>
(for example,
<code class="literal">
thread/sql/parser_service
</code>
or
<code class="literal">
thread/performance_schema/setup
</code>
).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ENABLED
</code>
</p>
<p>
Whether the instrument is enabled. The value is
<code class="literal">
YES
</code>
or
<code class="literal">
NO
</code>
. This
column can be modified, although setting
<code class="literal">
ENABLED
</code>
has no effect for threads that
are already running.
</p>
<p>
For background threads, setting the
<code class="literal">
ENABLED
</code>
value controls whether
<code class="literal">
INSTRUMENTED
</code>
is set to
<code class="literal">
YES
</code>
or
<code class="literal">
NO
</code>
for
threads that are subsequently created for this instrument
and listed in the
<a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
<code class="literal">
threads
</code>
</a>
table. For foreground threads, this column has no effect;
the
<a class="link" href="performance-schema-setup-actors-table.html" title="29.12.2.1 The setup_actors Table">
<code class="literal">
setup_actors
</code>
</a>
table takes
precedence.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
HISTORY
</code>
</p>
<p>
Whether to log historical events for the instrument. The
value is
<code class="literal">
YES
</code>
or
<code class="literal">
NO
</code>
.
This column can be modified, although setting
<code class="literal">
HISTORY
</code>
has no effect for threads that
are already running.
</p>
<p>
For background threads, setting the
<code class="literal">
HISTORY
</code>
value controls whether
<code class="literal">
HISTORY
</code>
is set to
<code class="literal">
YES
</code>
or
<code class="literal">
NO
</code>
for
threads that are subsequently created for this instrument
and listed in the
<a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
<code class="literal">
threads
</code>
</a>
table. For foreground threads, this column has no effect;
the
<a class="link" href="performance-schema-setup-actors-table.html" title="29.12.2.1 The setup_actors Table">
<code class="literal">
setup_actors
</code>
</a>
table takes
precedence.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PROPERTIES
</code>
</p>
<p>
The instrument properties. This column uses the
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
data type, so multiple
flags from the following list can be set per instrument:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
singleton
</code>
: The instrument has a
single instance. For example, there is only one thread
for the
<code class="literal">
thread/sql/main
</code>
instrument.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
user
</code>
: The instrument is directly
related to user workload (as opposed to system
workload). For example, threads such as
<code class="literal">
thread/sql/one_connection
</code>
executing
a user session have the
<code class="literal">
user
</code>
property to differentiate them from system threads.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
VOLATILITY
</code>
</p>
<p>
The instrument volatility. This column has the same
meaning as 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. See
<a class="xref" href="performance-schema-setup-instruments-table.html" title="29.12.2.3 The setup_instruments Table">
Section 29.12.2.3, “The setup_instruments Table”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DOCUMENTATION
</code>
</p>
<p>
A string describing the instrument purpose. The value is
<code class="literal">
NULL
</code>
if no description is available.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-setup-threads-table.html" title="29.12.2.5 The setup_threads Table">
<code class="literal">
setup_threads
</code>
</a>
table has these
indexes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
NAME
</code>
)
</p>
</li>
</ul>
</div>
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
is not permitted
for the
<a class="link" href="performance-schema-setup-threads-table.html" title="29.12.2.5 The setup_threads Table">
<code class="literal">
setup_threads
</code>
</a>
table.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-features-transactions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-features-transactions">
</a>
19.5.1.35 Replication and Transactions
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045134952496">
</a>
<a class="indexterm" name="idm46045134951008">
</a>
<p>
<b>
Mixing transactional and nontransactional statements within the same
transaction.
</b>
In general, you should avoid transactions that update both
transactional and nontransactional tables in a replication
environment. You should also avoid using any statement that
accesses both transactional (or temporary) and
nontransactional tables and writes to any of them.
</p>
<p>
The server uses these rules for binary logging:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the initial statements in a transaction are
nontransactional, they are written to the binary log
immediately. The remaining statements in the transaction are
cached and not written to the binary log until the
transaction is committed. (If the transaction is rolled
back, the cached statements are written to the binary log
only if they make nontransactional changes that cannot be
rolled back. Otherwise, they are discarded.)
</p>
</li>
<li class="listitem">
<p>
For statement-based logging, logging of nontransactional
statements is affected by the
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_direct_non_transactional_updates">
<code class="literal">
binlog_direct_non_transactional_updates
</code>
</a>
system variable. When this variable is
<code class="literal">
OFF
</code>
(the default), logging is as just
described. When this variable is
<code class="literal">
ON
</code>
,
logging occurs immediately for nontransactional statements
occurring anywhere in the transaction (not just initial
nontransactional statements). Other statements are kept in
the transaction cache and logged when the transaction
commits.
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_direct_non_transactional_updates">
<code class="literal">
binlog_direct_non_transactional_updates
</code>
</a>
has no effect for row-format or mixed-format binary logging.
</p>
</li>
</ul>
</div>
<p>
<a name="replication-features-transactions-trx-nontrx-mixed">
</a>
<b>
Transactional, nontransactional, and mixed statements.
</b>
<a class="indexterm" name="idm46045134939168">
</a>
To apply those rules, the server considers a statement
nontransactional if it changes only nontransactional tables,
and transactional if it changes only transactional tables. A
statement that references both nontransactional and
transactional tables and updates
<span class="emphasis">
<em>
any
</em>
</span>
of
the tables involved is considered a
<span class="quote">
“
<span class="quote">
mixed
</span>
”
</span>
statement. Mixed statements, like transactional statements,
are cached and logged when the transaction commits.
</p>
<p>
A mixed statement that updates a transactional table is
considered unsafe if the statement also performs either of the
following actions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Updates or reads a temporary table
</p>
</li>
<li class="listitem">
<p>
Reads a nontransactional table and the transaction isolation
level is less than REPEATABLE_READ
</p>
</li>
</ul>
</div>
<p>
A mixed statement following the update of a transactional table
within a transaction is considered unsafe if it performs either
of the following actions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Updates any table and reads from any temporary table
</p>
</li>
<li class="listitem">
<p>
Updates a nontransactional table and
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_direct_non_transactional_updates">
<code class="literal">
binlog_direct_non_transactional_updates
</code>
</a>
is OFF
</p>
</li>
</ul>
</div>
<p>
For more information, see
<a class="xref" href="replication-rbr-safe-unsafe.html" title="19.2.1.3 Determination of Safe and Unsafe Statements in Binary Logging">
Section 19.2.1.3, “Determination of Safe and Unsafe Statements in Binary Logging”
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
A mixed statement is unrelated to mixed binary logging format.
</p>
</div>
<p>
In situations where transactions mix updates to transactional
and nontransactional tables, the order of statements in the
binary log is correct, and all needed statements are written to
the binary log even in case of a
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
ROLLBACK
</code>
</a>
.
However, when a second connection updates the nontransactional
table before the first connection transaction is complete,
statements can be logged out of order because the second
connection update is written immediately after it is performed,
regardless of the state of the transaction being performed by
the first connection.
</p>
<p>
<b>
Using different storage engines on source and replica.
</b>
It is possible to replicate transactional tables on the source
using nontransactional tables on the replica. For example, you
can replicate an
<code class="literal">
InnoDB
</code>
source table as a
<code class="literal">
MyISAM
</code>
replica table. However, if you do
this, there are problems if the replica is stopped in the
middle of a
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
BEGIN
</code>
</a>
...
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
COMMIT
</code>
</a>
block because the
replica restarts at the beginning of the
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
BEGIN
</code>
</a>
block.
</p>
<p>
It is also safe to replicate transactions from
<a class="link" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
<code class="literal">
MyISAM
</code>
</a>
tables on the source to
transactional tables, such as tables that use the
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
storage engine, on the
replica. In such cases, an
<a class="link" href="server-system-variables.html#sysvar_autocommit">
<code class="literal">
AUTOCOMMIT=1
</code>
</a>
statement issued
on the source is replicated, thus enforcing
<code class="literal">
AUTOCOMMIT
</code>
mode on the replica.
</p>
<p>
When the storage engine type of the replica is nontransactional,
transactions on the source that mix updates of transactional and
nontransactional tables should be avoided because they can cause
inconsistency of the data between the source transactional table
and the replica nontransactional table. That is, such
transactions can lead to source storage engine-specific behavior
with the possible effect of replication going out of synchrony.
MySQL does not issue a warning about this, so extra care should
be taken when replicating transactional tables from the source
to nontransactional tables on the replicas.
</p>
<p>
<b>
Changing the binary logging format within transactions.
</b>
The
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
<code class="literal">
binlog_format
</code>
</a>
and
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_checksum">
<code class="literal">
binlog_checksum
</code>
</a>
system
variables are read-only as long as a transaction is in
progress.
</p>
<p>
Every transaction (including
<a class="link" href="server-system-variables.html#sysvar_autocommit">
<code class="literal">
autocommit
</code>
</a>
transactions) is
recorded in the binary log as though it starts with a
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
BEGIN
</code>
</a>
statement, and ends with either a
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
COMMIT
</code>
</a>
or a
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
ROLLBACK
</code>
</a>
statement. This is even true for statements affecting tables
that use a nontransactional storage engine (such as
<a class="link" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
<code class="literal">
MyISAM
</code>
</a>
).
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
For restrictions that apply specifically to XA transactions,
see
<a class="xref" href="xa-restrictions.html" title="15.3.8.3 Restrictions on XA Transactions">
Section 15.3.8.3, “Restrictions on XA Transactions”
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/midpoint-insertion.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="midpoint-insertion">
</a>
10.10.2.3 Midpoint Insertion Strategy
</h4>
</div>
</div>
</div>
<p>
By default, the key cache management system uses a simple LRU
strategy for choosing key cache blocks to be evicted, but it
also supports a more sophisticated method called the
<span class="firstterm">
midpoint insertion
strategy.
</span>
</p>
<p>
When using the midpoint insertion strategy, the LRU chain is
divided into two parts: a hot sublist and a warm sublist. The
division point between two parts is not fixed, but the key
cache management system takes care that the warm part is not
<span class="quote">
“
<span class="quote">
too short,
</span>
”
</span>
always containing at least
<a class="link" href="server-system-variables.html#sysvar_key_cache_division_limit">
<code class="literal">
key_cache_division_limit
</code>
</a>
percent of the key cache blocks.
<a class="link" href="server-system-variables.html#sysvar_key_cache_division_limit">
<code class="literal">
key_cache_division_limit
</code>
</a>
is a
component of structured key cache variables, so its value is a
parameter that can be set per cache.
</p>
<p>
When an index block is read from a table into the key cache,
it is placed at the end of the warm sublist. After a certain
number of hits (accesses of the block), it is promoted to the
hot sublist. At present, the number of hits required to
promote a block (3) is the same for all index blocks.
</p>
<p>
A block promoted into the hot sublist is placed at the end of
the list. The block then circulates within this sublist. If
the block stays at the beginning of the sublist for a long
enough time, it is demoted to the warm sublist. This time is
determined by the value of the
<a class="link" href="server-system-variables.html#sysvar_key_cache_age_threshold">
<code class="literal">
key_cache_age_threshold
</code>
</a>
component of the key cache.
</p>
<p>
The threshold value prescribes that, for a key cache
containing
<em class="replaceable">
<code>
N
</code>
</em>
blocks, the block at
the beginning of the hot sublist not accessed within the last
<code class="literal">
<em class="replaceable">
<code>
N
</code>
</em>
*
key_cache_age_threshold / 100
</code>
hits is to be moved to
the beginning of the warm sublist. It then becomes the first
candidate for eviction, because blocks for replacement always
are taken from the beginning of the warm sublist.
</p>
<p>
The midpoint insertion strategy enables you to keep
more-valued blocks always in the cache. If you prefer to use
the plain LRU strategy, leave the
<a class="link" href="server-system-variables.html#sysvar_key_cache_division_limit">
<code class="literal">
key_cache_division_limit
</code>
</a>
value set to its default of 100.
</p>
<p>
The midpoint insertion strategy helps to improve performance
when execution of a query that requires an index scan
effectively pushes out of the cache all the index blocks
corresponding to valuable high-level B-tree nodes. To avoid
this, you must use a midpoint insertion strategy with the
<a class="link" href="server-system-variables.html#sysvar_key_cache_division_limit">
<code class="literal">
key_cache_division_limit
</code>
</a>
set
to much less than 100. Then valuable frequently hit nodes are
preserved in the hot sublist during an index scan operation as
well.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-ps-setup-show-enabled.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-ps-setup-show-enabled">
</a>
30.4.4.18 The ps_setup_show_enabled() Procedure
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045061340656">
</a>
<a class="indexterm" name="idm46045061339152">
</a>
<p>
Displays all currently enabled Performance Schema
configuration.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-ps-setup-show-enabled-parameters">
</a>
Parameters
</h5>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
in_show_instruments BOOLEAN
</code>
: Whether
to display enabled instruments. This might be a long
list.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
in_show_threads BOOLEAN
</code>
: Whether to
display enabled 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-enabled-example">
</a>
Example
</h5>
</div>
</div>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa62133192"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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_enabled<span class="token punctuation">(</span><span class="token boolean">FALSE</span><span class="token punctuation">,</span> <span class="token boolean">FALSE</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">1 row in set (0.01 sec)</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<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">1 row in set (0.01 sec)</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<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>
<span class="token output"><span class="token punctuation">|</span> EVENT <span class="token punctuation">|</span> %.% <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> FUNCTION <span class="token punctuation">|</span> %.% <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> PROCEDURE <span class="token punctuation">|</span> %.% <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> TABLE <span class="token punctuation">|</span> %.% <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> TRIGGER <span class="token punctuation">|</span> %.% <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">5 rows in set (0.02 sec)</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> enabled_consumers <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> events_statements_current <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_statements_history <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_transactions_current <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> events_transactions_history <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> global_instrumentation <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> statements_digest <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> thread_instrumentation <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-limitations-transactions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-limitations-transactions">
</a>
25.2.7.3 Limits Relating to Transaction Handling in NDB Cluster
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045123450400">
</a>
<p>
A number of limitations exist in NDB Cluster with regard to the
handling of transactions. These include the following:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<b>
Transaction isolation level.
</b>
<a class="indexterm" name="idm46045123446960">
</a>
<a class="indexterm" name="idm46045123445456">
</a>
<a class="indexterm" name="idm46045123443952">
</a>
The
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDBCLUSTER
</code>
</a>
storage engine
supports only the
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_read-committed">
<code class="literal">
READ
COMMITTED
</code>
</a>
transaction isolation level.
(
<code class="literal">
InnoDB
</code>
, for example, supports
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_read-committed">
<code class="literal">
READ COMMITTED
</code>
</a>
,
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_read-uncommitted">
<code class="literal">
READ UNCOMMITTED
</code>
</a>
,
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_repeatable-read">
<code class="literal">
REPEATABLE READ
</code>
</a>
, and
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_serializable">
<code class="literal">
SERIALIZABLE
</code>
</a>
.) You
should keep in mind that
<code class="literal">
NDB
</code>
implements
<code class="literal">
READ COMMITTED
</code>
on a per-row basis; when
a read request arrives at the data node storing the row,
what is returned is the last committed version of the row
at that time.
</p>
<p>
Uncommitted data is never returned, but when a transaction
modifying a number of rows commits concurrently with a
transaction reading the same rows, the transaction
performing the read can observe
<span class="quote">
“
<span class="quote">
before
</span>
”
</span>
values,
<span class="quote">
“
<span class="quote">
after
</span>
”
</span>
values, or both, for different
rows among these, due to the fact that a given row read
request can be processed either before or after the commit
of the other transaction.
</p>
<p>
To ensure that a given transaction reads only before or
after values, you can impose row locks using
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT ... LOCK IN
SHARE MODE
</code>
</a>
. In such cases, the lock is held until
the owning transaction is committed. Using row locks can
also cause the following issues:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Increased frequency of lock wait timeout errors, and
reduced concurrency
</p>
</li>
<li class="listitem">
<p>
Increased transaction processing overhead due to reads
requiring a commit phase
</p>
</li>
<li class="listitem">
<p>
Possibility of exhausting the available number of
concurrent locks, which is limited by
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrentoperations">
<code class="literal">
MaxNoOfConcurrentOperations
</code>
</a>
</p>
</li>
</ul>
</div>
<p>
<code class="literal">
NDB
</code>
uses
<code class="literal">
READ
COMMITTED
</code>
for all reads unless a modifier such as
<code class="literal">
LOCK IN SHARE MODE
</code>
or
<code class="literal">
FOR
UPDATE
</code>
is used.
<code class="literal">
LOCK IN SHARE
MODE
</code>
causes shared row locks to be used;
<code class="literal">
FOR UPDATE
</code>
causes exclusive row locks to
be used. Unique key reads have their locks upgraded
automatically by
<code class="literal">
NDB
</code>
to ensure a
self-consistent read;
<code class="literal">
BLOB
</code>
reads also
employ extra locking for consistency.
</p>
<p>
See
<a class="xref" href="mysql-cluster-backup-troubleshooting.html" title="25.6.8.4 NDB Cluster Backup Troubleshooting">
Section 25.6.8.4, “NDB Cluster Backup Troubleshooting”
</a>
,
for information on how NDB Cluster's implementation of
transaction isolation level can affect backup and
restoration of
<code class="literal">
NDB
</code>
databases.
</p>
</li>
<li class="listitem">
<p>
<b>
Transactions and BLOB or TEXT columns.
</b>
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDBCLUSTER
</code>
</a>
stores only part
of a column value that uses any of MySQL's
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
data types in the
table visible to MySQL; the remainder of the
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
is stored in a
separate internal table that is not accessible to MySQL.
This gives rise to two related issues of which you should
be aware whenever executing
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements on tables
that contain columns of these types:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
For any
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
from an
NDB Cluster table: If the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
includes a
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
column, the
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_read-committed">
<code class="literal">
READ COMMITTED
</code>
</a>
transaction isolation level is converted to a read with
read lock. This is done to guarantee consistency.
</p>
</li>
<li class="listitem">
<p>
For any
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
which uses
a unique key lookup to retrieve any columns that use any
of the
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
data types and that
is executed within a transaction, a shared read lock is
held on the table for the duration of the
transaction—that is, until the transaction is
either committed or aborted.
</p>
<p>
This issue does not occur for queries that use index or
table scans, even against
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables having
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
columns.
</p>
<p>
For example, consider the table
<code class="literal">
t
</code>
defined by the following
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE
TABLE
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa10347648"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t <span class="token punctuation">(</span>
a <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">AUTO_INCREMENT</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">,</span>
b <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
c <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
d <span class="token datatype">TEXT</span><span class="token punctuation">,</span>
<span class="token keyword">INDEX</span> i<span class="token punctuation">(</span>b<span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">UNIQUE</span> <span class="token keyword">KEY</span> u<span class="token punctuation">(</span>c<span class="token punctuation">)</span>
<span class="token punctuation">)</span> <span class="token keyword">ENGINE</span> <span class="token operator">=</span> <span class="token keyword">NDB</span><span class="token punctuation">,</span></code></pre>
</div>
<p>
The following query on
<code class="literal">
t
</code>
causes a
shared read lock, because it uses a unique key lookup:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa58830699"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t <span class="token keyword">WHERE</span> c <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
However, none of the four queries shown here causes a
shared read lock:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa51658560"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t <span class="token keyword">WHERE</span> b <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t <span class="token keyword">WHERE</span> d <span class="token operator">=</span> <span class="token string">'1'</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 punctuation">;</span>
<span class="token keyword">SELECT</span> b<span class="token punctuation">,</span>c <span class="token keyword">WHERE</span> a <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
This is because, of these four queries, the first uses
an index scan, the second and third use table scans, and
the fourth, while using a primary key lookup, does not
retrieve the value of any
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
columns.
</p>
<p>
You can help minimize issues with shared read locks by
avoiding queries that use unique key lookups that
retrieve
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
columns, or, in
cases where such queries are not avoidable, by
committing transactions as soon as possible afterward.
</p>
</li>
</ol>
</div>
</li>
<li class="listitem">
<p>
<b>
Unique key lookups and transaction isolation.
</b>
Unique indexes are implemented in
<code class="literal">
NDB
</code>
using a hidden index table which is maintained internally.
When a user-created
<code class="literal">
NDB
</code>
table is
accessed using a unique index, the hidden index table is
first read to find the primary key that is then used to
read the user-created table. To avoid modification of the
index during this double-read operation, the row found in
the hidden index table is locked. When a row referenced by
a unique index in the user-created
<code class="literal">
NDB
</code>
table is updated, the hidden index table is subject to an
exclusive lock by the transaction in which the update is
performed. This means that any read operation on the same
(user-created)
<code class="literal">
NDB
</code>
table must wait for
the update to complete. This is true even when the
transaction level of the read operation is
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_read-committed">
<code class="literal">
READ COMMITTED
</code>
</a>
.
</p>
<p>
One workaround which can be used to bypass potentially
blocking reads is to force the SQL node to ignore the unique
index when performing the read. This can be done by using
the
<code class="literal">
IGNORE INDEX
</code>
index hint as part of
the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement reading
the table (see
<a class="xref" href="index-hints.html" title="10.9.4 Index Hints">
Section 10.9.4, “Index Hints”
</a>
). Because the
MySQL server creates a shadowing ordered index for every
unique index created in
<code class="literal">
NDB
</code>
, this lets
the ordered index be read instead, and avoids unique index
access locking. The resulting read is as consistent as a
committed read by primary key, returning the last committed
value at the time the row is read.
</p>
<p>
Reading via an ordered index makes less efficient use of
resources in the cluster, and may have higher latency.
</p>
<p>
It is also possible to avoid using the unique index for
access by querying for ranges rather than for unique values.
</p>
</li>
<li class="listitem">
<p>
<b>
Rollbacks.
</b>
There are no partial transactions, and no partial
rollbacks of transactions. A duplicate key or similar
error causes the entire transaction to be rolled back.
</p>
<p>
This behavior differs from that of other transactional
storage engines such as
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
that may roll back individual statements.
</p>
</li>
<li class="listitem">
<p>
<b>
Transactions and memory usage.
</b>
<a class="indexterm" name="idm46045123358624">
</a>
<a class="indexterm" name="idm46045123357120">
</a>
As noted elsewhere in this chapter, NDB Cluster does not
handle large transactions well; it is better to perform a
number of small transactions with a few operations each
than to attempt a single large transaction containing a
great many operations. Among other considerations, large
transactions require very large amounts of memory. Because
of this, the transactional behavior of a number of MySQL
statements is affected as described in the following list:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
is not
transactional when used on
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables. If a
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
fails to
empty the table, then it must be re-run until it is
successful.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DELETE FROM
</code>
(even with no
<code class="literal">
WHERE
</code>
clause)
<span class="emphasis">
<em>
is
</em>
</span>
transactional. For tables containing a great many rows,
you may find that performance is improved by using
several
<code class="literal">
DELETE FROM ... LIMIT ...
</code>
statements to
<span class="quote">
“
<span class="quote">
chunk
</span>
”
</span>
the delete operation.
If your objective is to empty the table, then you may
wish to use
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE
TABLE
</code>
</a>
instead.
</p>
</li>
<li class="listitem">
<p>
<b>
LOAD DATA statements.
</b>
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
is not
transactional when used on
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
When executing a
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD
DATA
</code>
</a>
statement, the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
engine performs
commits at irregular intervals that enable better
utilization of the communication network. It is not
possible to know ahead of time when such commits take
place.
</p>
</div>
</li>
<li class="listitem">
<p>
<b>
ALTER TABLE and transactions.
</b>
When copying an
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table
as part of an
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
, the creation of the copy is
nontransactional. (In any case, this operation is
rolled back when the copy is deleted.)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<b>
Transactions and the COUNT() function.
</b>
When using NDB Cluster Replication, it is not possible to
guarantee the transactional consistency of the
<a class="link" href="aggregate-functions.html#function_count">
<code class="literal">
COUNT()
</code>
</a>
function on the
replica. In other words, when performing on the source a
series of statements
(
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
,
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
, or both) that
changes the number of rows in a table within a single
transaction, executing
<code class="literal">
SELECT COUNT(*) FROM
<em class="replaceable">
<code>
table
</code>
</em>
</code>
queries on the
replica may yield intermediate results. This is due to the
fact that
<code class="literal">
SELECT COUNT(...)
</code>
may perform
dirty reads, and is not a bug in the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage engine. (See Bug
#31321 for more information.)
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/x-plugin-status-variables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="x-plugin-status-variables">
</a>
22.5.6.3 X Plugin Status Variables
</h4>
</div>
</div>
</div>
<p>
The X Plugin status variables have the following meanings.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="statvar_Mysqlx_aborted_clients">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_aborted_clients">
<code class="literal">
Mysqlx_aborted_clients
</code>
</a>
</p>
<p>
The number of clients that were disconnected because of an
input or output error.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_address">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_address">
<code class="literal">
Mysqlx_address
</code>
</a>
</p>
<p>
The network address or addresses for which X Plugin accepts
TCP/IP connections. If multiple addresses were specified
using the
<a class="link" href="x-plugin-options-system-variables.html#sysvar_mysqlx_bind_address">
<code class="literal">
mysqlx_bind_address
</code>
</a>
system
variable,
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_address">
<code class="literal">
Mysqlx_address
</code>
</a>
displays only those addresses for which the bind succeeded.
If the bind has failed for every network address specified
by
<a class="link" href="x-plugin-options-system-variables.html#sysvar_mysqlx_bind_address">
<code class="literal">
mysqlx_bind_address
</code>
</a>
, or
if the
<a class="link" href="server-system-variables.html#sysvar_skip_networking">
<code class="literal">
skip_networking
</code>
</a>
option has been used, the value of
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_address">
<code class="literal">
Mysqlx_address
</code>
</a>
is
<code class="literal">
UNDEFINED
</code>
. If X Plugin startup is not
yet complete, the value of
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_address">
<code class="literal">
Mysqlx_address
</code>
</a>
is empty.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_bytes_received">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_bytes_received">
<code class="literal">
Mysqlx_bytes_received
</code>
</a>
</p>
<p>
The total number of bytes received through the network. If
compression is used for the connection, this figure
comprises compressed message payloads measured before
decompression
(
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_bytes_received_compressed_payload">
<code class="literal">
Mysqlx_bytes_received_compressed_payload
</code>
</a>
),
any items in compressed messages that were not compressed
such as X Protocol headers, and any uncompressed messages.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_bytes_received_compressed_payload">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_bytes_received_compressed_payload">
<code class="literal">
Mysqlx_bytes_received_compressed_payload
</code>
</a>
</p>
<p>
The number of bytes received as compressed message payloads,
measured before decompression.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_bytes_received_uncompressed_frame">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_bytes_received_uncompressed_frame">
<code class="literal">
Mysqlx_bytes_received_uncompressed_frame
</code>
</a>
</p>
<p>
The number of bytes received as compressed message payloads,
measured after decompression.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_bytes_sent">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_bytes_sent">
<code class="literal">
Mysqlx_bytes_sent
</code>
</a>
</p>
<p>
The total number of bytes sent through the network. If
compression is used for the connection, this figure
comprises compressed message payloads measured after
compression
(
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_bytes_sent_compressed_payload">
<code class="literal">
Mysqlx_bytes_sent_compressed_payload
</code>
</a>
),
any items in compressed messages that were not compressed
such as X Protocol headers, and any uncompressed messages.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_bytes_sent_compressed_payload">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_bytes_sent_compressed_payload">
<code class="literal">
Mysqlx_bytes_sent_compressed_payload
</code>
</a>
</p>
<p>
The number of bytes sent as compressed message payloads,
measured after compression.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_bytes_sent_uncompressed_frame">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_bytes_sent_uncompressed_frame">
<code class="literal">
Mysqlx_bytes_sent_uncompressed_frame
</code>
</a>
</p>
<p>
The number of bytes sent as compressed message payloads,
measured before compression.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_compression_algorithm">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_compression_algorithm">
<code class="literal">
Mysqlx_compression_algorithm
</code>
</a>
</p>
<p>
(Session scope) The compression algorithm in use for the
X Protocol connection for this session. The permitted
compression algorithms are listed by the
<a class="link" href="x-plugin-options-system-variables.html#sysvar_mysqlx_compression_algorithms">
<code class="literal">
mysqlx_compression_algorithms
</code>
</a>
system variable.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_compression_level">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_compression_level">
<code class="literal">
Mysqlx_compression_level
</code>
</a>
</p>
<p>
(Session scope) The compression level in use for the
X Protocol connection for this session.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_connection_accept_errors">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_connection_accept_errors">
<code class="literal">
Mysqlx_connection_accept_errors
</code>
</a>
</p>
<p>
The number of connections which have caused accept errors.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_connection_errors">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_connection_errors">
<code class="literal">
Mysqlx_connection_errors
</code>
</a>
</p>
<p>
The number of connections which have caused errors.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_connections_accepted">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_connections_accepted">
<code class="literal">
Mysqlx_connections_accepted
</code>
</a>
</p>
<p>
The number of connections which have been accepted.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_connections_closed">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_connections_closed">
<code class="literal">
Mysqlx_connections_closed
</code>
</a>
</p>
<p>
The number of connections which have been closed.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_connections_rejected">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_connections_rejected">
<code class="literal">
Mysqlx_connections_rejected
</code>
</a>
</p>
<p>
The number of connections which have been rejected.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_crud_create_view">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_crud_create_view">
<code class="literal">
Mysqlx_crud_create_view
</code>
</a>
</p>
<p>
The number of create view requests received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_crud_delete">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_crud_delete">
<code class="literal">
Mysqlx_crud_delete
</code>
</a>
</p>
<p>
The number of delete requests received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_crud_drop_view">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_crud_drop_view">
<code class="literal">
Mysqlx_crud_drop_view
</code>
</a>
</p>
<p>
The number of drop view requests received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_crud_find">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_crud_find">
<code class="literal">
Mysqlx_crud_find
</code>
</a>
</p>
<p>
The number of find requests received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_crud_insert">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_crud_insert">
<code class="literal">
Mysqlx_crud_insert
</code>
</a>
</p>
<p>
The number of insert requests received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_crud_modify_view">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_crud_modify_view">
<code class="literal">
Mysqlx_crud_modify_view
</code>
</a>
</p>
<p>
The number of modify view requests received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_crud_update">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_crud_update">
<code class="literal">
Mysqlx_crud_update
</code>
</a>
</p>
<p>
The number of update requests received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_cursor_close">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_cursor_close">
<code class="literal">
Mysqlx_cursor_close
</code>
</a>
</p>
<p>
The number of cursor-close messages received
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_cursor_fetch">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_cursor_fetch">
<code class="literal">
Mysqlx_cursor_fetch
</code>
</a>
</p>
<p>
The number of cursor-fetch messages received
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_cursor_open">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_cursor_open">
<code class="literal">
Mysqlx_cursor_open
</code>
</a>
</p>
<p>
The number of cursor-open messages received
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_errors_sent">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_errors_sent">
<code class="literal">
Mysqlx_errors_sent
</code>
</a>
</p>
<p>
The number of errors sent to clients.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_errors_unknown_message_type">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_errors_unknown_message_type">
<code class="literal">
Mysqlx_errors_unknown_message_type
</code>
</a>
</p>
<p>
The number of unknown message types that have been received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_expect_close">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_expect_close">
<code class="literal">
Mysqlx_expect_close
</code>
</a>
</p>
<p>
The number of expectation blocks closed.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_expect_open">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_expect_open">
<code class="literal">
Mysqlx_expect_open
</code>
</a>
</p>
<p>
The number of expectation blocks opened.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_init_error">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_init_error">
<code class="literal">
Mysqlx_init_error
</code>
</a>
</p>
<p>
The number of errors during initialisation.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_messages_sent">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_messages_sent">
<code class="literal">
Mysqlx_messages_sent
</code>
</a>
</p>
<p>
The total number of messages of all types sent to clients.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_notice_global_sent">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_notice_global_sent">
<code class="literal">
Mysqlx_notice_global_sent
</code>
</a>
</p>
<p>
The number of global notifications sent to clients.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_notice_other_sent">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_notice_other_sent">
<code class="literal">
Mysqlx_notice_other_sent
</code>
</a>
</p>
<p>
The number of other types of notices sent back to clients.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_notice_warning_sent">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_notice_warning_sent">
<code class="literal">
Mysqlx_notice_warning_sent
</code>
</a>
</p>
<p>
The number of warning notices sent back to clients.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_notified_by_group_replication">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_notified_by_group_replication">
<code class="literal">
Mysqlx_notified_by_group_replication
</code>
</a>
</p>
<p>
Number of Group Replication notifications sent to clients.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_port">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_port">
<code class="literal">
Mysqlx_port
</code>
</a>
</p>
<p>
The TCP port which X Plugin is listening to. If a network
bind has failed, or if the
<a class="link" href="server-system-variables.html#sysvar_skip_networking">
<code class="literal">
skip_networking
</code>
</a>
system
variable is enabled, the value shows
<code class="literal">
UNDEFINED
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_prep_deallocate">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_prep_deallocate">
<code class="literal">
Mysqlx_prep_deallocate
</code>
</a>
</p>
<p>
The number of prepared-statement-deallocate messages
received
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_prep_execute">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_prep_execute">
<code class="literal">
Mysqlx_prep_execute
</code>
</a>
</p>
<p>
The number of prepared-statement-execute messages received
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_prep_prepare">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_prep_prepare">
<code class="literal">
Mysqlx_prep_prepare
</code>
</a>
</p>
<p>
The number of prepared-statement messages received
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_rows_sent">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_rows_sent">
<code class="literal">
Mysqlx_rows_sent
</code>
</a>
</p>
<p>
The number of rows sent back to clients.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_sessions">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_sessions">
<code class="literal">
Mysqlx_sessions
</code>
</a>
</p>
<p>
The number of sessions that have been opened.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_sessions_accepted">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_sessions_accepted">
<code class="literal">
Mysqlx_sessions_accepted
</code>
</a>
</p>
<p>
The number of session attempts which have been accepted.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_sessions_closed">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_sessions_closed">
<code class="literal">
Mysqlx_sessions_closed
</code>
</a>
</p>
<p>
The number of sessions that have been closed.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_sessions_fatal_error">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_sessions_fatal_error">
<code class="literal">
Mysqlx_sessions_fatal_error
</code>
</a>
</p>
<p>
The number of sessions that have closed with a fatal error.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_sessions_killed">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_sessions_killed">
<code class="literal">
Mysqlx_sessions_killed
</code>
</a>
</p>
<p>
The number of sessions which have been killed.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_sessions_rejected">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_sessions_rejected">
<code class="literal">
Mysqlx_sessions_rejected
</code>
</a>
</p>
<p>
The number of session attempts which have been rejected.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_socket">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_socket">
<code class="literal">
Mysqlx_socket
</code>
</a>
</p>
<p>
The Unix socket which X Plugin is listening to.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_ssl_accept_renegotiates">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_ssl_accept_renegotiates">
<code class="literal">
Mysqlx_ssl_accept_renegotiates
</code>
</a>
</p>
<p>
The number of negotiations needed to establish the
connection.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_ssl_accepts">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_ssl_accepts">
<code class="literal">
Mysqlx_ssl_accepts
</code>
</a>
</p>
<p>
The number of accepted SSL connections.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_ssl_active">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_ssl_active">
<code class="literal">
Mysqlx_ssl_active
</code>
</a>
</p>
<p>
If SSL is active.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_ssl_cipher">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_ssl_cipher">
<code class="literal">
Mysqlx_ssl_cipher
</code>
</a>
</p>
<p>
The current SSL cipher (empty for non-SSL connections).
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_ssl_cipher_list">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_ssl_cipher_list">
<code class="literal">
Mysqlx_ssl_cipher_list
</code>
</a>
</p>
<p>
A list of possible SSL ciphers (empty for non-SSL
connections).
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_ssl_ctx_verify_depth">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_ssl_ctx_verify_depth">
<code class="literal">
Mysqlx_ssl_ctx_verify_depth
</code>
</a>
</p>
<p>
The certificate verification depth limit currently set in
ctx.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_ssl_ctx_verify_mode">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_ssl_ctx_verify_mode">
<code class="literal">
Mysqlx_ssl_ctx_verify_mode
</code>
</a>
</p>
<p>
The certificate verification mode currently set in ctx.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_ssl_finished_accepts">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_ssl_finished_accepts">
<code class="literal">
Mysqlx_ssl_finished_accepts
</code>
</a>
</p>
<p>
The number of successful SSL connections to the server.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_ssl_server_not_after">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_ssl_server_not_after">
<code class="literal">
Mysqlx_ssl_server_not_after
</code>
</a>
</p>
<p>
The last date for which the SSL certificate is valid.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_ssl_server_not_before">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_ssl_server_not_before">
<code class="literal">
Mysqlx_ssl_server_not_before
</code>
</a>
</p>
<p>
The first date for which the SSL certificate is valid.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_ssl_verify_depth">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_ssl_verify_depth">
<code class="literal">
Mysqlx_ssl_verify_depth
</code>
</a>
</p>
<p>
The certificate verification depth for SSL connections.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_ssl_verify_mode">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_ssl_verify_mode">
<code class="literal">
Mysqlx_ssl_verify_mode
</code>
</a>
</p>
<p>
The certificate verification mode for SSL connections.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_ssl_version">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_ssl_version">
<code class="literal">
Mysqlx_ssl_version
</code>
</a>
</p>
<p>
The name of the protocol used for SSL connections.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_stmt_create_collection">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_stmt_create_collection">
<code class="literal">
Mysqlx_stmt_create_collection
</code>
</a>
</p>
<p>
The number of create collection statements received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_stmt_create_collection_index">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_stmt_create_collection_index">
<code class="literal">
Mysqlx_stmt_create_collection_index
</code>
</a>
</p>
<p>
The number of create collection index statements received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_stmt_disable_notices">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_stmt_disable_notices">
<code class="literal">
Mysqlx_stmt_disable_notices
</code>
</a>
</p>
<p>
The number of disable notice statements received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_stmt_drop_collection">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_stmt_drop_collection">
<code class="literal">
Mysqlx_stmt_drop_collection
</code>
</a>
</p>
<p>
The number of drop collection statements received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_stmt_drop_collection_index">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_stmt_drop_collection_index">
<code class="literal">
Mysqlx_stmt_drop_collection_index
</code>
</a>
</p>
<p>
The number of drop collection index statements received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_stmt_enable_notices">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_stmt_enable_notices">
<code class="literal">
Mysqlx_stmt_enable_notices
</code>
</a>
</p>
<p>
The number of enable notice statements received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_stmt_ensure_collection">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_stmt_ensure_collection">
<code class="literal">
Mysqlx_stmt_ensure_collection
</code>
</a>
</p>
<p>
The number of ensure collection statements received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_stmt_execute_mysqlx">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_stmt_execute_mysqlx">
<code class="literal">
Mysqlx_stmt_execute_mysqlx
</code>
</a>
</p>
<p>
The number of StmtExecute messages received with namespace
set to
<code class="literal">
mysqlx
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_stmt_execute_sql">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_stmt_execute_sql">
<code class="literal">
Mysqlx_stmt_execute_sql
</code>
</a>
</p>
<p>
The number of StmtExecute requests received for the SQL
namespace.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_stmt_execute_xplugin">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_stmt_execute_xplugin">
<code class="literal">
Mysqlx_stmt_execute_xplugin
</code>
</a>
</p>
<p>
This status variable is no longer used.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_stmt_get_collection_options">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_stmt_get_collection_options">
<code class="literal">
Mysqlx_stmt_get_collection_options
</code>
</a>
</p>
<p>
The number of get collection object statements received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_stmt_kill_client">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_stmt_kill_client">
<code class="literal">
Mysqlx_stmt_kill_client
</code>
</a>
</p>
<p>
The number of kill client statements received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_stmt_list_clients">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_stmt_list_clients">
<code class="literal">
Mysqlx_stmt_list_clients
</code>
</a>
</p>
<p>
The number of list client statements received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_stmt_list_notices">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_stmt_list_notices">
<code class="literal">
Mysqlx_stmt_list_notices
</code>
</a>
</p>
<p>
The number of list notice statements received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_stmt_list_objects">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_stmt_list_objects">
<code class="literal">
Mysqlx_stmt_list_objects
</code>
</a>
</p>
<p>
The number of list object statements received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_stmt_modify_collection_options">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_stmt_modify_collection_options">
<code class="literal">
Mysqlx_stmt_modify_collection_options
</code>
</a>
</p>
<p>
The number of modify collection options statements received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_stmt_ping">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_stmt_ping">
<code class="literal">
Mysqlx_stmt_ping
</code>
</a>
</p>
<p>
The number of ping statements received.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_worker_threads">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_worker_threads">
<code class="literal">
Mysqlx_worker_threads
</code>
</a>
</p>
<p>
The number of worker threads available.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Mysqlx_worker_threads_active">
</a>
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_worker_threads_active">
<code class="literal">
Mysqlx_worker_threads_active
</code>
</a>
</p>
<p>
The number of worker threads currently used.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/condition-handling-restrictions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="condition-handling-restrictions">
</a>
15.6.8 Restrictions on Condition Handling
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045175210880">
</a>
<a class="indexterm" name="idm46045175209392">
</a>
<p>
<a class="link" href="signal.html" title="15.6.7.5 SIGNAL Statement">
<code class="literal">
SIGNAL
</code>
</a>
,
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
, and
<a class="link" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
<code class="literal">
GET DIAGNOSTICS
</code>
</a>
are not permissible
as prepared statements. For example, this statement is invalid:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa88890062"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">PREPARE</span> stmt1 <span class="token keyword">FROM</span> <span class="token string">'SIGNAL SQLSTATE "02000"'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<code class="literal">
SQLSTATE
</code>
values in class
<code class="literal">
'04'
</code>
are not treated specially. They are
handled the same as other exceptions.
</p>
<p>
In standard SQL, the first condition relates to the
<code class="literal">
SQLSTATE
</code>
value returned for the previous SQL
statement. In MySQL, this is not guaranteed, so to get the main
error, you cannot do this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa78715522"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">GET</span> <span class="token keyword">DIAGNOSTICS</span> <span class="token keyword">CONDITION</span> <span class="token number">1</span> <span class="token variable">@errno</span> <span class="token operator">=</span> <span class="token keyword">MYSQL_ERRNO</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Instead, do this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa3382697"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">GET</span> <span class="token keyword">DIAGNOSTICS</span> <span class="token variable">@cno</span> <span class="token operator">=</span> <span class="token keyword">NUMBER</span><span class="token punctuation">;</span>
<span class="token keyword">GET</span> <span class="token keyword">DIAGNOSTICS</span> <span class="token keyword">CONDITION</span> <span class="token variable">@cno</span> <span class="token variable">@errno</span> <span class="token operator">=</span> <span class="token keyword">MYSQL_ERRNO</span><span class="token punctuation">;</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/opengis-geometry-model.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="opengis-geometry-model">
</a>
13.4.2 The OpenGIS Geometry Model
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="gis-geometry-class-hierarchy.html">
13.4.2.1 The Geometry Class Hierarchy
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-class-geometry.html">
13.4.2.2 Geometry Class
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-class-point.html">
13.4.2.3 Point Class
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-class-curve.html">
13.4.2.4 Curve Class
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-class-linestring.html">
13.4.2.5 LineString Class
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-class-surface.html">
13.4.2.6 Surface Class
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-class-polygon.html">
13.4.2.7 Polygon Class
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-class-geometrycollection.html">
13.4.2.8 GeometryCollection Class
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-class-multipoint.html">
13.4.2.9 MultiPoint Class
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-class-multicurve.html">
13.4.2.10 MultiCurve Class
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-class-multilinestring.html">
13.4.2.11 MultiLineString Class
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-class-multisurface.html">
13.4.2.12 MultiSurface Class
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-class-multipolygon.html">
13.4.2.13 MultiPolygon Class
</a>
</span>
</dt>
</dl>
</div>
<p>
The set of geometry types proposed by OGC's
<span class="bold">
<strong>
SQL with Geometry Types
</strong>
</span>
environment is based on the
<span class="bold">
<strong>
OpenGIS
Geometry Model
</strong>
</span>
. In this model, each geometric object
has the following general properties:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
It is associated with a spatial reference system, which
describes the coordinate space in which the object is
defined.
</p>
</li>
<li class="listitem">
<p>
It belongs to some geometry class.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-st-spatial-reference-systems-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-st-spatial-reference-systems-table">
</a>
28.3.36 The INFORMATION_SCHEMA ST_SPATIAL_REFERENCE_SYSTEMS Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045078544016">
</a>
<p>
The
<a class="link" href="information-schema-st-spatial-reference-systems-table.html" title="28.3.36 The INFORMATION_SCHEMA ST_SPATIAL_REFERENCE_SYSTEMS Table">
<code class="literal">
ST_SPATIAL_REFERENCE_SYSTEMS
</code>
</a>
table provides information about available spatial reference
systems (SRSs) for spatial data. This table is based on the SQL/MM
(ISO/IEC 13249-3) standard.
</p>
<p>
Entries in the
<a class="link" href="information-schema-st-spatial-reference-systems-table.html" title="28.3.36 The INFORMATION_SCHEMA ST_SPATIAL_REFERENCE_SYSTEMS Table">
<code class="literal">
ST_SPATIAL_REFERENCE_SYSTEMS
</code>
</a>
table
are based on the
<a class="ulink" href="http://epsg.org" target="_blank">
European Petroleum
Survey Group
</a>
(EPSG) data set, except for SRID 0, which
corresponds to a special SRS used in MySQL that represents an
infinite flat Cartesian plane with no units assigned to its axes.
For additional information about SRSs, see
<a class="xref" href="spatial-reference-systems.html" title="13.4.5 Spatial Reference System Support">
Section 13.4.5, “Spatial Reference System Support”
</a>
.
</p>
<p>
The
<a class="link" href="information-schema-st-spatial-reference-systems-table.html" title="28.3.36 The INFORMATION_SCHEMA ST_SPATIAL_REFERENCE_SYSTEMS Table">
<code class="literal">
ST_SPATIAL_REFERENCE_SYSTEMS
</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">
SRS_NAME
</code>
</p>
<p>
The spatial reference system name. This value is unique.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SRS_ID
</code>
</p>
<p>
The spatial reference system numeric ID. This value is unique.
</p>
<p>
<code class="literal">
SRS_ID
</code>
values represent the same kind of
values as the SRID of geometry values or passed as the SRID
argument to spatial functions. SRID 0 (the unitless Cartesian
plane) is special. It is always a legal spatial reference
system ID and can be used in any computations on spatial data
that depend on SRID values.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ORGANIZATION
</code>
</p>
<p>
The name of the organization that defined the coordinate
system on which the spatial reference system is based.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ORGANIZATION_COORDSYS_ID
</code>
</p>
<p>
The numeric ID given to the spatial reference system by the
organization that defined it.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DEFINITION
</code>
</p>
<p>
The spatial reference system definition.
<code class="literal">
DEFINITION
</code>
values are WKT values,
represented as specified in the
<a class="ulink" href="http://www.opengeospatial.org" target="_blank">
Open Geospatial
Consortium
</a>
document
<a class="ulink" href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html" target="_blank">
OGC
12-063r5
</a>
.
</p>
<p>
SRS definition parsing occurs on demand when definitions are
needed by GIS functions. Parsed definitions are stored in the
data dictionary cache to enable reuse and avoid incurring
parsing overhead for every statement that needs SRS
information.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DESCRIPTION
</code>
</p>
<p>
The spatial reference system description.
</p>
</li>
</ul>
</div>
<h4>
<a name="idm46045078518896">
</a>
Notes
</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The
<code class="literal">
SRS_NAME
</code>
,
<code class="literal">
ORGANIZATION
</code>
,
<code class="literal">
ORGANIZATION_COORDSYS_ID
</code>
, and
<code class="literal">
DESCRIPTION
</code>
columns contain information
that may be of interest to users, but they are not used by
MySQL.
</p>
</li>
</ul>
</div>
<h4>
<a name="idm46045078514016">
</a>
Example
</h4>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa60403560"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> ST_SPATIAL_REFERENCE_SYSTEMS
<span class="token keyword">WHERE</span> SRS_ID <span class="token operator">=</span> <span class="token number">4326</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>
SRS_NAME<span class="token punctuation">:</span> WGS 84
SRS_ID<span class="token punctuation">:</span> 4326
ORGANIZATION<span class="token punctuation">:</span> EPSG
ORGANIZATION_COORDSYS_ID<span class="token punctuation">:</span> 4326
DEFINITION<span class="token punctuation">:</span> GEOGCS["WGS 84",DATUM["World Geodetic System 1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],
UNIT["degree",0.017453292519943278,
AUTHORITY["EPSG","9122"]],
AXIS["Lat",NORTH],AXIS["Long",EAST],
AUTHORITY["EPSG","4326"]]
DESCRIPTION<span class="token punctuation">:</span></span></code></pre>
</div>
<p>
This entry describes the SRS used for GPS systems. It has a name
(
<code class="literal">
SRS_NAME
</code>
) of WGS 84 and an ID
(
<code class="literal">
SRS_ID
</code>
) of 4326, which is the ID used by the
<a class="ulink" href="http://epsg.org" target="_blank">
European Petroleum Survey
Group
</a>
(EPSG).
</p>
<p>
The
<code class="literal">
DEFINITION
</code>
values for projected and
geographic SRSs begin with
<code class="literal">
PROJCS
</code>
and
<code class="literal">
GEOGCS
</code>
, respectively. The definition for SRID 0
is special and has an empty
<code class="literal">
DEFINITION
</code>
value.
The following query determines how many entries in the
<a class="link" href="information-schema-st-spatial-reference-systems-table.html" title="28.3.36 The INFORMATION_SCHEMA ST_SPATIAL_REFERENCE_SYSTEMS Table">
<code class="literal">
ST_SPATIAL_REFERENCE_SYSTEMS
</code>
</a>
table
correspond to projected, geographic, and other SRSs, based on
<code class="literal">
DEFINITION
</code>
values:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa25124762"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">COUNT</span><span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token operator">CASE</span> <span class="token function">LEFT</span><span class="token punctuation">(</span><span class="token keyword">DEFINITION</span><span class="token punctuation">,</span> <span class="token number">6</span><span class="token punctuation">)</span>
<span class="token keyword">WHEN</span> <span class="token string">'PROJCS'</span> <span class="token keyword">THEN</span> <span class="token string">'Projected'</span>
<span class="token keyword">WHEN</span> <span class="token string">'GEOGCS'</span> <span class="token keyword">THEN</span> <span class="token string">'Geographic'</span>
<span class="token keyword">ELSE</span> <span class="token string">'Other'</span>
<span class="token keyword">END</span> <span class="token keyword">AS</span> SRS_TYPE
<span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>ST_SPATIAL_REFERENCE_SYSTEMS
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> SRS_TYPE<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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> SRS_TYPE <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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> Other <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 4668 <span class="token punctuation">|</span> Projected <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 483 <span class="token punctuation">|</span> Geographic <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 enable manipulation of SRS entries stored in the data
dictionary, MySQL provides these SQL statements:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="create-spatial-reference-system.html" title="15.1.19 CREATE SPATIAL REFERENCE SYSTEM Statement">
<code class="literal">
CREATE SPATIAL REFERENCE
SYSTEM
</code>
</a>
: See
<a class="xref" href="create-spatial-reference-system.html" title="15.1.19 CREATE SPATIAL REFERENCE SYSTEM Statement">
Section 15.1.19, “CREATE SPATIAL REFERENCE SYSTEM Statement”
</a>
. The
description for this statement includes additional information
about SRS components.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="drop-spatial-reference-system.html" title="15.1.31 DROP SPATIAL REFERENCE SYSTEM Statement">
<code class="literal">
DROP SPATIAL REFERENCE SYSTEM
</code>
</a>
:
See
<a class="xref" href="drop-spatial-reference-system.html" title="15.1.31 DROP SPATIAL REFERENCE SYSTEM Statement">
Section 15.1.31, “DROP SPATIAL REFERENCE SYSTEM Statement”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-transaction-summary-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-transaction-summary-tables">
</a>
29.12.20.5 Transaction Summary Tables
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045068654160">
</a>
<a class="indexterm" name="idm46045068652704">
</a>
<a class="indexterm" name="idm46045068651184">
</a>
<a class="indexterm" name="idm46045068649664">
</a>
<a class="indexterm" name="idm46045068648144">
</a>
<a class="indexterm" name="idm46045068646608">
</a>
<a class="indexterm" name="idm46045068645072">
</a>
<a class="indexterm" name="idm46045068643552">
</a>
<a class="indexterm" name="idm46045068642032">
</a>
<a class="indexterm" name="idm46045068640512">
</a>
<p>
The Performance Schema maintains tables for collecting current
and recent transaction events, and aggregates that information
in summary tables.
<a class="xref" href="performance-schema-transaction-tables.html" title="29.12.7 Performance Schema Transaction Tables">
Section 29.12.7, “Performance Schema Transaction Tables”
</a>
describes the events on which transaction summaries are based.
See that discussion for information about the content of
transaction events, the current and historical transaction
event tables, and how to control transaction event collection,
which is disabled by default.
</p>
<p>
Example transaction event summary information:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa92247587"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span>
<span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>events_transactions_summary_global_by_event_name
<span class="token keyword">LIMIT</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>
EVENT_NAME<span class="token punctuation">:</span> transaction
COUNT_STAR<span class="token punctuation">:</span> 5
SUM_TIMER_WAIT<span class="token punctuation">:</span> 19550092000
MIN_TIMER_WAIT<span class="token punctuation">:</span> 2954148000
AVG_TIMER_WAIT<span class="token punctuation">:</span> 3910018000
MAX_TIMER_WAIT<span class="token punctuation">:</span> 5486275000
COUNT_READ_WRITE<span class="token punctuation">:</span> 5
SUM_TIMER_READ_WRITE<span class="token punctuation">:</span> 19550092000
MIN_TIMER_READ_WRITE<span class="token punctuation">:</span> 2954148000
AVG_TIMER_READ_WRITE<span class="token punctuation">:</span> 3910018000
MAX_TIMER_READ_WRITE<span class="token punctuation">:</span> 5486275000
COUNT_READ_ONLY<span class="token punctuation">:</span> 0
SUM_TIMER_READ_ONLY<span class="token punctuation">:</span> 0
MIN_TIMER_READ_ONLY<span class="token punctuation">:</span> 0
AVG_TIMER_READ_ONLY<span class="token punctuation">:</span> 0
MAX_TIMER_READ_ONLY<span class="token punctuation">:</span> 0</span></code></pre>
</div>
<p>
Each transaction summary table has one or more grouping
columns to indicate how the table aggregates events. Event
names refer to names of event instruments in the
<a class="link" href="performance-schema-setup-instruments-table.html" title="29.12.2.3 The setup_instruments Table">
<code class="literal">
setup_instruments
</code>
</a>
table:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
<code class="literal">
events_transactions_summary_by_account_by_event_name
</code>
</a>
has
<code class="literal">
USER
</code>
,
<code class="literal">
HOST
</code>
, and
<code class="literal">
EVENT_NAME
</code>
columns. Each row summarizes
events for a given account (user and host combination) and
event name.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
<code class="literal">
events_transactions_summary_by_host_by_event_name
</code>
</a>
has
<code class="literal">
HOST
</code>
and
<code class="literal">
EVENT_NAME
</code>
columns. Each row summarizes
events for a given host and event name.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
<code class="literal">
events_transactions_summary_by_thread_by_event_name
</code>
</a>
has
<code class="literal">
THREAD_ID
</code>
and
<code class="literal">
EVENT_NAME
</code>
columns. Each row summarizes
events for a given thread and event name.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
<code class="literal">
events_transactions_summary_by_user_by_event_name
</code>
</a>
has
<code class="literal">
USER
</code>
and
<code class="literal">
EVENT_NAME
</code>
columns. Each row summarizes
events for a given user and event name.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
<code class="literal">
events_transactions_summary_global_by_event_name
</code>
</a>
has an
<code class="literal">
EVENT_NAME
</code>
column. Each row
summarizes events for a given event name.
</p>
</li>
</ul>
</div>
<p>
Each transaction summary table has these summary columns
containing aggregated values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
COUNT_STAR
</code>
,
<code class="literal">
SUM_TIMER_WAIT
</code>
,
<code class="literal">
MIN_TIMER_WAIT
</code>
,
<code class="literal">
AVG_TIMER_WAIT
</code>
,
<code class="literal">
MAX_TIMER_WAIT
</code>
</p>
<p>
These columns are analogous to the columns of the same
names in the wait event summary tables (see
<a class="xref" href="performance-schema-wait-summary-tables.html" title="29.12.20.1 Wait Event Summary Tables">
Section 29.12.20.1, “Wait Event Summary Tables”
</a>
),
except that the transaction summary tables aggregate
events from
<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>
rather than
<a class="link" href="performance-schema-events-waits-current-table.html" title="29.12.4.1 The events_waits_current Table">
<code class="literal">
events_waits_current
</code>
</a>
. These
columns summarize read-write and read-only transactions.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_READ_WRITE
</code>
,
<code class="literal">
SUM_TIMER_READ_WRITE
</code>
,
<code class="literal">
MIN_TIMER_READ_WRITE
</code>
,
<code class="literal">
AVG_TIMER_READ_WRITE
</code>
,
<code class="literal">
MAX_TIMER_READ_WRITE
</code>
</p>
<p>
These are similar to the
<code class="literal">
COUNT_STAR
</code>
and
<code class="literal">
<em class="replaceable">
<code>
xxx
</code>
</em>
_TIMER_WAIT
</code>
columns, but summarize read-write transactions only. The
transaction access mode specifies whether transactions
operate in read/write or read-only mode.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_READ_ONLY
</code>
,
<code class="literal">
SUM_TIMER_READ_ONLY
</code>
,
<code class="literal">
MIN_TIMER_READ_ONLY
</code>
,
<code class="literal">
AVG_TIMER_READ_ONLY
</code>
,
<code class="literal">
MAX_TIMER_READ_ONLY
</code>
</p>
<p>
These are similar to the
<code class="literal">
COUNT_STAR
</code>
and
<code class="literal">
<em class="replaceable">
<code>
xxx
</code>
</em>
_TIMER_WAIT
</code>
columns, but summarize read-only transactions only. The
transaction access mode specifies whether transactions
operate in read/write or read-only mode.
</p>
</li>
</ul>
</div>
<p>
The transaction summary tables have these indexes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
<code class="literal">
events_transactions_summary_by_account_by_event_name
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
USER
</code>
,
<code class="literal">
HOST
</code>
,
<code class="literal">
EVENT_NAME
</code>
)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
<code class="literal">
events_transactions_summary_by_host_by_event_name
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
HOST
</code>
,
<code class="literal">
EVENT_NAME
</code>
)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
<code class="literal">
events_transactions_summary_by_thread_by_event_name
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
THREAD_ID
</code>
,
<code class="literal">
EVENT_NAME
</code>
)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
<code class="literal">
events_transactions_summary_by_user_by_event_name
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
USER
</code>
,
<code class="literal">
EVENT_NAME
</code>
)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
<code class="literal">
events_transactions_summary_global_by_event_name
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
EVENT_NAME
</code>
)
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
is permitted for
transaction summary tables. It has these effects:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For summary tables not aggregated by account, host, or
user, truncation resets the summary columns to zero rather
than removing rows.
</p>
</li>
<li class="listitem">
<p>
For summary tables aggregated by account, host, or user,
truncation removes rows for accounts, hosts, or users with
no connections, and resets the summary columns to zero for
the remaining rows.
</p>
</li>
</ul>
</div>
<p>
In addition, each transaction summary table that is aggregated
by account, host, user, or thread is implicitly truncated by
truncation of the connection table on which it depends, or
truncation of
<a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
<code class="literal">
events_transactions_summary_global_by_event_name
</code>
</a>
.
For details, see
<a class="xref" href="performance-schema-connection-tables.html" title="29.12.8 Performance Schema Connection Tables">
Section 29.12.8, “Performance Schema Connection Tables”
</a>
.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="transaction-summary-tables-aggregation">
</a>
Transaction Aggregation Rules
</h5>
</div>
</div>
</div>
<p>
Transaction event collection occurs without regard to
isolation level, access mode, or autocommit mode.
</p>
<p>
Transaction event collection occurs for all non-aborted
transactions initiated by the server, including empty
transactions.
</p>
<p>
Read-write transactions are generally more resource
intensive than read-only transactions, therefore transaction
summary tables include separate aggregate columns for
read-write and read-only transactions.
</p>
<p>
Resource requirements may also vary with transaction
isolation level. However, presuming that only one isolation
level would be used per server, aggregation by isolation
level is not provided.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/monitor-alter-table-performance-schema.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="monitor-alter-table-performance-schema">
</a>
17.16.1 Monitoring ALTER TABLE Progress for InnoDB Tables Using Performance
Schema
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045149628864">
</a>
<a class="indexterm" name="idm46045149627376">
</a>
<p>
You can monitor
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
progress for
<code class="literal">
InnoDB
</code>
tables using
<a class="link" href="performance-schema.html" title="Chapter 29 MySQL Performance Schema">
Performance Schema
</a>
.
</p>
<p>
There are seven stage events that represent different phases of
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
. Each stage event
reports a running total of
<code class="literal">
WORK_COMPLETED
</code>
and
<code class="literal">
WORK_ESTIMATED
</code>
for the overall
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
operation as it
progresses through its different phases.
<code class="literal">
WORK_ESTIMATED
</code>
is calculated using a formula
that takes into account all of the work that
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
performs, and may be
revised during
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
processing.
<code class="literal">
WORK_COMPLETED
</code>
and
<code class="literal">
WORK_ESTIMATED
</code>
values are an abstract
representation of all of the work performed by
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
.
</p>
<p>
In order of occurrence,
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
stage events include:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
stage/innodb/alter table (read PK and internal
sort)
</code>
: This stage is active when
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
is in the
reading-primary-key phase. It starts with
<code class="literal">
WORK_COMPLETED=0
</code>
and
<code class="literal">
WORK_ESTIMATED
</code>
set to the estimated number
of pages in the primary key. When the stage is completed,
<code class="literal">
WORK_ESTIMATED
</code>
is updated to the actual
number of pages in the primary key.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
stage/innodb/alter table (merge sort)
</code>
: This
stage is repeated for each index added by the
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
operation.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
stage/innodb/alter table (insert)
</code>
: This
stage is repeated for each index added by the
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
operation.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
stage/innodb/alter table (log apply index)
</code>
:
This stage includes the application of DML log generated while
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
was running.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
stage/innodb/alter table (flush)
</code>
: Before
this stage begins,
<code class="literal">
WORK_ESTIMATED
</code>
is
updated with a more accurate estimate, based on the length of
the flush list.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
stage/innodb/alter table (log apply table)
</code>
:
This stage includes the application of concurrent DML log
generated while
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
was
running. The duration of this phase depends on the extent of
table changes. This phase is instant if no concurrent DML was
run on the table.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
stage/innodb/alter table (end)
</code>
: Includes
any remaining work that appeared after the flush phase, such
as reapplying DML that was executed on the table while
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
was running.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<code class="literal">
InnoDB
</code>
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
stage events do not currently account for the
addition of spatial indexes.
</p>
</div>
<h4>
<a name="idm46045149586016">
</a>
ALTER TABLE Monitoring Example Using Performance Schema
</h4>
<p>
The following example demonstrates how to enable the
<code class="literal">
stage/innodb/alter table%
</code>
stage event
instruments and related consumer tables to monitor
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
progress. For
information about Performance Schema stage event instruments and
related consumers, see
<a class="xref" href="performance-schema-stage-tables.html" title="29.12.5 Performance Schema Stage Event Tables">
Section 29.12.5, “Performance Schema Stage Event Tables”
</a>
.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Enable the
<code class="literal">
stage/innodb/alter%
</code>
instruments:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa51289556"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">UPDATE</span> performance_schema<span class="token punctuation">.</span>setup_instruments
<span class="token keyword">SET</span> ENABLED <span class="token operator">=</span> <span class="token string">'YES'</span>
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'stage/innodb/alter%'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 7 rows affected (0.00 sec)</span>
<span class="token output">Rows matched: 7 Changed: 7 Warnings: 0</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Enable the stage event consumer tables, which include
<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>
,
<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>
, and
<a class="link" href="performance-schema-events-stages-history-long-table.html" title="29.12.5.3 The events_stages_history_long Table">
<code class="literal">
events_stages_history_long
</code>
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa90854935"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">UPDATE</span> performance_schema<span class="token punctuation">.</span>setup_consumers
<span class="token keyword">SET</span> ENABLED <span class="token operator">=</span> <span class="token string">'YES'</span>
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'%stages%'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 3 rows affected (0.00 sec)</span>
<span class="token output">Rows matched: 3 Changed: 3 Warnings: 0</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Run an
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
operation.
In this example, a
<code class="literal">
middle_name
</code>
column is
added to the employees table of the employees sample database.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69272755"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> employees<span class="token punctuation">.</span>employees <span class="token keyword">ADD</span> <span class="token keyword">COLUMN</span> middle_name <span class="token datatype">varchar</span><span class="token punctuation">(</span><span class="token number">14</span><span class="token punctuation">)</span> <span class="token keyword">AFTER</span> first_name<span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (9.27 sec)</span>
<span class="token output">Records: 0 Duplicates: 0 Warnings: 0</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Check the progress of the
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
operation by querying the Performance Schema
<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>
table. The
stage event shown differs depending on which
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
phase is currently
in progress. The
<code class="literal">
WORK_COMPLETED
</code>
column
shows the work completed. The
<code class="literal">
WORK_ESTIMATED
</code>
column provides an estimate
of the remaining work.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa2600103"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> EVENT_NAME<span class="token punctuation">,</span> WORK_COMPLETED<span class="token punctuation">,</span> WORK_ESTIMATED
<span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>events_stages_current<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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_NAME <span class="token punctuation">|</span> WORK_COMPLETED <span class="token punctuation">|</span> WORK_ESTIMATED <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/innodb/alter table (read PK and internal sort) <span class="token punctuation">|</span> 280 <span class="token punctuation">|</span> 1245 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.01 sec)</span></code></pre>
</div>
<p>
The
<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>
table
returns an empty set if the
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
operation has completed. In this case, you can
check the
<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>
table to view event data for the completed operation. For
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa49327801"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> EVENT_NAME<span class="token punctuation">,</span> WORK_COMPLETED<span class="token punctuation">,</span> WORK_ESTIMATED
<span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>events_stages_history<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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_NAME <span class="token punctuation">|</span> WORK_COMPLETED <span class="token punctuation">|</span> WORK_ESTIMATED <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/innodb/alter table (read PK and internal sort) <span class="token punctuation">|</span> 886 <span class="token punctuation">|</span> 1213 <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> 1213 <span class="token punctuation">|</span> 1213 <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> 1597 <span class="token punctuation">|</span> 1597 <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> 1597 <span class="token punctuation">|</span> 1597 <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> 1981 <span class="token punctuation">|</span> 1981 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">5 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
As shown above, the
<code class="literal">
WORK_ESTIMATED
</code>
value
was revised during
<code class="literal">
ALTER TABLE
</code>
processing.
The estimated work after completion of the initial stage is
1213. When
<code class="literal">
ALTER TABLE
</code>
processing
completed,
<code class="literal">
WORK_ESTIMATED
</code>
was set to the
actual value, which is 1981.
</p>
</li>
</ol>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/gpg-key-archived-packages.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="gpg-key-archived-packages">
</a>
2.1.4.5 GPG Public Build Key for Archived Packages
</h4>
</div>
</div>
</div>
<p>
The following GPG public build key (keyID
<code class="literal">
3A79BD29
</code>
) can be used to verify the
authenticity and integrity of MySQL packages versions 8.0.28
through 8.0.35, 8.1.0, and 8.2.0. For signature checking
instructions, see
<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>
. It
expired on December 14, 2023.
</p>
<h5>
<a name="idm46045332771136">
</a>
GPG Public Build Key for MySQL 8.0.28 through 8.0.35, and 8.1.0/8.2.0
Packages
</h5>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa92540669"><div class="copy-help left">Press ⌘+C to 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">-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBGG4urcBEACrbsRa7tSSyxSfFkB+KXSbNM9rxYqoB78u107skReefq4/+Y72
TpDvlDZLmdv/lK0IpLa3bnvsM9IE1trNLrfi+JES62kaQ6hePPgn2RqxyIirt2se
Si3Z3n3jlEg+mSdhAvW+b+hFnqxo+TY0U+RBwDi4oO0YzHefkYPSmNPdlxRPQBMv
4GPTNfxERx6XvVSPcL1+jQ4R2cQFBryNhidBFIkoCOszjWhm+WnbURsLheBp757l
qEyrpCufz77zlq2gEi+wtPHItfqsx3rzxSRqatztMGYZpNUHNBJkr13npZtGW+kd
N/xu980QLZxN+bZ88pNoOuzD6dKcpMJ0LkdUmTx5z9ewiFiFbUDzZ7PECOm2g3ve
Jrwr79CXDLE1+39Hr8rDM2kDhSr9tAlPTnHVDcaYIGgSNIBcYfLmt91133klHQHB
IdWCNVtWJjq5YcLQJ9TxG9GQzgABPrm6NDd1t9j7w1L7uwBvMB1wgpirRTPVfnUS
Cd+025PEF+wTcBhfnzLtFj5xD7mNsmDmeHkF/sDfNOfAzTE1v2wq0ndYU60xbL6/
yl/Nipyr7WiQjCG0m3WfkjjVDTfs7/DXUqHFDOu4WMF9v+oqwpJXmAeGhQTWZC/Q
hWtrjrNJAgwKpp263gDSdW70ekhRzsok1HJwX1SfxHJYCMFs2aH6ppzNsQARAQAB
tDZNeVNRTCBSZWxlYXNlIEVuZ2luZWVyaW5nIDxteXNxbC1idWlsZEBvc3Mub3Jh
Y2xlLmNvbT6JAlQEEwEIAD4WIQSFm+jXxYb1OEMLGcJGe5QtOnm9KQUCYbi6twIb
AwUJA8JnAAULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRBGe5QtOnm9KUewD/99
2sS31WLGoUQ6NoL7qOB4CErkqXtMzpJAKKg2jtBGG3rKE1/0VAg1D8AwEK4LcCO4
07wohnH0hNiUbeDck5x20pgS5SplQpuXX1K9vPzHeL/WNTb98S3H2Mzj4o9obED6
Ey52tTupttMF8pC9TJ93LxbJlCHIKKwCA1cXud3GycRN72eqSqZfJGdsaeWLmFmH
f6oee27d8XLoNjbyAxna/4jdWoTqmp8oT3bgv/TBco23NzqUSVPi+7ljS1hHvcJu
oJYqaztGrAEf/lWIGdfl/kLEh8IYx8OBNUojh9mzCDlwbs83CBqoUdlzLNDdwmzu
34Aw7xK14RAVinGFCpo/7EWoX6weyB/zqevUIIE89UABTeFoGih/hx2jdQV/NQNt
hWTW0jH0hmPnajBVAJPYwAuO82rx2pnZCxDATMn0elOkTue3PCmzHBF/GT6c65aQ
C4aojj0+Veh787QllQ9FrWbwnTz+4fNzU/MBZtyLZ4JnsiWUs9eJ2V1g/A+RiIKu
357Qgy1ytLqlgYiWfzHFlYjdtbPYKjDaScnvtY8VO2Rktm7XiV4zKFKiaWp+vuVY
pR0/7Adgnlj5Jt9lQQGOr+Z2VYx8SvBcC+by3XAtYkRHtX5u4MLlVS3gcoWfDiWw
CpvqdK21EsXjQJxRr3dbSn0HaVj4FJZX0QQ7WZm6WLkCDQRhuLq3ARAA6RYjqfC0
YcLGKvHhoBnsX29vy9Wn1y2JYpEnPUIB8X0VOyz5/ALv4Hqtl4THkH+mmMuhtndo
q2BkCCk508jWBvKS1S+Bd2esB45BDDmIhuX3ozu9Xza4i1FsPnLkQ0uMZJv30ls2
pXFmskhYyzmo6aOmH2536LdtPSlXtywfNV1HEr69V/AHbrEzfoQkJ/qvPzELBOjf
jwtDPDePiVgW9LhktzVzn/BjO7XlJxw4PGcxJG6VApsXmM3t2fPN9eIHDUq8ocbH
dJ4en8/bJDXZd9ebQoILUuCg46hE3p6nTXfnPwSRnIRnsgCzeAz4rxDR4/Gv1Xpz
v5wqpL21XQi3nvZKlcv7J1IRVdphK66De9GpVQVTqC102gqJUErdjGmxmyCA1OOO
RqEPfKTrXz5YUGsWwpH+4xCuNQP0qmreRw3ghrH8potIr0iOVXFic5vJfBTgtcuE
B6E6ulAN+3jqBGTaBML0jxgj3Z5VC5HKVbpg2DbB/wMrLwFHNAbzV5hj2Os5Zmva
0ySP1YHB26pAW8dwB38GBaQvfZq3ezM4cRAo/iJ/GsVE98dZEBO+Ml+0KYj+ZG+v
yxzo20sweun7ZKT+9qZM90f6cQ3zqX6IfXZHHmQJBNv73mcZWNhDQOHs4wBoq+FG
QWNqLU9xaZxdXw80r1viDAwOy13EUtcVbTkAEQEAAYkCPAQYAQgAJhYhBIWb6NfF
hvU4QwsZwkZ7lC06eb0pBQJhuLq3AhsMBQkDwmcAAAoJEEZ7lC06eb0pSi8P/iy+
dNnxrtiENn9vkkA7AmZ8RsvPXYVeDCDSsL7UfhbS77r2L1qTa2aB3gAZUDIOXln5
1lSxMeeLtOequLMEV2Xi5km70rdtnja5SmWfc9fyExunXnsOhg6UG872At5CGEZU
0c2Nt/hlGtOR3xbt3O/Uwl+dErQPA4BUbW5K1T7OC6oPvtlKfF4bGZFloHgt2yE9
YSNWZsTPe6XJSapemHZLPOxJLnhs3VBirWE31QS0bRl5AzlO/fg7ia65vQGMOCOT
LpgChTbcZHtozeFqva4IeEgE4xN+6r8WtgSYeGGDRmeMEVjPM9dzQObf+SvGd58u
2z9f2agPK1H32c69RLoA0mHRe7Wkv4izeJUc5tumUY0e8OjdenZZjT3hjLh6tM+m
rp2oWnQIoed4LxUw1dhMOj0rYXv6laLGJ1FsW5eSke7ohBLcfBBTKnMCBohROHy2
E63Wggfsdn3UYzfqZ8cfbXetkXuLS/OM3MXbiNjg+ElYzjgWrkayu7yLakZx+mx6
sHPIJYm2hzkniMG29d5mGl7ZT9emP9b+CfqGUxoXJkjs0gnDl44bwGJ0dmIBu3aj
VAaHODXyY/zdDMGjskfEYbNXCAY2FRZSE58tgTvPKD++Kd2KGplMU2EIFT7JYfKh
HAB5DGMkx92HUMidsTSKHe+QnnnoFmu4gnmDU31i
=Xqbo
-----END PGP PUBLIC KEY BLOCK-----</code></pre>
</div>
<p>
The following GPG public build key (keyID
<code class="literal">
5072E1F5
</code>
) can be used to verify the
authenticity and integrity of MySQL 8.0.27 packages and earlier.
For signature checking instructions, see
<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>
<h5>
<a name="idm46045332763472">
</a>
GPG Public Build Key for MySQL 8.0.27 Packages and Earlier
</h5>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa25990340"><div class="copy-help left">Press ⌘+C to 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">-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: SKS 1.1.6
Comment: Hostname: pgp.mit.edu
mQGiBD4+owwRBAC14GIfUfCyEDSIePvEW3SAFUdJBtoQHH/nJKZyQT7h9bPlUWC3RODjQRey
CITRrdwyrKUGku2FmeVGwn2u2WmDMNABLnpprWPkBdCk96+OmSLN9brZfw2vOUgCmYv2hW0h
yDHuvYlQA/BThQoADgj8AW6/0Lo7V1W9/8VuHP0gQwCgvzV3BqOxRznNCRCRxAuAuVztHRcE
AJooQK1+iSiunZMYD1WufeXfshc57S/+yeJkegNWhxwR9pRWVArNYJdDRT+rf2RUe3vpquKN
QU/hnEIUHJRQqYHo8gTxvxXNQc7fJYLVK2HtkrPbP72vwsEKMYhhr0eKCbtLGfls9krjJ6sB
gACyP/Vb7hiPwxh6rDZ7ITnEkYpXBACmWpP8NJTkamEnPCia2ZoOHODANwpUkP43I7jsDmgt
obZX9qnrAXw+uNDIQJEXM6FSbi0LLtZciNlYsafwAPEOMDKpMqAK6IyisNtPvaLd8lH0bPAn
Wqcyefeprv0sxxqUEMcM3o7wwgfN83POkDasDbs3pjwPhxvhz6//62zQJ7Q2TXlTUUwgUmVs
ZWFzZSBFbmdpbmVlcmluZyA8bXlzcWwtYnVpbGRAb3NzLm9yYWNsZS5jb20+iEYEEBECAAYF
AlldBJ4ACgkQvcMmpx2w8a2MYQCgga9wXfwOe/52xg0RTkhsbDQhvdAAn30njwoLBhKdDBxk
hVmwZQvzdYYNiGYEExECACYCGyMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAUCTnc+KgUJE/sC
FQAKCRCMcY07UHLh9SbMAJ4l1+qBz2BZNSGCZwwA6YbhGPC7FwCgp8z5TzIw4YQuL5NGJ/sy
0oSazqmIZgQTEQIAJgUCTnc9dgIbIwUJEPPzpwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJ
EIxxjTtQcuH1Ut4AoIKjhdf70899d+7JFq3LD7zeeyI0AJ9Z+YyE1HZSnzYi73brScilbIV6
sYhpBBMRAgApAhsjBgsJCAcDAgQVAggDBBYCAwECHgECF4ACGQEFAlGUkToFCRU3IaoACgkQ
jHGNO1By4fWLQACfV6wP8ppZqMz2Z/gPZbPP7sDHE7EAn2kDDatXTZIR9pMgcnN0cff1tsX6
iGkEExECACkCGyMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAIZAQUCUwHUZgUJGmbLywAKCRCM
cY07UHLh9V+DAKCjS1gGwgVI/eut+5L+l2v3ybl+ZgCcD7ZoA341HtoroV3U6xRD09fUgeqI
bAQTEQIALAIbIwIeAQIXgAIZAQYLCQgHAwIGFQoJCAIDBRYCAwEABQJYpXsIBQkeKT7NAAoJ
EIxxjTtQcuH1wrMAnRGuZVbriMR077KTGAVhJF2uKJiPAJ9rCpXYFve2IdxST2i7w8nygefV
a4hsBBMRAgAsAhsjAh4BAheAAhkBBgsJCAcDAgYVCgkIAgMFFgIDAQAFAlinBSAFCR4qyRQA
CgkQjHGNO1By4fVXBQCeOqVMlXfAWdq+QqaTAtbZskN3HkYAn1T8LlbIktFREeVlKrQEA7fg
6HrQiGwEExECACwCGyMCHgECF4ACGQEGCwkIBwMCBhUKCQgCAwUWAgMBAAUCXEBY+wUJI87e
5AAKCRCMcY07UHLh9RZPAJ9uvm0zlzfCN+DHxHVaoFLFjdVYTQCfborsC9tmEZYawhhogjeB
kZkorbyJARwEEAECAAYFAlAS6+UACgkQ8aIC+GoXHivrWwf/dtLk/x+NC2VMDlg+vOeM0qgG
1IlhXZfiNsEisvvGaz4m8fSFRGe+1bvvfDoKRhxiGXU48RusjixzvBb6KTMuY6JpOVfz9Dj3
H9spYriHa+i6rYySXZIpOhfLiMnTy7NH2OvYCyNzSS/ciIUACIfH/2NH8zNT5CNF1uPNRs7H
sHzzz7pOlTjtTWiF4cq/Ij6Z6CNrmdj+SiMvjYN9u6sdEKGtoNtpycgD5HGKR+I7Nd/7v56y
haUe4FpuvsNXig86K9tI6MUFS8CUyy7Hj3kVBZOUWVBM053knGdALSygQr50DA3jMGKVl4Zn
Hje2RVWRmFTr5YWoRTMxUSQPMLpBNIkBHAQQAQIABgUCU1B+vQAKCRAohbcD0zcc8dWwCACW
XXWDXIcAWRUw+j3ph8dr9u3SItljn3wBc7clpclKWPuLvTz7lGgzlVB0s8hH4xgkSA+zLzl6
u56mpUzskFl7f1I3Ac9GGpM40M5vmmR9hwlD1HdZtGfbD+wkjlqgitNLoRcGdRf/+U7x09Gh
SS7Bf339sunIX6sMgXSC4L32D3zDjF5icGdb0kj+3lCrRmp853dGyA3ff9yUiBkxcKNawpi7
Vz3D2ddUpOF3BP+8NKPg4P2+srKgkFbd4HidcISQCt3rY4vaTkEkLKg0nNA6U4r0YgOa7wIT
SsxFlntMMzaRg53QtK0+YkH0KuZR3GY8B7pi+tlgycyVR7mIFo7riQEcBBABAgAGBQJcSESc
AAoJENwpi/UwTWr2X/YH/0JLr/qBW7cDIx9admk5+vjPoUl6U6SGzCkIlfK24j90kU0oJxDn
FVwc9tcxGtxK8n6AEc5G0FQzjuXeYQ1SAHXquZ9CeGjidmsrRLVKXwOIcFZPBmfS9JBzdHa9
W1b99NWHOehWWnyIITVZ1KeBLbI7uoyXkvZgVp0REd37XWGgYEhT0JwAXnk4obH6djY3T/Hf
D70piuvFU7w84IRAqevUcaDppU/1QluDiOnViq6MAki85Z+uoM6ojUZtwmqXDSYIPzRHctfx
Vdv3HS423RUvcfpMUGG94r7tTOSXhHS9rcs6lzLnKl84J0xzI5bWS/Fw+5h40Gpd4HTR/kiE
Xu2JARwEEAEIAAYFAlaBV3QACgkQRm7hv+CThQqT0wf9Ge3sRxw+NIkLkKsHYBTktjYOyv49
48ja5s9awR0bzapKOMaluEgfwtKD8/NCgYeIVYyaZlYmS1FP51yAtuzdvZXAI0DAITyM4d1S
RCESjCCiZ028eIEcoeM/j+UXrwo4+I7/abFhiSakzsFZ/eQHnsMnkJOLf8kug3vMXjSoiz+n
T14++fBK2mCVtu1Sftc877X8R7xUfOKYAGibnY+RAi7E2JVTMtWfdtJaqt3l5y6ouTrLOM9d
3ZeEMdYL1PCmXrwZ4+u7oTNC26yLSbpL+weAReqH8jGsVlUmWWMXvkm+ixmrnN66WvSLqQ6K
P5jWnowV9+KEhNnWBOaT4Iu8rYkBIgQQAQIADAUCTndBLgUDABJ1AAAKCRCXELibyletfAnx
B/9t79Q72ap+hzawzKHAyk3j990FbB8uQDXYVdAM5Ay/Af0eyYSOd9SBgpexyFlGL4O4dd7U
/uXwbZpAu5uEGxB/16Mq9EVPO5YxCR0ir7oqi6XG/qh+QJy/d3XG07ZbudvnLFylUE+tF8YU
Z5sm9lrnwPKYI2DIa0BToA7Pi95q82Yjb4YgNCxjrr61gO9n4LHDN1i74cNX0easl9zp14zS
acGftJGOrPEk+ChNCGKFNq/qr9Hn/ank29D8fzg6BLoaOix8ZzZ25QPMI/+SF4xEp/O7IoI4
dA+0m4iPz76B+ke0RTsgNRfVKjdz2fQ92l4G9yWwNulGcI3FBZTiYGi3iQEiBBABAgAMBQJO
iLYZBQMAEnUAAAoJEJcQuJvKV618tkAH/2hGrH40L3xRAP/CXEJHK3O+L8y4+duBBQ8scRqn
XS28SLfdL8f/ENH+1wah9jhyMC+jmyRldd5ar3cC/s8AJRvOSDRfR5KvagvrDLrrF+i/vYDB
K5f6JQrryq0poupEuK0zTbLxo1FX+CAq+3tQy8aY6+znItpiWhvK8ZoULYKV+Q063YyVWdBk
KadgELA6S08aQTGK7bJkyJ9xgbFBykcpUUbn0p4XZwzZ3jFgzwcmqRIYZbfTosVVLJ5HAb7B
u22AukPlsz9PZvd8X8nfmtoJIwtl5qtFOrxrKA+X5czswzZ5H3jprDqOY6yA0EStu+8h1CPo
u50BmP7yKZxdXYqJASIEEAECAAwFAk6Z2dEFAwASdQAACgkQlxC4m8pXrXwC8ggAgQXVkn5H
LtY50oXmh5D/KdphSKDM33Z9b/3MHzK5CWeCQUkaJ1gxtyLW1HWyLOIhUkW6xHdmieoA8Yr9
JS1r1jopYuGZztzlScQeSWr8190xnZZVIjKReVy2rDSxtv7PV5wR3gby72PmKWUw7UHfqtBr
JgA+h5ctfx1jhXIUtUZpDTStZAFgVmunDXoBNZtYYk/ffY1J8KTjNmrqRcRbTurSy3dgGAAA
Z01DIR5kJrh3ikFFJfrXz0qODoYOchxqI4Xoc7o8uv19GUuvk5sKBT4b2ASF+JXAMRX0T7v8
Gralhn3CGGQGpZDN2ldM1Mzbi5oSETTUQ87nN4I7bXirqYkBIgQQAQIADAUCTqumAQUDABJ1
AAAKCRCXELibyletfMCHB/9/0733PXrdjkVlUjF7HKpdD8xy324oe5cRWdEVhsDj11AsPhLv
c37M3uCf2MV5BwGjjDypVRX3hT+1r9VsuR201ETKmU8zhdjxgTlZ931t/KDerU9sSJWOT33m
wEX7b5Oj31hgqy2Bc+qOUfSNR8TIOZ7E6P6GynxFzreS+QjHfpUFrg41FgV58YCEoMyKAvZg
CFzVSQa2QZO4uaUIbAhXqW+INkPdEl/nfvlUWdoe/t5d/BDELAT4HEbcJRGuN/GNrExOYw/I
AbauEOnmhNQS+oNg1uSjlTFg6atKO8XgXNfCp6sSVclSRTNKHSmntHEcH/WULEOzsPUXWGWA
VC40iQEiBBABAgAMBQJOvNkcBQMAEnUAAAoJEJcQuJvKV618xSkH/izTt1ERQsgGcDUPqqvd
8exAk1mpsC7IOW+AYYtbOjIQOz7UkwUWVpr4R4sijXfzoZTYNqaYMLbencgHv25CEl4PZnVN
xWDhwDrhJ8X8Idxrlyh5FKt0CK53NT9yAsa1cg/85oVqZeB0zECGWgsVtIc8JmTJvTSmFVrz
7F4hUOsrUcHJmw0hfL9JIrxTbpLY9VnajXh9a8psnUCBrw3oO5Zj8Pw/aaLdEBuK5mB/OSYo
vmJ0f/BIp+cUp1OAnOyx0JzWNkQZWTmsVhxY6skBEd4/+2ydv9TEoESw207t7c3Z7+stWcTK
RUg7TrqHPvFkr9U0FKnHeTeqPhc8rjUgfLaJASIEEAECAAwFAk7Oo7wFAwASdQAACgkQlxC4
m8pXrXza3Af/QjONcvE3jme8h8SMLvlr6L1lIuWpHyWwcvgakRJwUojRrSVPghUAhjZEob4w
CzZ4ebRR8q7AazmOW5Fn1GoqtzrWxjRdBX3/vOdj0NvXqCFfTgmOSc4qz98+Lzuu8qQH9DEl
ZLyptv96tGZb5w82NtHFMU9LkkjAVYcDXqJ4USm90CApXqd+8lVOrWuM8NycgD0Ik3ZKZQXH
1DHdJFzohNtqbWGMWdjqwKHoBSHEsjZ/WarXEf0+oTLjZSbrymtGpPInsijHWD9QMOR55RwC
DtPW+JPPu5elLdaurjPOjjI6lol8sNHekjmDZmRI0ZMyjprJITg4AG3yLU9zU+boCYkBIgQQ
AQIADAUCTvI8VgUDABJ1AAAKCRCXELibyletfNeIB/0Wtd7SWBw8z61g5YwuG/mBcmLZVQFo
vGnJFeb+QlybEicqrUYJ3fIPj8Usc27dlwLP+6SU8BtldYjQ7p7CrQtaxG2SWYmNaJ50f6Eb
JpO/3lWSWiNEgF3ycFonoz3yuWMwEdMXBa+NAVV/gUtElBmoeW+NwKSrYN30FYmkZe+v+Ckq
SYwlg0r9+19lFwKFvfk0jX1ZGk6GP27zTw49yopW9kFw/AUZXlwQHOYAL3gnslwPz5LwiTyJ
QkxAYYvdByZk4GjOi+HzqGPspNIQEeUteXzfbPz0fWEt64tudegYu/fN5QVLGS/WHfkuFkuo
gwNBFcu5TPEYcwGkuE/IZZEniQEiBBABAgAMBQJPBAkXBQMAEnUAAAoJEJcQuJvKV618AG8H
/0LLr1yM6osbLAhOzcKmD//jSOZ2FIBXGKUmK8/onlu5sUcMmVVPHnjUO/mHiFMbYFC655Di
rVUKlIZb6sdx2E/K+ZkZHPWvF1BAaHUO/QGh3Zzc8lVJg9KtFLAJkmQkc61VEF2MriaRlvlo
VPNr5Oiv2THOPgVxdV3goBL6EdAdgdwCvy23Z44vOp0QVNQt4aJKg2f49XO/N1+Gd2mEr7wX
aN9DZQq5zTU7uTRif3FlXHQ4bp8TWBK3Mu/sLlqZYtF3z7GH4w3QbwyA2CWkGgTGwQwyU8Fh
JQdrqXGl0w0y6JusjJWdwT1fxA6Eia3wrSw2f8R1u6V0k0ZhsMu3s7iJASIEEAECAAwFAk8V
1NwFAwASdQAACgkQlxC4m8pXrXzijAf7Bn+4ul7NedLGKB4fWyKDvZARcys13kNUcIl2KDdu
j4rliaY3vXT+bnP7rdcpQRal3r+SdqM5uByROHNZ+014rVJIVAY+ahhk/0RmdJTsv791JSkT
FuPzjYbkthqCsLIwa2XFHLBYSZuLvZMpL8k4rSMuI529XL48etlK7QNNVDtwmHUGY+xvPvPP
GOZwjmX7sHsrtEdkerjmcMughpvANpyPsFe8ErQCOrPhDIkZBSNcLur7zwj6m0+85eUTmcj8
1uIIk4wjp39tY3UrBisLzR9m4VrOd9AVw/JRoPDJFq6f4reQSOLbBd5yr7IyYtQSnTVMqxR4
4vnQcPqEcfTtb4kBIgQQAQIADAUCTzltCwUDABJ1AAAKCRCXELibyletfAo9CACWRtSxOvue
Sr6Fo6TSMqlodYRtEwQYysEjcXsT5EM7pX/zLgm2fTgRgNzwaBkwFqH6Y6B4g2rfLyNExhXm
NW1le/YxZgVRyMyRUEp6qGL+kYSOZR2Z23cOU+/dn58xMxGYChwj3zWJj+Cjw9U+D/6etHpw
UrbHGc5HxNpyKQkEV5J+SQ5GDW0POONi/UHlkgSSmmV6mXlqEkEGrtyliFN1jpiTRLPQnzAR
198tJo3GtG5YutGFbNlTun1sXN9v/s4dzbV0mcHvAq/lW+2AT6OJDD204pp/mFxKBFi4XqF6
74HbmBzlS7zyWjjT2ZnujFDqEMKfske/OHSuGZI34qJ3iQEiBBABAgAMBQJPSpCtBQMAEnUA
AAoJEJcQuJvKV618L1QH/ijaCAlgzQIvESk/QZTxQo6Hf7/ObUM3tB7iRjaIK0XWmUodBpOC
3kWWBEIVqJdxW/tbMbP8WebGidHWV4uX6R9GXDI8+egj8BY8LL807gKXkqeOxKax0NSk5vBn
gpix2KVlHtWIm7azB0AiCdcFTCuVElHsIrhMAqtN6idGBVKtXHxW3//z9xiPvcIuryhj8orS
IeJCtLCjji7KF2IUgCyyPJefr/YT7DTOC897E1I01E4dDymNur41NjobAogaxp6PdRNHBDum
y8pfPzLvF3OY4Cv+SEa/EHmCOTHTamKaN6Jry/rpofqtueiMkwCi81RLgQd0ee6W/iui8Lwp
/2KJASIEEAECAAwFAk9V2xoFAwASdQAACgkQlxC4m8pXrXy9UQgAsVc8HNwA7VKdBqsEvPJg
xVlm6Y+9JcqdQcA77qSMClc8n6oVF1RpI2yFnFUpj1mvJuW7iiX98tRO3QKWJIMjEPovgZcS
bhVhgKXiU87dtWwmcYhMsXBAYczbsSaNWhOIPwKHuQ+rYRevd0xGDOOl3P7pocZJR850tM9e
58O9bzdsRYZpFW5MkrD7Aity5GpD65xYmAkbBwTjN4eNlp0nHVdSbVf4Fsjve6JC6yzKOGFB
VU1TtAR2uPK6xxpn8ffzCNTA1vKXEM8Hgjyq4LWSdDTBIevuAqkz4T2eGJLXimhGpTXy7vz+
wnYxQ9edADrnfcgLbfz8s/wmCoH4GJAFNIkBIgQQAQIADAUCT2eDdwUDABJ1AAAKCRCXELib
yletfFBEB/9RmWSSkUmPWib2EhHPuBL6Xti9NopLOmj5MFzHcLtqoommKvpOUwr1xv0cZMej
ZenU3cW1AvvY287oJwmkFRFu9LJviLSGub9hxtQLhjd5qNaGRFLeJV8Y0Vtz+se2FWLPSvpj
mWFdfXppWQO/kIgVZoXcGJQrQWcetmLLgU9pxRcLASO/e5/wynFXmgSajxWzWHhMvehvJTOq
siYWsQxgT/XaWQTyJHkpYJoXx4XKXnocvc8+X3QkxAFfOHCwWhYI+7CN8znDqxYuX//PKfDG
2Un0JHP1za8rponwNG7c58Eo3WKIRw0TKeSwOc1cSufnFcrPenmlh2p70EvNRAINiQEiBBAB
AgAMBQJPeKdGBQMAEnUAAAoJEJcQuJvKV618YwoIAMn3uqSB4Ge1D61m0pIXJfOcC6BhCZvM
mV3xTp4ZJCdCQzjRV3rZRkt0DwyOVYpLzLgDgvbRwjXjOzm0ob1DvYHFA7DnGTGUsBLDX/xZ
5gRvDtkD6w8b/+r2/eQiSu7ey/riYwB6dm3GzKR7FEbIK6bEuPOUBwvV2tYkZRgTYqXq7NBL
uNv7c80GWhC/PqdvdhFn4KAvL0PjVIgr5+mdXyviKqG7uvguYBDtDUMX1qgZpi+fb7EsbJYf
EkBR63jGQw04unqT1EXWds17gj+yp4IHbkJmEJMS8d2NIZMPbIlHmN+haTA73DwNkbVD1ata
qSLiFIGXRyZy87fikLVIljOJASIEEAECAAwFAk+KdAUFAwASdQAACgkQlxC4m8pXrXwIUQgA
mnkFtxXv4kExFK+ShRwBYOglI/a6D3MbDkUHwn3Q8N58pYIqzlONrJ/ZO8zme2rkMT1IZpdu
WgjBrvgWhmWCqWExngC1j0Gv6jI8nlLzjjCkCZYwVzo2cQ8VodCRD5t0lilFU132XNqAk/br
U/dL5L1PZR4dV04kGBYir0xuziWdnNaydl9DguzPRo+p7jy2RTyHD6d+VvL33iojA06WT+74
j+Uls3PnMNj3WixxdNGXaNXWoGApjDAJfHIHeP1/JWlGX7tCeptNZwIgJUUv665ik/QeN2go
2qHMSC4BRBAs4H2aw9Nd9raEb7fZliDmnMjlXsYIerQo7q7kK2PdMYkBIgQQAQIADAUCT5xA
QQUDABJ1AAAKCRCXELibyletfOLsCADHzAnM10PtSWB0qasAr/9ioftqtKyxvfdd/jmxUcOl
RUDjngNd4GtmmL7MS6jTejkGEC5/fxzB9uRXqM3WYLY3QVl+nLi/tHEcotivu2vqv4NGfUvW
CJfnJvEKBjR8sDGTCxxZQoYoAFbGTP1v9t4Rdo7asy37sMFR2kA4/kU1FDxYtFYFwwZCJpNL
hhw0MCI2StI/wIwtA/7TiFCNqHHAKAGeSzKVyKrPdjn8yt7Js2dM6t2NUOwXQ563S4s6JZdR
lXUV9oYh1v+gFAuD57UHvinn6rdoXxgj3uoBmk9rWqJDNYgNfwtf1BcQXJnea+rMavGQWihx
eV40+BZPx9G6iQEiBBABAgAMBQJPrg39BQMAEnUAAAoJEJcQuJvKV618M4YIAIp9yNCVLGta
URSthhmmgE/sMT5h2Uga6a3mXq8GbGa3/k4SGqv51bC6iLILm2b0K8lu5m6nxqdZ8XNNMmY9
E+yYTjPsST7cI0xUzbAjKews63WlEUrj/lE2NEtvAjoS2gJB+ktxkn/9IHnqwrgOgUofbw6T
hymURI+egyoDdBp91IQD8Uuq9lX+I+C1PPu+NCQyCtcAhQzh+8p7eJeQATEZe2aB1cdUWgqY
evEnYNNK8zv/X3OMYl67YyEgofKoSYKTqEuPHIITmkAfn0qVsBA4/VtLbzGVGyQECmbbA34s
5lbMLrYeERF5DnSKcIa665srQ+pRCfJhz6VQXGsWlyWJASIEEAECAAwFAk+/2VUFAwASdQAA
CgkQlxC4m8pXrXwDOAf+JEUUKLiqO+iqOLV+LvI09lU4ww7YfXcqz4B9yNG0e5VprfS7nQ0P
tMf5dB7rJ6tNqkuHdoCb+w0/31pPEi7BFKXIoSgOz3f5dVKBGo8GBsX+/G/TKSiTenov0PEU
7/DlwvwmsGExmgmsSQgEWTA3y1aVxc9EVC9x0Fi/czcNNlSpj5Qec7Ee9LOyX4snRL1dx30L
lu9h9puZgm8bl5FLemPUv/LdrrLDqG9j4m2dACS3TlN14cwiBAf/NvxX3DEPOYTS6fwvKgLY
nHlOmKRCwlJ6PArpvdyjFUGWeCS7r4KoMCKY5tkvDof3FhggrQWgmzuPltBkTBQ7s4sGCNww
6okBIgQQAQIADAUCT9GlzwUDABJ1AAAKCRCXELibyletfDj1B/9N01u6faG1D5xFZquzM7Hw
EsSJb/Ho9XJRClmdX/Sq+ErOUlSMz2FA9wDQCw6OGq0I3oLLwpdsr9O8+b0P82TodbAPU+ib
OslUWTbLAYUi5NH6WW4pKnubObnKbTAmzlw+rvfUibfVFRBTyd2Muur1g5/kVUvw2qZw4BTg
Tx3rwFuZUJALkwyvT3TUUrArOdKF+nLtVg3bn8EBKPx2GfKcFhASupOg4kHoKd0mF1OVt9Hh
KKuoBhlmDdd6oaEHLK0QcTXHsUxZYViF022ycBWFgFtaoDMGzyUX0l0yFp/RVBT/jPXSBWtG
1ctH+LGsKL4/hwz985CSp3qnCpaRpe3qiQEiBBABAgAMBQJP43EgBQMAEnUAAAoJEJcQuJvK
V618UEEIALr7RNQkNw1qo7E4bUpWJjopiD00IvynA0r5Eo0r83VX5YYlAfuoMzBGg6ffKiCs
drHjEh45aIguu8crQ7p2tLUOOzKYiFFKbZdsT/yliYRu4n28eHdv8VMKGZIA7t0ONIp1YPd2
9pjyVKy4MOo91NfwXM5+tcIzbYL9g+DuhQbYDmy8TVv7KKyY/gqZU1YB6kS49lycQw8WCine
FoeD1fb6aP9u0MFivqn2QCAhjXueKC01M2O0jR0wu7jdojN50Jgeo6U0eIHTj2OQmznh8wYG
MX2o+1ybSTjjHIp3X8ldYx01Sa3AqwKEBclLdg5yIyAjHq2phROd2s/gjqrWt+uJASIEEAEC
AAwFAk/1PVUFAwASdQAACgkQlxC4m8pXrXwn3AgAjWUh31IxsQcXo8pdF7XniUSlqnmKYxT+
UZOP71lxeaV/yjY+gwyZvf8TWT4RlRp5IGg6aNLwLaDB3lcXBGuXAANGUr+kblewviHnCY3Z
+PWiuiusle+ofjbs8tFAr3LN3Abj70dME7GOhLyplP2mXIoAlnMDJ0AyrKx5EeA2jS8zCWCu
ziiOj4ZwUZAesXchpSO9V9Q86YiPtp+ikV0hmYgZpIXRNcHOpxnVyEW/95MFwi4gpG+VoN57
kWBXv6csfaco4BEIu9X/7y4OLbNuvzcinnHa0Pde5RnRlbEPQBBZyst2YZviWTFsbG8K2xok
dotdZDabvrRGMhRzBUwQEokBIgQQAQIADAUCUAZhawUDABJ1AAAKCRCXELibyletfDJUCAC+
68SXrK4aSeJY6W+4cS6xS//7YYIGDqpX4gSlW1tMIKCIWNhHkZqxKnWClnmvgGhw6VsZ2N0k
YdOnIrzEPWL7qplZRiE1GDY85dRXNw0SXaGGi7A8s6J9yZPAApTvpMS/cvlJO+IveFaBRHbI
RRndS3QgZVXq48RH2OlHep3o7c964WTB/41oZPJ7iOKgsDLdpjC1kJRfO9iY0s/3QrjL7nJq
5m14uY16rbqaIoL81C7iyc0UKU9sZGMcPV7H0oOIAy206A3hYSruytOtiC1PnfVZjh14ek2C
g+Uc+4B8LQf5Lpha4xuB9xvp1X5Gt3wiPrMzcH89yOaxhR8490+0iQEiBBABAgAMBQJQGC19
BQMAEnUAAAoJEJcQuJvKV618CbcIAJCXDbUt96B3xGYghOx+cUb+x8zcy9lyNV8QC2xjd9Mr
02LJTQHfJfQ9Td6LfuoRb7nQHOqJK1/lWE28t9tlH7I+i7ujYwA/fWardRzqCulNXrgFEiQK
ZFaDjRYyM0jWG/sA3/Rq2CMBNhBeCcTDuZ8VvRdm0xMPpyavP8D2dM9WBkPHOik4yAIILVkr
hWmr0Up0JhRoelfeyqcN/6ClUgeRMIyBYthA55fk2X5+CerommlpDfJJlFQOv64VSzS68NG8
j9yf66uuL3bB0OdzOMW6Yq/P9wskCDlMbYm/UnHfB5wAuxWpDeAvt/u+vU4xqqEjkUQGp03b
0v1xl79maSuJASIEEgEKAAwFAlWg3HIFgweGH4AACgkQSjPs1SbI/EsPUQf/Z6Htrj7wDWU8
vLYv3Fw23ZuJ8t8U/akSNwbq6UGgwqke+5MKC1fpk90ekzu5Q6N78XUII3Qg8HnfdTU0ihYg
qd3A1QmO6CG2hEz5xoxR1jJziRCbb1J7qEw8N/KzBcTkHB4+ag6bjFY9U4f9xU3TjPIu7F2V
Bk1AX+cmDo8yzPjDnP4ro0Yabbg0Q9xzvaK/7pFRz+vL/u/lxW7iE7n6vXTiaY1XnIt5xAXX
dwfLYmWeAgdc9KXFNlt4lfuqrETtNCHme+JI+B2Tz2gHmMVLHiDV59eLC0uU/uVsOXEd26ib
JC4f3KqY9kxuQm325kNzxnMxiwMPCVzsEh7lsYp+OokBMwQQAQgAHRYhBADTXowDFGilEoOK
6kPAyq+7WPawBQJasiYMAAoJEEPAyq+7WPawox0H/i96nkg1ID61ux+i20cOhVZylNJ770Vv
0zfXddWRN/67SuMVjLLiD/WfnDpw6ow6NM7vfEwbmvo1qeFF7rWWTPLm57uZfTk73un3fbaL
JiDZyrUStQKK/yhGAZmwulOQq7XBm+u8G9UcFi4XQxuoc5I/v/lUgbxXBADlxlfzpkIDwOaB
s23RDiMcWZGcosUkYHXlm8scU0tRANVLQ/PHgttlUl3x2PLzrdQm3YUDKUJ9+ynO2jN2sYwt
laSohj4UbLnq6pI4CXWZR7XWQs+NX7P3R359FDtw7OhyKoVuIkRFZljY0i3wQgwl/Sm2DAg9
3lsZDVc/avEUaOO+VuJuvJ+JATMEEAEIAB0WIQQGFx4znGT7HFjpuwT3iPLIbOWZfAUCXJ7Q
KwAKCRD3iPLIbOWZfGoXB/wN0P3m27fY/6UXTl0Ua3H+24ueUdLipsvR8ZTwEfnwkhLrbggE
0Em7ZuhZkzv7j856gv/tOekYYqWGg1CLalD3y371LAGq1tjY3k/g2RWLxLXNdzgXEyFvaNQA
oQa9aC2Q7FOyEMwVkkXrGa4MML7IBkrtMds9QPKtfipachPf6tQOFc12zHRjXMZi0eRWyQue
0sLLiJZPn7N8bBAJyZ9IJEpkhNrKS+9J5D1Refj++DwBKDh04kQXZFEZZhxcungQW5oMBQgr
uW2hULTLeiEV+C516OnwWJOz6XKJpOJp8PY0bO8pGgToGIYHkoX2x64yoROuZasFDv7sFGX6
7QxyiQEzBBABCAAdFiEEEN0MfMPATUAxIpzAoiiOmODCOrwFAlv/EJIACgkQoiiOmODCOrwg
uAf+IVXpOb2S3UQzWJLSQyWG0wQ51go4IBVpHv6hKUhDFj47YdUbYWO+cgGNBjC7FVz54PUM
PIdxImGHE1NHH+DNR8hvvAi+YpnqqdT3g+OgZ6XoYevret5B2b5fRgN1/HWUjaJ/n5g6SMsC
+3DrmdMu1FEDnKv/1HwQvOQXKt/U2rXE1ILOmVdMavRJEwkrk2SVwbdeass2EInZVsmWL+ot
9dU5hrkmLAl6iHUoK6zF6WaI1oi7UU2kgUF2DNyZG/5AumsNhxE608EAs1zEdN8wibXL48vq
Z4Ue9GvImokdlq/r/4BMUdF1qLEZHBkbaklK1zXxl7uMiW3ZIcqpg5HgwYkBMwQQAQgAHRYh
BBTHGHD/tHbAjAF4NhhrZPEl5/iCBQJZ+o/oAAoJEBhrZPEl5/iCyfMH/3YP3ND8jFqIWkmG
JaITHP9GhAQda73g7BFIrBHeL033tcLtUbEHXvnIZzulo7jiu9oQBjQvgGgIl5AqH1m7lHaD
iAL3VmuUFZ4wys7SODHvSZUW1aPLEdOoLKeiG9J6elu0d/xWZmj86IaHMHrUEm1itMoo0m+U
MwVNLFNZrAjCn82DiS6sS0A52tOlpq/jR4v9AYfMZSnd1MLm/CZaZpzWq6aqm7ef7CDfsUvU
w7VsL3p1s+Jgo6+8RwQ1W2Lgt5ORthvpjPKE1z0qgDpoXTkPOi8M20taD5UZbpByzMZPJXXr
+LBrRbs48IcPVHx8sxHMh1HsQCiXHDGiTNSaJ1qJATMEEAEIAB0WIQQazDqcUxAL9VrKN9zD
LyvJ+reoRgUCW4YZiAAKCRDDLyvJ+reoRptWCACoIgFrvhbr3c1WVq16LJ8UmQLk/6uFFZPN
CiR6ZbvzOd+a3gk1G8AhDEW2zoNhFg9+I7yqUBGqn+B1nDZ6psyu8d5EoRUFTm3PghqEccy5
KixqoPxBTquzkKGbN8PDLUY5KvpTOLLlYZxlHzSHw4roPsU4rxZtxyu98sSW0cm47VPr069p
91p9rCoHY8Fng7r3w28tVfvLuZ1SK4jtykIvw+M/pVBk9rQVCAJ0JjkAHkTOpkHqsVBYhtu7
mzsXfkQZkeuxdNx6X1fMrbJofzH0GYTT8Knn75Ljhr3hozrsL4Kz4J9gsLHCjkD5XKzLwCFK
R6UhhZZr7uhufbqZIyTLiQEzBBABCAAdFiEELLeCvUfxyJI8qMqHHSPVZ6Jn8NcFAltZjFMA
CgkQHSPVZ6Jn8NfKSggApk065wFrxq2uqkZKfJGw2mdsGeDVjGq9tMKUWeYVxTNxjiYly8Dc
/jrOS3AU6q7X7tAAcmvaXoBfW3xEIXMSH73GeinVG7wnlab6GKPDRKJzXfJ88rF07pX8R1pc
ZH+eikiFsN9bcnEycH82bonS7dzyoo6yg2zBqNtsmWYLDg2hcoTw4UHAPwdX6+n99m3VzOqO
8ThQI9hqpUYGvP5qyYahFf+39HSViof+Kq5KKhvSoiS9NzFzYZ0ZszYt+2jozUpAM6XqtEGu
TMzXHkE+/V4yI3hIsvHNkXKgDrqjwA+UmT1R4/gBoiRhZ8r4mn1gYI08darQmkppf9MEbcDz
U4kBMwQQAQgAHRYhBC1hIxvZohEBMIEUf5vAD7YffmHCBQJcns2XAAoJEJvAD7YffmHCC0UH
/R8c5xY96ntPI2u6hwn5i0BGD/2IdO+VdnBUnyE4k9t2fXKDRtq6LAR2PAD0OehSe4qiR6hw
ldaC8yiyg+zgpZusbCLGxbsBdYEqMwTIeFsa8DyPMANpJ0XLkGGf8oC7+6RuAJvlm6DRlurr
U93/QIG6M2SNsmnPgSZWYV4Y5/G7Xxyj0Fc3gNjjjGGP61CBR01W6rgNPn35sZ9GYCZcGlQA
GGrT8mSVoUhPgPCXKz2dZDzsmDHn7rULB6bXcsHiC/nW/wFBpoVOIFIxND0rb1SYyJzPdPtO
K6S+o+ancZct8ed/4fUJPBGqrBsuFS1SKzvJfPXjHGtZBitqOE7h57SJATMEEAEIAB0WIQQt
9h/1MHY0zPQ0K+NHN096zf0O3AUCXK2H5QAKCRBHN096zf0O3OJtB/wKbQN4IjVNkmWxSaBc
JABRu/WSbNjoTo/auJV6IRUBpwR130izMw239w5suuWx1phjPq3PdglBaKKeQNdeRoiudUjd
hydON1cq2wh9O073wU2GHeZLi48MopUNksrhHfd/XWV//0LcSpERsqIBVIUi+8DHwFvpCzCz
zIRg9lOcQmEtJAFFUtkF9FEeZgO2NPO3fEwkjKDeJYUiB+mD9BliyxhU8apUx/c2zaFGQOCr
MllN/gHztAWDcIadK/tujqRWR4wnJ0+ny/HP+bWd18+YjhcWzUQ8FytG+DA3oylQ1d0w0emt
qfn0zqiFkJQdG0M4qtItJYEYHlYpG2yoQHcCiQEzBBABCAAdFiEERVx3frY8YaOOhcAGjZrN
vi2vIgUFAlnScGAACgkQjZrNvi2vIgW5IQf8DKjeoHF9ChDcb4T01uJJiAUu6lxewSRD7iwD
6MjCsaxgMifTD7Bzvdem4finoOul2YAPtlLfIfVtVRtGG97R/Wvs3yjI9NSzxkDGuuE7/IIi
4dKlcKkvijg7G6A8+MGXaQTw8iOePI/44IyG5yogKjno7L4h0f3WguGzmCRUJcgYm23IsaTh
Pvdq39ARyHAlrk0hXZ+OqsYBrlW7KLyPrbPA3N+/2RkMz6m+T8ZksOrEdF/90nC9Rky4Wbg4
SJqWQNNSMfgT0rQL2Qvne598FKmltrTJuwBtIrSeuL/dbKt+hkLgnRjnmtA5yPaf0gXvMtfU
P9goQMWD+A2BU/bXJokBMwQQAQgAHRYhBFBgHh7ZZZpG0pg7f1ToXvZveJ/LBQJblegpAAoJ
EFToXvZveJ/LS0YH/jpcVprmEGnqlC0mYG2MlRqeK4T8Y6UnHE2zBPc125P4QcQfhgUJ98m4
0B5UkzljreFr9Zebk3pE8r4NBsamlJvi8sGbZONTsX4D3oW9ks0eicKOcTZJgtX5RmSNFh63
+EHbqTneK/NTQIuqRSCOufqCOH6QY1PVsICBlFZUPMfuxRlO7EwHKNIHPVBZNlM7AXxdjCMU
kXvda8V14kActb1w7NWxWxo5q4hkQ2K3FsmbWXvz+YBhJ8FnRjdzWNUoWveggOD6u4H7GuOg
kCyXn1fVnbCyJWsXQT9polJRnIAJMAtykcYVLNS/IS65U+K1cMshcF+Gil9BuGyckbRuNaSJ
ATMEEAEIAB0WIQRh2+o6RdTFb7cSlWG3d+zE2Q5m7gUCWdJutAAKCRC3d+zE2Q5m7rgJB/9k
c+prmrnjsq/Lt6d90LqYoavvIeFkAoDhhWgQeEOAD1wgyHIpS6qoMKgvBlvda2r0bmk1kUL2
xQaiDj36wB5yJHauOnFX+3ZJ6QCYUaeoWtqO2ROHvTiuyUdVKC5NtKaHpM1/lP/jl/1ZRWay
idggH7EnwDMt+9O0xD02n5J29Vp9uPO1GtMVsVSiJCGcOxwNBgNiXX1BpZbN4bRm5F8DAGiN
v4ZI69QZFWbpj8wFVJ/rV4ouvCFPlutVEAuIlKpAj35joXDFJhMvPpnPj84iocGqYPZHKR6j
a90+o8dZw3hXObFowjcxsJuQUTVkPuhzqr6kEu1ampaQ8OGpXCZHiQEzBBABCAAdFiEEZ/mR
TQQxCZjglXUwgzhtKKq2evsFAltbmWkACgkQgzhtKKq2evsdrAgAubfuG1vWX3TTG/VYYrfM
1aS1Roc034ePoJHK5rLT0O/TnnnObw38kJM1juyu4Ebfou+ZAlspiWgHad62R1B29Kys/6uC
qG2Jvbf716da4oLXeLYd9eb+IKVEiSb2yfbsLtLLB0c/kBdcHUp6A1zz0HV8l1HWj1Wx8cFU
MV7aAQoOfnNBbnNWLzNXXLYGHh47/QmjifE5V8r6UJZGsyv/1hP4JHsQ2nqcM8Vfj+K+HEuu
nnxzgWAcQXP/0IhIllVwoWhsJlHW+4kwW02DDopdBfLTzCtzcdOkfBcCg8hsmC4Jpxww5eHm
saY6sIB32keCpikVOGwdGDbRH7+da8knzokBMwQQAQgAHRYhBG4VA/IlW5kLV/VchhLcHkBr
mersBQJaX4N4AAoJEBLcHkBrmersksUH/3M0cypXBnyGIl/yE576MDa0G1xJvciup0ELeyhj
48Y7IAr7XiqDtiPt8tlIiPFF8iaw56vJw5H6UKraOcjZHOH1SwDr5gAWJgMqnqlFX/DxVKif
USt81KX0tHN6t6oMESgm2jRKvcWjh6PvEZlIArxZG4IjrErqWIJjUJR86xzkLyhRVTkUL/Yk
uNl1i013AlaD/0CGuAnjrluUUXypadtNr7/qsBx8dG6B/VMLWToEDEon76b8BzL/Cqr0eRyg
Qz6KWi3hmsK+mE4+2VoDGwuHquM90R0uS9Z+7LUws24mX5QE7fz+AT9F5pthJQzN9BTVgvGc
kpI2sz3PNvzBL5WJATMEEAEIAB0WIQR00X0/mB27LBoNhwQL60sMns+mzQUCWoyYfgAKCRAL
60sMns+mzYgnB/9y+G1B/9tGDC+9pitnVtCL2yCHGpGAg+TKhQsabXzzQfyykTgzCHhvqRQc
XHz5NSgR0Io+kbGMUUqCaen6OlcORVxYIuivZekJOAG+9kiqWRbyTv4aR6zvh8O5wCyEhhyi
ifi65PM7y9lD6i22qTt/JoDnFkP5Ri6Af/fZ9iaIaluQKJCU5xY1Lt/BorGlrGvX5KiZD8xc
AjhJRATZ0CJ21gbxISSxELAfH42KzGAvJw/0hARrMkl/eK0HVDpD47mcmC5h/O/HlwPYi0hn
xB+6/nuwwtRgMDBufNV0StU43njxCYmGI9/I1z5Vs+zhz8ypw/xCr1U7aAPZQdSSsfEViQEz
BBABCAAdFiEEelR8OpStCJs7bhrK1TniJxBsvzsFAlv+8d0ACgkQ1TniJxBsvzsiFwf/a3lt
OuSrFs4M03YVp6LoCM6CwZfvcFl+6B0TAurOiCja9lsNmbusSx0ad7bZy6/kHDXH/eqomXeu
O4hkxxBvGK3gZt7iQsr9vsUSbbJnc1zMyOZKlhdxAOLOskttqtPs6hiJ9kUHFGZe47V3c77G
GMgi/akIU5PkxhK7+/bbAsW0iK60aXCZ5nAbWlzTQLgJnYrlk4b920rzGe8nDTGzGmSjIGnb
YvuD9ZI40DZRWVf1tXqCY643AXFYoOhRxj54uHnMLYhc0I65u2ZGwRiTI0g/en5E8i7WoejA
/sR0+cYs7l1IJwlNRwfqmnJWRGREEHcJ3N52k3X7ayq3qmr3K4kBMwQQAQgAHRYhBJSRYHFB
cqf4Tl2vzE+YN4Ly8sn+BQJae/KHAAoJEE+YN4Ly8sn+5ckH/juc2h7bC4OGmRHcZBLAG2vW
WEMTc8dAr9ZyJYXzR25W1/Cz/JXgJgMjSrE6m9ptycpvWc6IRlrQM/IqG+ywYFPwNp3PYsc0
1N33yC15W7DPRDTtJE+9yUbSY9FeYraV4ghxiBxD1cDwtd7DFNGNRvBDH7yQHmXBW0K8x6yX
Mwl1gj2/MvdFUKmz8Lku94OmrbDOi83cnAjUNbN15Wle7hWAIRALt3P1VusjV/XyzxvcSffb
mt3CgBCyK9CNyEr27CVkhZ8pcabITx9afMd1UTEii90+qzgcJwcR46bJPZBdavMt56kVCeC0
kG44O3OOk+OahKXzw4YspZMO046gYRKJATMEEAEIAB0WIQSm5fcyEkLUw6FcN0ZJlMJhNZ28
bgUCXTJMCQAKCRBJlMJhNZ28bsgCB/96PlBUdsKgnh/RpmPB+piFQf6Og+97L4fxHuQbzKOe
UNCSWNF7saVa5VaPxbV/9jDCTPZI5vBtnJebXtkmLoWFSZaXCYb49SijfvRsRAeX5QSqIRd4
3KMuO7nAvbPVYtMChCO/g1T3riF2icC6pgvmNZWm5Nu4pkLzRmQv8U33BAkL7EYIjZZaC/9h
o4Sh4l/gLNItOxMdsD34sJwBLvEi1pQOa1xNJ4kfQSRD/8ufakE5wfSie/s04w/2Cp7RD9H0
VlD+7FwPO1HQ3XJjONvOzj6uVdwCC5fcmbXbb2bbJ/xe4YVL3xmwWz5m2w+kBSpaZ6VHNocB
8S2OmIIPpr7OiQEzBBABCAAdFiEEp6WxZJrn5Z0o967I/htVRVZtQSYFAlqnkGEACgkQ/htV
RVZtQSYV2Af9E7FLIUi8lqOyYyZuX6skkNf5rNSew+7i5NsiNpQzZMdscJh9eJzyLrePLp7q
9HUOhMF/Fc0SgbDtKSWbfSidXkeaQ2twPj4rP1xxYBc0OY0OX4fNVA5O/pTI9nxIVQCDTljl
/WIY+fnj88lCkaKWoRJITaotjFmYt+gbJMBn3MMYf0VODeIRozV7//NdkzFXKmJ3fsCDGXXF
CVWM1Fn3M91o1fh3FSgKd+0sexUDn5afwWCqjGgiXDsE7fEdwsbnz1rDzWvuqCoZyIh1RXQf
QVbiakpzfvtDytC3Vo6F2KzpZ9d69Adhfn2ydAYxL/Xuvk9pWdEBNF4T+HfS9Z30BokBMwQQ
AQgAHRYhBPJCF6TG7RrucA13q1lkfneVsjZHBQJawgLrAAoJEFlkfneVsjZHgNsIAIaSJ3gF
tBtf0WLxYIo5zhNclXOnfgUUNjGrXHm5NxoI4Eulpx9dQYCJ++whMFbxpZQTgFAUq8q342EZ
raLCWwALZEZmkZjv+FX6bk8sgqZESpUOLJAIqpobKpaawOQ7LS+XWO0SchH1oLFAgDyBeIDZ
N/LiTlIdkJe1xpDQDtgUHawksqMCbIaBe60B5xvm1NkhnrmnM1p+e3LUd4j+XxACdcY5LSqV
zVT4OyD1WkKzk8EAASUI8xysNBEeX9/8/EXaAciECQb3MkYxTQZ4WqCLU0GCGl6Sx2fY5zI6
4Y1j/Sfn3JHikJots8eR1D/UxrXOuG5n9VUY/4tTa0UGPuCJAU4EEAEIADgWIQRLXddYAQl0
69GnwU+qS4a3H5yDGgUCX6xjgBoUgAAAAAANAARyZW1AZ251cGcub3JnYW5uaQAKCRCqS4a3
H5yDGkRfB/9z/5MuAWLwoRLJtnJQzEOW7jsfzYpepL3ocT9tdGcs8jJTH3vh2x4Kp2d0Zaxx
Zs7R8ehZO5XJQ/DWdhH+7cifoeXmAEqDnlKSXZQZY/bG054tM6zes3tFTH3dCrn7LF59fQOG
OaZHgbFRQJO6F++90Mj9WAgeqGxyEhAlFIxFw4Cuul8OZAUIfq7YISnpkg2Tm/Q0SRRDJE4i
/7WJE/HVMB0Rf9KJXuk2BJlRIpQz8Cf+GVZ5aGIlXdM58QknprnollxoTKhrE74rAGHW7nRD
xIxOoP8odiXbLzn//g2m123usqncCKWZONDdVupax3RQ7xsIuFc9Kx4OtjwPQftziQFOBBAB
CAA4FiEE6hBKAqPbygqOC7fUwpbDMFwG9MsFAl8u+m8aFIAAAAAADQAEcmVtQGdudXBnLm9y
Z2FubmkACgkQwpbDMFwG9MsIvggAhRfd2Z5WLR6hGxOHu+A+ysjX6xKjcqshCYr8jRuOflFN
vxugQQoFM5pQr15TyhokaU78aDUoIbLnKcxxmH1l4hXxcRtg/9Y22TidOVN4jjNbc69KvCC4
uANYuAJaI3o5fb1jv8Lx82OiRDMhtRqyTdSGdU5//8X5FXCt+HhhzpSNoNtpxyhsKP0PAWao
zuETqvxy7t0uy0f1OTbZLI5nb52DxjBdZlThnJ2L9RwR2nSGhxjhTFg8LrZWgWNtY5HG+vk9
qbCwaC6ovNJ0G98i0DMrlbyGCbxa4Rv332n1xPfl/EPYWmNPlMu0V3bSCqxVa5u3etA5fw3r
qIm333vgFIkBswQQAQoAHRYhBJTatFFgHAZYHkTw9GcRGDP/RljgBQJa7LubAAoJEGcRGDP/
RljgNu8L/jN8j4HSggpnzJ0+3dFjVg7FUHJF6BZ84tv9huhmyrByaIrEfFf9ARn8OizKgdpC
/wJT1+KXarvsxdnEDlYSat3HS/sEw3BmZjAeTwPi0ShloiSjYgYRbg3irDskqUHML4hhvMx0
x9nZIag2XoSSH7kPEd5jOb8cd7jJeoGg6Z9Z9lMHuyqTGi0T/EbnhjQfVTxWkSkcDvdxbSuW
D96mvZrbRnrMebXKkISb0uVUn3/o11iUo9jXs+Q/03Tb9i0H3eOliP1kcB/kggu9xblIPM+J
VaK5Z+zAVLPKTQJi+sP/ayEux0xZzfbZ96WERnzT4E7Wwv8MvaLbybtID28Oy9YoBBYv7CrC
tyfrHh1t4v2AedRSZcTPKAaQ5NtLAvIdex0kOvvofaGi+7nmgV00vCZFBSXetvBMZkCapW09
vF7wcahaXpF+0Spl9vE2JiesST7uQobCUm1EjxJP0vMDcO1vIfJHlbIhB/f3PE3rXZIzYTdL
s3Kb4OONaUfNy9jYtYkCHAQQAQIABgUCVJqcUgAKCRB3MepTnaVyot2+D/9wAQ+p03lVMpYS
gMWMNLgjq3z7QrN0NYNpxUXAonxECjUzZKSUPGci+fPKxl3ZUenk+ruLgtgJmjmUOR6u1Dov
BpDFzhfqbIpjgtMDrnY5sWqxJ+CH2Rb5okEEDJ5qE9DwIMP5iXbf4xjnBOyPiq3sp983PLvy
8ttidWe9FDf8JuhWLHRJHODQjc6LufcHSWKG9fLmCjL2KSPNl696MwR+N95EKCivLL2PlG8c
f08Xd8lW1S0cJLh/6TEuZtAnVeo0NUOGUXOPPyhTPP/xhfLeKbkxjtm6rg/jBaIjuuQgUyNN
hKnP96/GRWWRHvio6eBPalhUcvImSrCHnqLRpdyMxmK67ZzKZS3YsH0ixozJYE0mNevZ2hEY
wB+O5HllqK22YwvJnCLH2ZZWTu2TCUjGZP8hbo2nSoyENlxZio9Gl/v4ypjdlgwrjnnZvxoM
yOFeuc47AuzP5QjhtlrWv12C4hYi3YLZvkLVFD0CxAE/CDuHk/4eFG4UC4Mor6+BXwVG7NEl
4qQWrAHjLQ2/sHMpsUqY/5X7+StG/78PLP0HP+PIBCDDTa7W0+6kf0EaGVHKW43IIkVNI2Ps
b44tTT+Xhc2mHk44LuzL4Axlywv+CxP9NcKLNFwK4Ck1M8Np6cAKlu+Dw6gjOY1aGHgtdsBQ
cIqZj/+ETD0+9NkDXEoeDIkCHAQSAQIABgUCUliwpAAKCRCiKuTrQynFRXZdD/9vb+69OGSR
t456C6wMLgBl+Ocv9XeaCTiJjLgAL2G6bRH2g2VcNHnU/VMTD2YLVu0eP7ubsirVrmR7nAgL
sQ1mKKWvTI+p5aAvn4sL3x3P8vzmGoDAigZ458yGuVpVsBkSPjJBMAkMDfm9kdWxCanzuKXS
b59lfTg4EtcHPDzoSgABntASgfioVxP2TVPfre282cibeYS+RDlaMTVH25yElrWDuF2U1CVW
SMWY9mskr1+XjPnoO2jz0+jhKB7jyMMfSmJqzgcBNgezFbzX2fPmNnMZzEucVFFHmIhNVmL2
rOwc/s1tSHerG5YIdL3HOJek5xJljzjzFfDrdjmMMl+nO6nO78oePoLNdglQQSqn0yW6gZv8
EIIQ/N1nSi/LEW60z8FFxzoO8TqxMMX9QRLbVE6p+7C0nqolhZf6UEiDIIm+PihF1vPFSV54
+7OoLObCshe2g4pbRGWPhIJ4X3ILBQwFMZbn+cIuY3h3B/UpbZE/YSDgRFu5TLtCfBE/lQKX
7QhJknJhQhJ+Dx+Y8h1Cx61Qr0KP5DmOkHYZfAQtdacgrqEr/qNen4QYRdKp0gTne8AV7svB
8eI/8PkzvUPaHrax0g6ZSbeWbvEw6czm0qUGJX7iMlJSauIJPrbOjvXT7qIsaqZRRiUSWXo+
m+jzK5qdeRhEIUmlJI/tU/RsGokCMwQQAQgAHRYhBEW+vuyVCr0Fzw71w1CgTQw7ZRfyBQJd
hy3eAAoJEFCgTQw7ZRfyRf4P/3Igs5dYm0fhposI5iwBGtN5SsxYTZGte2cZ+dXVcnLwLIZc
Ry1nDu/SFXPUS0lQBj7/Bc2kl8934+pUtte+B5KZI2s/28Gn98C2IjxxU+YZ1X1LbUkx0cPA
jFWjUh/JSfu6Hif2J0NAG3meySnlmpxl6oZeTojeWo1t39PF4N/ay7S2TqIjGSBfxvD1peIU
bnziKsyM5ULbkMdgHssQvyZvrVzQxacRzPK424jXtKR6B2oA0wqMcP4c69UmVKEKIzJNYrn4
Kjs+An8vZvJYAVbiWEyEseTTo3XJePdBNs1xxK2vWLA5PeLkE8bmzHr8iQ3hA0NaY7jSJp3e
GrhWIdXV+nfclrFUPghYr5z+ljCSK5sow+aRiED39qd1Y+0iUAy94cqY3MQ4ayGgnB/+YuSx
B5jNjCBYJetFWWSJXnkbiYRLjU88dflXCrTbhkSuCu3agOjsBJYUyg/c1Z4eCQgpTWB2cjYQ
0ucKOsWt8U6qsl12qwYLr0RfcP2aCwTTnWIxqIN9F6iMafOsG+za8JY+B8PDJxxwWWz8vCvX
ChTYrfiFei8oUqoHYTbw07cxaxkDd2CgXsQMmOcZSoXZZPAe8AhsUibDl+BZs/vLZT7HrXtt
/ggz8LzVCcyQqwmCHurvgjauwjk6IcyZ5CzHFUTYWUjvFqYfAoN15xUZbvPYiQIzBBABCAAd
FiEERsRGITzmkUU5TZu635zONxKwpCkFAlxFLcAACgkQ35zONxKwpClKVw/+PfrtIVHFsOdl
2crWBSo5Hifvx9Vn2nPiNKErygB+tPWDS4UwzVUnpZfXCM7bKJFFPeKbitYxN3BlDmVhZMkc
1DZMAtIPSstO2oX7Tv/C0WOZPlAWkp5m0DPV3iGbGZjwmy5wz8fNtaWyxtcUeaEXY8j151gm
Wfl1LMvgwnFsQ74xobnCpssLgmogXfoLFQNF/VUfRveJ2Ci8raWyAdXFBdAIrejawAx5MMhO
/lEfQ3W3f9bqtJZ5DzLbxQ3Xtqs+RY1ihv1y12lr9vLpgKKGmZ92KDvjv2UXHd7XZ90aPMj7
Rx0MQ1d+5d/tNQ8rLJGuj1I7NqHmLHMz67TvRtPl4aNP7Mss8OHiEKLYq23kGqXN+6cjG3UM
i290uJZaAnTno65Cgsyn7JFKyXDdTOmp3TSoyVsPFq92qgd/jFBf3dJj8c+mZEVXkUFeeUEK
31EMGFCH+oE8un7nu+XWqFyFSw5wn+PGYDXkSd6z/NyIN5DXa326KV+qpUmIWOlcymm7cmZ4
KJQt7zgWCxh2DuWQzRlTjeQd8Iw62V8tIOBokWP9Thes18Qk2GOUeCnvczLdevT4lqr8IzvV
nSwX/LQyxmmz2/dmPhzJ6kA6KQKGOSF6WnV/WuD4kESFKwtABFi6mYQi1F6CynpVw/nu535C
4fFG4d+A5G6sKJx//hjOCgmJAjMEEAEIAB0WIQRGxEYhPOaRRTlNm7rfnM43ErCkKQUCXa6e
YgAKCRDfnM43ErCkKfNXD/0cTEjvQlgyy3UI3xfhYtRng8fsRXcACjMajnrvYCoRceWwF6D+
Ekvh5hNQqrZsxrD6nozY+iJhkkaQitIj4qw7i4KY03fo613FjeLFXWqf4sfLTANSsRNxawEo
/JxP1JeOToOgYTkikWOkgZWSs/mqvHAxJZrVq/Zhz06OugfOYVGmGZonU7zP12toiwParIZ9
hcZ/byxfNoXEtsQyUHO1Tu8Fdypmk0zYUgZK2kGwXslfOGj5m0M5nfUuVWq5C5mWtOI6ZngT
LPJ32tRW526KIXXZMTc0PzrQqQvTFHEWRLdc3MAOI1gumHzSE9fgIBjvzBUvs665ChAVE7p2
BU6nx1tC4DojuwXWECVMlqLOHKjC5xvmil12QhseV7Da341I0k5TcLRcomkbkv8IhcCI5gO8
1gUq1YwZAMflienJt4zRPVSPyYKa4sfPuIzlPYxXB01lGEpuE5UKJ94ld+BJu04alQJ6jKz2
DUdH/Vg/1L7YJNALV2cHKsis2z9JBaRg/AsFGN139XqoOatJ8yDs+FtSy1t12u1waT33TqJ0
nHZ8nuAfyUmpdG74RC0twbv94EvCebmqVg2lJIxcxaRdU0ZiSDZJNbXjcgVA4gvIRCYbadl9
OTHPTKUYrOZ2hN1LUKVoLmWkpsO4J2D1T5wXgcSH5DfdToMd88RGhkhH7YkCMwQQAQgAHRYh
BH+P4y2Z05oUXOVHZQXCWLGt3v4UBQJhrDYPAAoJEAXCWLGt3v4Uh2oQAMS3sK0MEnTPE+gu
7lLi9rMbD/3O5nlAxBJLX4MzLi2xP1648YV5nq9WMMt6qyp+OVwDXefneYNMgfU2/uu/Wi/o
XTHBJuU36lmFzhRWPj2h/vtfgDIYG2wio0DNJyaUQwLEi6gqPm0AHhKS4td69R+7qyQsbUIa
BFgoytxFzxDb5o2hicEOXa573m4myfAdCx5ucYfq+jlXJW9Wgw7ERnF1v9xQDXiuryXWFRdv
UOOWzVPu9T0gPkcG8NABwqxs28Oc7n9Al9HM2FtDAkD0LIcm/I4ZEhFVqvG6Hj966+FeuICw
OaefFhthOoi3ycO+pkj1IePz/TmnsplTvvZOXH+6XEMPpPRQpvf5IZKJyrvuzoU8vkXYY2h/
gJHi9HiSIIQ/BVEpvp6UjXvIbNP1K31II88qx9EfT/tv434wlZpC6V1FzE2LtxyNcj/+OUvj
9hKOJ7lKOVpsnBbGiWg809s4sCIZ/ifLfWAKOJgxAEk/GcRkkkCqGNx7HA+coteNHqXLa/Lb
2/r8gGn6kH9YhQootJsGhhSsY+6CW5TM5E+FhSRJU7MFHRpA94N7Hn6OFUK2OXtHyRhxE867
R+ChJaZXbtoQJVNv2Rv9yoZrBki3RoQ6/6/fcnR1x2moTMYg7K8AMMv7ZCfaP6AjPOjTVnMV
CpNy1Ao7smOzLAfKbbeXiQIzBBABCAAdFiEEjy2YV7IZJ8NHv36cSrDCiwqTaaEFAmF9XbsA
CgkQSrDCiwqTaaFUGw//WSUO22Csa60I6VN8yJQmf0wCo9sieWDXCdHZ+CB0+gu0I3EMYR2a
gL8lqCd6M79fpP8DiLKOJvn9mhXCsjYjTJQUsuNi5kQ/O9gwarRsr7EjJ7R8u8lpSh9YPlMS
yN6XXfOa4Qy5HOw9idJdb3owKAXSjuRdi/hUExjA8TWliyWrfwiVDQi/aCoLZ4b9p6SfGR3Y
gE8UIZLZtdWgsPJHkvdvntTPi4fwMsadBfa2f+m4Wq2CAU5KSfYsVpKAwSQ1OsdUZUK7g+Ui
jy//ad7eZ+BAc75blHs7ua2iiF8Sc7MC55ZM5ldkv+0lqJ7td5vOCT1LKJg5PKKUC7YTTh9U
PHlERJ/SWcHNES1YhwLvUO2VROlPN9H1QkPnEMBOObpmYkNQyLBfFwioJ3ilptYY0IUX5qBM
5UkwgyqMsdyrL+2ozIYc+/A8KUnZXozOAG9LP8gBE5jBJSIkbqsi9Fumf7Q63++g4ojcYpOZ
F92X6kQMGqBvkvs8UajR5f/n6QH0je4XFPj4l4lVM/PPfZSShNGdOOi4l+KwozICnQ1+fhwh
N0VG4eALSJ6XQEEfJ18PrBRS3sdC7OVEMLevEC8ojSQeZE1lCLe1qAUoEcmgmXjsODaJn2tt
qNYYUxcFOycFnzgWL679C9FVp+DAg9jzDMKsqWo/Lt3IDNF19ZUc93WJAjMEEAEKAB0WIQSC
piWCWP+fBOH/9bx9bbut3FAu7gUCW8ygHQAKCRB9bbut3FAu7mOaD/9QJ1MiyKvw9rYqTvkU
OSDSLu88g6NP5R9ozgGZegInZ/NzT8u5emYccflnLlfvRQZPnT7YIH4+h25CCGQ5HzXUGENx
ndeuG4dm3B10A8hxv+abEM9VYDGqSIvF6z1xObvENOpMgmlmFdDi9O9d6jFFy4Hd6/BWejbU
4M3kfuD39RxaT1OEWfqvTVf4GKiLqM71glNB8WrTqxt2t/Mo2h6UPCF7/wPF/idMAbKEn0ye
b1WDCaZVXxAQETfNo129hPb2qxPGoCWGw24ySpGrM5We4Nd3bbdGItSZ0mATNM1+m9FY9j30
vpePFzzYGZ+23EcpxWU+7jWbjZ42ssCW6kx2/ERLVma7FuneEAqUc3gZr/3ZdZOVMvseg8c0
n66D/NRLgMcpOQK62qJfSrxQj6sJCGRY4dxAfdTZWrcxu8UvvcINezGIToQ0y+Mc5LM1vMOd
srXcaVnuJTfWorOeqnFecnClcOwKNAKBXjE8bSANUBKlrw0RIpye/IilrKGEMaYkP2nnnNZE
GPmumGkejDstWGmnHi5IogN8ibzyywsbNsO+qDdlUFA2bmVhh2uK7M95kyuMH3GnWbz4IiMx
RyUVEyK8yKnEmgOmLG4WiJjksP1jIPf3ztTEVVDJxy1gT3R36lsxd+OabnPOgiz1oFewKaur
aWX1e0E6eBWJ95ufookCMwQQAQoAHRYhBM8z5mfkMwAXdpGlbLdWs0L0i1qEBQJcBMl7AAoJ
ELdWs0L0i1qEmxwP/jDweTwTh1s+7Pp39L6aLB7nuQzdMleTksPGgmtguRBZipbOYOryEozK
9hI3Hq/ymV/loINv6GZhieDoZvxrv9eEKgO2eUE0IletSy7znlhV6MB7PBOc29dbCMf5L4qo
xUG/f+XfHkRZEkjZRWMlitlERlDU5gHAQ3skLuT9bu3aZkGdBgw0U5qjVvGzYxp2LFpNHXlf
TrlN3RZoDbRI+E9BPILqZFIZczp/fxRRNkXyogkrGD+0PANFsjySQKd/rr8/Z4isl3AM8CZ7
s4tMWM4EVJ2OygnrcMuIEJdXVsR0Ln1gJLuQ9HpWehve0d7/cIZkN7a0fqgE7bMvSPyxWL3m
yTA4FwdbrebBr2y7ixlXZ6WtX/rqTvo2HTDFLle0ZwMbbfAtoFX0M0lPtXTLmJAl5w1G8Nj8
bthWdN4KVFyOpqPt7OXc/G1YNLzcyYQXX5e8Uskmg40OH5cQV5OFEG8qpxTg53wANDdxXGzs
NUQe84Qkoyk75nwzVfsi00/OhTZmfIC48esXcs0kTrkSPrFcHktSMoYPmHfV3dTF17ifjz5a
C2SL22R+RokWuzGxxpvEaQAWIyCt6izf1a+CjnXPD2Jw3yDC/Oeg68XYiSrbeFdCRzQbS9YP
ipUFIlHuCiNZeGg3rFL2N2JodXg2LGORJz1RKazT7uAfRr5z7W1FtDtNeVNRTCBQYWNrYWdl
IHNpZ25pbmcga2V5ICh3d3cubXlzcWwuY29tKSA8YnVpbGRAbXlzcWwuY29tPohGBBARAgAG
BQI/rOOvAAoJEK/FI0h4g3QP9pYAoNtSISDDAAU2HafyAYlLD/yUC4hKAJ0czMsBLbo0M/xP
aJ6Ox9Q5Hmw2uIhGBBARAgAGBQI/tEN3AAoJEIWWr6swc05mxsMAnRag9X61Ygu1kbfBiqDk
u4czTd9pAJ4q5W8KZ0+2ujTrEPN55NdWtnXj4YhGBBARAgAGBQJDW7PqAAoJEIvYLm8wuUtc
f3QAnRCyqF0CpMCTdIGc7bDO5I7CIMhTAJ0UTGx0O1d/VwvdDiKWj45N2tNbYIhGBBARAgAG
BQJEgG8nAAoJEAssGHlMQ+b1g3AAn0LFZP1xoiExchVUNyEf91re86gTAKDYbKP3F/FVH7Ng
c8T77xkt8vuUPYhGBBARAgAGBQJFMJ7XAAoJEDiOJeizQZWJMhYAmwXMOYCIotEUwybHTYri
Q3LvzT6hAJ4kqvYk2i44BR2W2os1FPGq7FQgeYhGBBARAgAGBQJFoaNrAAoJELvbtoQbsCq+
m48An2u2Sujvl5k9PEsrIOAxKGZyuC/VAKC1oB7mIN+cG2WMfmVE4ffHYhlP5ohGBBMRAgAG
BQJE8TMmAAoJEPZJxPRgk1MMCnEAoIm2pP0sIcVh9Yo0YYGAqORrTOL3AJwIbcy+e8HMNSoN
V5u51RnrVKie34hMBBARAgAMBQJBgcsBBYMGItmLAAoJEBhZ0B9ne6HsQo0AnA/LCTQ3P5kv
JvDhg1DsfVTFnJxpAJ49WFjg/kIcaN5iP1JfaBAITZI3H4hMBBARAgAMBQJBgcs0BYMGItlY
AAoJEIHC9+viE7aSIiMAnRVTVVAfMXvJhV6D5uHfWeeD046TAJ4kjwP2bHyd6DjCymq+BdED
z63axohMBBARAgAMBQJBgctiBYMGItkqAAoJEGtw7Nldw/RzCaoAmwWM6+Rj1zl4D/PIys5n
W48Hql3hAJ0bLOBthv96g+7oUy9Uj09Uh41lF4hMBBARAgAMBQJB0JMkBYMF1BFoAAoJEH0l
ygrBKafCYlUAoIb1r5D6qMLMPMO1krHk3MNbX5b5AJ4vryx5fw6iJctC5GWJ+Y8ytXab34hM
BBARAgAMBQJCK1u6BYMFeUjSAAoJEOYbpIkV67mr8xMAoJMy+UJC0sqXMPSxh3BUsdcmtFS+
AJ9+Z15LpoOnAidTT/K9iODXGViK6ohMBBIRAgAMBQJAKlk6BYMHektSAAoJEDyhHzSU+vhh
JlwAnA/gOdwOThjO8O+dFtdbpKuImfXJAJ0TL53QKp92EzscZSz49lD2YkoEqohMBBIRAgAM
BQJAPfq6BYMHZqnSAAoJEPLXXGPjnGWcst8AoLQ3MJWqttMNHDblxSyzXhFGhRU8AJ4ukRzf
NJqElQHQ00ZM2WnCVNzOUIhMBBIRAgAMBQJBDgqEBYMGlpoIAAoJEDnKK/Q9aopf/N0AniE2
fcCKO1wDIwusuGVlC+JvnnWbAKDDoUSEYuNn5qzRbrzWW5zBno/Nb4hMBBIRAgAMBQJCgKU0
BYMFI/9YAAoJEAQNwIV8g5+o4yQAnA9QOFLV5POCddyUMqB/fnctuO9eAJ4sJbLKP/Z3SAiT
pKrNo+XZRxauqIhMBBMRAgAMBQI+PqPRBYMJZgC7AAoJEElQ4SqycpHyJOEAn1mxHijft00b
KXvucSo/pECUmppiAJ41M9MRVj5VcdH/KN/KjRtW6tHFPYhMBBMRAgAMBQI+QoIDBYMJYiKJ
AAoJELb1zU3GuiQ/lpEAoIhpp6BozKI8p6eaabzF5MlJH58pAKCu/ROofK8JEg2aLos+5zEY
rB/LsohMBBMRAgAMBQI+TU2EBYMJV1cIAAoJEC27dr+t1MkzBQwAoJU+RuTVSn+TI+uWxUpT
82/ds5NkAJ9bnNodffyMMK7GyMiv/TzifiTD+4hMBBMRAgAMBQJB14B2BYMFzSQWAAoJEGbv
28jNgv0+P7wAn13uu8YkhwfNMJJhWdpK2/qM/4AQAJ40drnKW2qJ5EEIJwtxpwapgrzWiYhM
BBMRAgAMBQJCGIEOBYMFjCN+AAoJEHbBAxyiMW6hoO4An0Ith3Kx5/sixbjZR9aEjoePGTNK
AJ94SldLiESaYaJx2lGIlD9bbVoHQYhdBBMRAgAdBQI+PqMMBQkJZgGABQsHCgMEAxUDAgMW
AgECF4AACgkQjHGNO1By4fVxjgCeKVTBNefwxq1A6IbRr9s/Gu8r+AIAniiKdI1lFhOduUKH
AVprO3s8XerMiF0EExECAB0FAkeslLQFCQ0wWKgFCwcKAwQDFQMCAxYCAQIXgAAKCRCMcY07
UHLh9a6SAJ9/PgZQSPNeQ6LvVVzCALEBJOBt7QCffgs+vWP18JutdZc7XiawgAN9vmmIXQQT
EQIAHQUCR6yUzwUJDTBYqAULBwoDBAMVAwIDFgIBAheAAAoJEIxxjTtQcuH1dCoAoLC6RtsD
9K3N7NOxcp3PYOzH2oqzAKCFHn0jSqxk7E8by3sh+Ay8yVv0BYhdBBMRAgAdBQsHCgMEAxUD
AgMWAgECF4AFAkequSEFCQ0ufRUACgkQjHGNO1By4fUdtwCfRNcueXikBMy7tE2BbfwEyTLB
TFAAnifQGbkmcARVS7nqauGhe1ED/vdgiF0EExECAB0FCwcKAwQDFQMCAxYCAQIXgAUCS3Au
ZQUJEPPyWQAKCRCMcY07UHLh9aA+AKCHDkOBKBrGb8tOg9BIub3LFhMvHQCeIOOot1hHHUls
TIXAUrD8+ubIeZaIZQQTEQIAHQUCPj6jDAUJCWYBgAULBwoDBAMVAwIDFgIBAheAABIJEIxx
jTtQcuH1B2VHUEcAAQFxjgCeKVTBNefwxq1A6IbRr9s/Gu8r+AIAniiKdI1lFhOduUKHAVpr
O3s8XerMiGUEExECAB0FAkeslLQFCQ0wWKgFCwcKAwQDFQMCAxYCAQIXgAASCRCMcY07UHLh
9QdlR1BHAAEBrpIAn38+BlBI815Dou9VXMIAsQEk4G3tAJ9+Cz69Y/Xwm611lzteJrCAA32+
aYhlBBMRAgAdBQsHCgMEAxUDAgMWAgECF4AFAktwL8oFCRDz86cAEgdlR1BHAAEBCRCMcY07
UHLh9bDbAJ4mKWARqsvx4TJ8N1hPJF2oTjkeSgCeMVJljxmD+Jd4SscjSvTgFG6Q1WCIbwQw
EQIALwUCTnc9rSgdIGJ1aWxkQG15c3FsLmNvbSB3aWxsIHN0b3Agd29ya2luZyBzb29uAAoJ
EIxxjTtQcuH1tT0An3EMrSjEkUv29OX05JkLiVfQr0DPAJwKtL1ycnLPv15pGMvSzav8JyWN
3Ih7BDARAgA7BQJCdzX1NB0AT29wcy4uLiBzaG91bGQgaGF2ZSBiZWVuIGxvY2FsISBJJ20g
KnNvKiBzdHVwaWQuLi4ACgkQOcor9D1qil/vRwCdFo08f66oKLiuEAqzlf9iDlPozEEAn2Eg
vCYLCCHjfGosrkrU3WK5NFVgiI8EMBECAE8FAkVvAL9IHQBTaG91bGQgaGF2ZSBiZWVuIGEg
bG9jYWwgc2lnbmF0dXJlLCBvciBzb21ldGhpbmcgLSBXVEYgd2FzIEkgdGhpbmtpbmc/AAoJ
EDnKK/Q9aopfoPsAn3BVqKOalJeF0xPSvLR90PsRlnmGAJ44oisY7Tl3NJbPgZal8W32fbqg
bIkBHAQSAQIABgUCS8IiAwAKCRDc9Osew28OLx5CB/91LHRH0qWjPPyIrv3DTQ06x2gljQ1r
Q1MWZNuoeDfRcmgbrZxdiBzf5Mmd36liFiLmDIGLEX8vyT+Q9U/Nf1bRh/AKFkOx9PDSINWY
bE6zCI2PNKjSWFarzr+cQvfQqGX0CEILVcU1HDxZlir1nWpRcccnasMBFp52+koc6PNFjQ13
HpHbM3IcPHaaV8JD3ANyFYS4l0C/S4etDQdX37GruVb9Dcv9XkC5TS2KjDIBsEs89isHrH2+
3ZlxdLsE7LxJ9DWLxbZAND9OiiuThjAGK/pYJb+hyLLuloCg85ZX81/ZLqEOKyl55xuTvCql
tSPmSUObCuWAH+OagBdYSduxiQEiBBABAgAMBQJJKmigBQMAEnUAAAoJEJcQuJvKV618U4wI
AKk/45VnuUf9w1j7fvdzgWdIjT9Lk9dLQAGB13gEVZEVYqtYF5cEZzyxl8c7NUTCTNX3qLId
ul114A4CQQDg5U9bUwwUKaUfGLaz380mtKtM9V9A4fl9H2Gfsdumr8RPDQihfUUqju+d0ycd
mcUScj48Nctx0xhCCWNjOFPERHi9hjRQq7x6RKyFTLjM5ftdInHCo9S+mzyqz9O+iMgX68Mm
+AVgdWSC9L6yGnw6H97GD28oRMGWBTzsmCyqf9I3YutH8mGXRot3QbSJD7/AeZVh1BQwVoJn
CT8Eo1pc/OYZkRRndE1thrX0yjuFwTeOzvqeHlgzEW/FtOCBW7iR0WSJASIEEAECAAwFAkoz
TogFAwASdQAACgkQlxC4m8pXrXwXiAf+Ked6Mgd98YyTyNiLHhllPulboCnKgj430jLzkfgv
7ytVCu1xMfKrRWRw3fA9LC19mzNQX/So/o/ywsk0nUG2sfEs5FiMk+aC957Ic/MDagmXqKap
ZROJbzbZ/KNj9rPCG9kXPGa9sUn6vk39nnv4hri30tNKpM0fMxRhpcoNoCrNl4rs/QTpdRpp
7KBuNaMEtDU7R7OjMDL4qT+BcCmYMIYW4dIV7tmaC0VxtcszZcVCkxSigRMPZHwxSx37GdCx
9/+TqlA4vGL6NQSxZKv+Kqa+WTqBngOl6YGO6FxdiXEliNRpf1mafmz6h8XgYXFGpehjuX1n
60Iz0BffuWbpL4kBIgQQAQIADAUCSkRyCgUDABJ1AAAKCRCXELibyletfPaaB/9FCSmYwz7m
vzOfHZOlEAYeLnCS290XGW89o4FYTbw0PBOulygyqj2TMCK68RCNU2KFs/bXBHeS+dDzitMA
fSaULYi7LJuCCmrDM5SX5aLSj6+TxkDQDR1K1ZE3y6qd4Kx3VeeoN7Wu+oLj/3Jjbbe0uYCQ
+/PniRra9f0Z0neTExZ7CGtVBIsKS1CnKBTR26MZMOom2eTRZwGFUX1PzuW/dbZ4Z0+J6XMd
Tm2td7OYYWPbV3noblkUrxyjtGtO3ip3Oe3zSCWHUFMaaEuXOMw8tN51wy6ybcPVAH0hOiBw
b3iCFJ/20QqaZEno6edYzkqf0pwvrcTmiPb+Vj0fnjBJiQEiBBABAgAMBQJKVj5HBQMAEnUA
AAoJEJcQuJvKV61845AH/R3IkGIGOB/7x3fI0gOkOS0uFljDxysiM8FV06BfXbFpRgFMZxAh
NFUdKCDN98MDkFBd5S5aGkvhAHS7PVwQ8/BIyJaJeUG3AXmrpFV/c9kYn1+YW5OQ9E7tKu5l
5UOj1Y/weNtC04u6Rh/nrp6CvMBhH2nvhSBZ+2kO2auqtFOhuK6+wUHGixt5EK8RAKs3Sf6n
kP2EJUHzy1Q8ec5YDiaV24AVkPFBZMCkpD3Z+seIGrL4zUkV7PPY4zd9g34Oqj8JvtnA4AD/
Z1vBLujLixcQdt9aieOySA9DAVgHbe2wVS4zi5nBURsmD5u96CUOwNK1sOV+ACtdIv/T5qSU
VweJASIEEAECAAwFAkpoCoQFAwASdQAACgkQlxC4m8pXrXysfQf+IJyIPhTphk0kGPQY3v9e
3znW30VahyZxoL6q25eeQWGmVeTFlU4JThUEyzgYGip8i9qBsFPJ9XgOL5bxTGv7/WOK7eX8
e+gXHB3A2QYbrM0GFZKN3BCkbA++HmvJXU58tf+aBCB0ObG+rPn6QUNSPibu4tp65TaPVPSV
HjNTTICxu3sneHB+okJcc5z1ubme8nAytKb6x0JM/keNSXAev2ZN7zG5m+Pqw7/DQ/gCogzG
ML1bulP2rSh8bYpJPC3vAVuHTmxsbhRBg4l7j5KiHf4qMBrVzRy+YiHhwpf2p8JbCGF141+H
UD1VMeGeXnNO/9SO+dC2OGUf8WrV4FIpxIkBIgQQAQIADAUCSnkuCgUDABJ1AAAKCRCXELib
yletfBjrCACDd/zvoveoNlNiUUBazelcGXwaxSvUMSROUQNkxkoMzfA+aFpYFHWEwDfLqndp
oJTIkgkESd5fODJT26oLFekLvx3mpzfGz8l39KzDM1i6+7Mtg7DnA3kvfVIuZBNDwqoTS6hH
KcGa0MJDgzZQqJ9Ke/7T7eY+HzktUBLjzUY2kv5VV8Ji0p6xY27jT73xiDov00ZbBFN+xBtx
2iRmjjgnPtjt/zU5sLiv9fUOA+Pb53gBT+mXMNx2tsg07Kmuz7vfjR5ydoY7guyB3X1vUK9y
AmCW1Gq67eRG934SujZFikO/oZUrwRrQu2jj5v8B7xwtcCFCdpZAIRabD4BTglvPiQEiBBAB
AgAMBQJKjl+9BQMAEnUAAAoJEJcQuJvKV618DTwH/3DzIl1zwr6TTtTfTBH9FSDdhvaUEPKC
bLT3WZWzIHREaLEENcQ85cGoYoBeJXVBIwBczZUpGy4pqFjYcWQ9vKFm2Nt1Nrs+v9tKc+9G
ECH0Y1a+9GDYqnepcN2O/3HLASCEpXFwQhVe01G+lupGgqYfMgTG9RByTkMzVXB9ER5gijGC
zjTflYAOFUx2eBBLYa3w/ZZpT+nwRmEUaDpfwq06UPrzMZuhol7SGPZUNz4lz4p2NF8Td9bk
hOiJ3+gORRohbq0HdaRdvSDoP/aGsQltfeF5p0KEcpIHx5B05H1twIkOGFTxyx3nTWqauEJy
2a+Wl5ZBl0hB2TqwAE9Z54KJASIEEAECAAwFAkqgEkcFAwASdQAACgkQlxC4m8pXrXwyXwf/
UPzz+D+n19JWivha7laUxuDzMQCKTcEjFCu4QVZ1rqcBFPoz0Tt74/X75QdmxZizqX1E6lbF
EsbVjL2Mt5zZjedS1vbSbrmn4hV4pHZr08dbflZkNX105g8ZlpsqQ7VyUt5YtWCn0tGNn4B5
Eb6WMeqxQteujV3B7AtMH+CD0ja+A2/p0rHIpqScz8aupksBMCrYqhoT+7/qXNEVkjNmcu2N
mHxfv6dL5Xy/0iJjie2umStu8WTfRTpYmnv2gEhbCdb/zhFvG61GgTBJqv9MvBVGRxnJFd4l
NqlucsadD+UM7WjV3v5VuN2r9KD9wocd/s22ELCRA2wKccvR/nWBkIkBIgQQAQIADAUCSqgQ
AAUDABJ1AAAKCRCXELibyletfAT8B/9cPhH8DlHoiv+cK8rAJMomZqVqOyy4BwsRrakycVlg
7/yvMs74anynSoUf0LgsXADQ29Hmrpf+zC5E5/jPGWNK81x2VBVoB8nZkMSAnkZfOw+mWu9I
Aj2NLcsvt9JYNmAq5R7RrirHsDQ2DIYxRgaE/5CVEVry9YQEj18A13/SYyoB4FWpDI4fRfUW
JbUJrYmfg0p+4zL0YS9F11UhsHUu+g1W1c83N54ozI1v0l3HUwVayzII4E/YNrIkpOaO+o8R
z9g6M6jCg3mwn+OfiZVJO++VOiguJF5KzoZIICMxXE3t5hL87Kroi7UkNwm+YHw3ZaLEBm0B
WAXw4DsJZcpViQEiBBABAgAMBQJKuceJBQMAEnUAAAoJEJcQuJvKV6188KEH/24QK2LV1l42
4Wx3T9G4bJFRWWuuEkTpYJw6ss72lqus9t7BsoGaNLMHQzKAlca9wLTqY826q4nv9anEqwWZ
+Di8kE+UAMUq2BFTL0EvOMJ6i1ZyE8cUFVb1+09tpBWJJS7t3z00uMMMznGuHzSm4MgCnGhA
sOgiuHdPWSlnHnqNJa/SB6UVQxtcDOaqQlLIvhd2HVqrOBRtER3td/YgLO6HSxXpXtz8DBa2
NYQYSwAdlqJAPLBnBsLXwbCswuIDMZZv8BJwUNBEJkokOMv5CXxhPrP5kxWvyBvsIhTk8ph2
GIh/ZRVNDAsChbuU1EJBACpwaMrcgwjPtI7/KTgeZVSJASIEEAECAAwFAkreCMYFAwASdQAA
CgkQlxC4m8pXrXyOQQf7BvRm/3PvFCCksyjBW4EVBW7z/Ps/kBK6bIE9Q7f7QlXFIcGGUIpA
rufXWbV+G4a3Z8LFeFJTovNePfquwpFjneUZn1CG+oVS1AfddvYhAsgkLhQqMbaNJIJ1y4D/
H3xvCna/s7Teufud0JLXoLBedFXeB5Cg2KlEoxINqMo+lm/VGJmbykwqoRvxZLDfnbFag5zG
59+OWw4TC8nzlIQYIBn22YiWRk5zsCJA40O+KL1vwBiFDrREhALQc/YBJKYrRX3ZV4U/EeYD
KB0NCBk1W1tXGCee3uhM0S5VFc1j7Pg58ECuntH5xOy+KMNFljiQwvWfbaFTJvCjFQS+OplX
b4kBIgQQAQIADAUCSu86VAUDABJ1AAAKCRCXELibyletfGs8CACteI2BmKs24GF80JeWTOQI
cvHnCdV7hKZOltbNPBbDv6qTt3iX2GVa10iYhI5Eg3Ojt/hKFJTMlfYZyI1peFodGjv7Lk5l
u7zaNBvT1pBCP+eJspi6rGpSuhtMSb4O5jPclRBmbY+w9wctLyZf1zG+slSdw8adcRXQNFqr
vVIZYOmu2S8FunqLfxpjewiFiDPzAzmbWzMoO2PLCYFhwV6Eh2jO33OGbvBmyHNFZBfX5F/+
kiyeT47MEhrfhytJ6ZOdpxtX8HvbvzPZcDLOI80W6rPTG76KW06ZiZrJ81YCa6a7D01y7BYy
W2HoxzYcuumjRkGF4nqK4Mw+wefCp0H/iQEiBBABAgAMBQJLAF3aBQMAEnUAAAoJEJcQuJvK
V618/q0H/ibXDQG2WQmC1LoT4H+ezXjPgDg8aiuz6f4xibTmrO+L4ScMX+zK0KZVwp6Kau28
Nx+gO0oAUW8mNxhd+cl0ZaY+7RIkxEvkooKKsArBmZT+xrE6CgHlAs3D4Mc+14nfD0aZaUbE
iobWvXlYLl27MELLcWyeMlgbeNoucc473JddvmHSRRM5F9Qp28CvWDEXYqhq1laoaho8+cei
pvzyuO3OTwjuAOqhefOHzAvFrRli99ML8xzF1ZOvBct+36SuYxDXyIhkSd7aG9Us0lW6W5Si
JYt4cDyI0JDhbhZN0tzWYKcKMZMxf8w3jW4sfQL0prhHrARqqPiU8OTUH/VNX5CJASIEEAEC
AAwFAksRgasFAwASdQAACgkQlxC4m8pXrXydogf/a31ofmYFMoE3p9SqGt/v28iyO0j9A1Lm
qKwEhJkxff/X/Qa7pafGQ9J90JQkxYKMxydWPspTbDFMccZWkBK132vZp9Q3FHKpnDPDLK2S
25miTReeAAQNgMMFLeyy7ZHi5YsKwLbKxcSo7/m0jlitNYlmt94imFNpg/mHGsy6O+rLeQTA
opuIzP3VwN6ItL5gIFxqWPmf/V0xh/vxTwLqJ66vECD8vyHrHblUzgiXHgyYbZPxAa2SRRd3
4V38phaZ/QsTkss+Sd/QeHChWyU9d6KengWwcr/nDO+K/hhmnO5Oqz02Upwyxrgi6484HQUN
/Smf44VBsSD1DBjaAKjMr4kBIgQQAQIADAUCSyNN1AUDABJ1AAAKCRCXELibyletfCWiB/9c
EZtdFVcsxpE3hJzM6PBPf+1QKuJORve/7MqNEb3TMWFgBxyOfvD7uMpCJyOrqq5AbUQfZfj9
K7qmzWUMuoYceGIlbdmHFBJwtmaF0BiyHaobgY/9RbdCNcbtzrW34feiW9aDZyvCoLHEVkCC
QACSv3FwdYVkkRB5eihvpwJk5tpScdIA12YLqzmVTFdhrZuYvtDdQHjgoLMO8B9s9kok7D2T
SpveVzXXPH68Z3JkVubhHT7cs+n+9PRvcaVJtsX2VTUY5eFVqmGuAUVrvp2aN8cKQ+mVcCQr
VVIhT9o8YB5925MUx2VJml0y0nkBQuMZyzMEOVGkuU/G+pVrRmmAiQEiBBABAgAMBQJLJyaS
BQMAEnUAAAoJEJcQuJvKV618eU0IAKnVh6ymId9C3ZqVyxwTnOB8RMQceJzwCLqk2RT0dPhN
5ZwUcQN7lCp9hymMutC8FdKRK/ESK21vJF2/576Pln4fIeOIbycBAEvqrL14epATj53uBizo
NOTuwb1kximFERuW3MP4XiFUJB0tPws2vR5UU3t6GoQJJwNoIbz9DK2L6X/Qz3Tb9if6bPSK
U6JR1Yn3Hos9ogg21vWCxgMTKUuPAYhmYjSvkqH3BihXi+c17MVvE7W5GJbQHuJo+MgSxu04
4qnvDHZpf4Mzc30XcG1ohjxefNyeiY2bzdI2yCaCtmWOlCW1Sc2oiE0zwO6lD4hY5XmC2Xql
MLsKB5VNXJGJASIEEAECAAwFAks4Ze4FAwASdQAACgkQlxC4m8pXrXyWXggAon2abiNvRzx9
7364Mjx4IlFvM1tVebzNbOkDwZS1ABqTDGgq/ffZA/VZrU+h2eL97cQyGxJEQ5kkm/v1iobE
ZEFMT0pv9WMzfidqzhdKdcpbbxdaErIjD5fBACKdjazAUeH7zce2v+bBN0l9LZoRiXbNugG9
38lkJ2E4ZTYYfvftL/e4RzOgqR9VD/A5MzxfXFbCVharHbeT8OwZy4Oz2UDaDszHsNKoG1WN
pOSf2HTMBPNcsOSY/hIBRWNxnzdYOkWt7laeLNmN1eUEwzk4J7GnlambPIctOdoEUriMSaey
TkLZGejKnwi/PqARyDW1FsReKNHD753ZMViUnAsq2IkBIgQQAQIADAUCS0oyJwUDABJ1AAAK
CRCXELibyletfGodCAC5hjmxwquHSb8ZL0RifIL3j3iU6U7qLK1TQKkTqgELfUzeF9f8NuNR
txLmzNk1T7YI9iji6NAtnuy43v61OMbqlkV8x69qNP36Owv408wXxEt0s5ViZuVOZJAY075c
YRhopgfmhkh4hbkAoKCLajOR0WUEEsDHsqqj8XLJuGRREURy8TJWaB/cotXsgiJf99gt+gIw
In8tyb3+WVIUHWfw2+Drpd3nfcMqgeO54PePJo0BWWjaar+wgC/76Se286IHcYMrml/Adnvx
ZaIKmxZmkTmDMCfMnVjRYSKBGjQ9Uu7dws7SMsbbd34f8Jt9nyuRqMcl4INAXthWY/S3Sdil
iQEiBBABAgAMBQJLW/5mBQMAEnUAAAoJEJcQuJvKV6181L8IAKq3ZOQHzqaOoz5wnvj51YG8
nZoW5RG7HOb3mL1D9b+FTTzaIxsLf7STagPwKtM57rU/7ehHIuO/9QQNQ3Mudw17ZiwD0l5X
7iG8/AflWnc6bXfTz18IplRuqyVc0qQeJZhT7MBpklcS4ZGZHPQdtAh4Aw5YXihrbbq6jV7j
CzUmFz4XcT8CkJHIUGoFR0vTmFqlAt2K1imwGMh2IEamPOJ0wsTbBfZbhmkB03RToEjIipGZ
M+NtKS/NL2RJYWZ+FCCcEMoRgmlVmATWw3natgLWwN4Z6K4rGXONWi/0wyFgxZpmjdHmjcXa
Igz8EroVsLbnaV/8yG7cgK5e6M0Fk1iJASIEEAECAAwFAkttIfgFAwASdQAACgkQlxC4m8pX
rXyR3QgAksvAMfqC+ACUEWSVAlepDFR1xI45UwBa2UeBY7KjOOCiZlkGREvx20IOv1gExyPl
zNxDeqmYsl2mleEoH6QlXaJRd8MxIVfAnjAt8izwU2dfDwflTTWgGQYf8q7qeAv1XC34yNge
0JaTD1C55QpmcO51f2ojMsAi36bBJO4Dr59jhVYiDjQADS/d7FpAznlhH9SGUq6ekYb2jxCS
rvt0wRtMyk6YGgts4xEHcN0wC9VTobaXo9xvsqhtUK44Gdvptq1cBFX8byzD6fN8nXp+v8qh
tlPYDqb4muqTh2UXXiWMtvPXo7kkZQ8CvI3YbZ10F1IDLt20VJWFZaJYL2fzyokCIgQQAQIA
DAUCQYHLhQWDBiLZBwAKCRCq4+bOZqFEaKgvEACCErnaHGyUYa0wETjj6DLEXsqeOiXad4i9
aBQxnD35GUgcFofC/nCY4XcnCMMEnmdQ9ofUuU3OBJ6BNJIbEusAabgLooebP/3KEaiCIiyh
HYU5jarpZAh+Zopgs3Oc11mQ1tIaS69iJxrGTLodkAsAJAeEUwTPq9fHFFzC1eGBysoyFWg4
bIjz/zClI+qyTbFA5g6tRoiXTo8ko7QhY2AA5UGEg+83Hdb6akC04Z2QRErxKAqrphHzj8Xp
jVOsQAdAi/qVKQeNKROlJ+iq6+YesmcWGfzeb87dGNweVFDJIGA0qY27pTb2lExYjsRFN4Cb
13NfodAbMTOxcAWZ7jAPCxAPlHUG++mHMrhQXEToZnBFE4nbnC7vOBNgWdjUgXcpkUCkop4b
17BFpR+k8ZtYLSS8p2LLz4uAeCcSm2/msJxT7rC/FvoH8428oHincqs2ICo9zO/Ud4HmmO0O
+SsZdVKIIjinGyOVWb4OOzkAlnnhEZ3o6hAHcREIsBgPwEYVTj/9ZdC0AO44Nj9cU7awaqgt
rnwwfr/o4V2gl8bLSkltZU27/29HeuOeFGjlFe0YrDd/aRNsxbyb2O28H4sG1CVZmC5uK1iQ
BDiSyA7Q0bbdofCWoQzm5twlpKWnY8Oe0ub9XP5p/sVfck4FceWFHwv+/PC9RzSl33lQ6vM2
wIkCIgQTAQIADAUCQp8KHAWDBQWacAAKCRDYwgoJWiRXzyE+D/9uc7z6fIsalfOYoLN60ajA
bQbI/uRKBFugyZ5RoaItusn9Z2rAtn61WrFhu4uCSJtFN1ny2RERg40f56pTghKrD+YEt+Nz
e6+FKQ5AbGIdFsR/2bUk+ZZRSt83e14Lcb6ii/fJfzkoIox9ltkifQxqY7Tvk4noKu4oLSc8
O1Wsfc/y0B9sYUUCmUfcnq58DEmGie9ovUslmyt5NPnveXxp5UeaRc5Rqt9tK2B4A+7/cqEN
rdZJbAMSunt2+2fkYiRunAFPKPBdJBsY1sxeL/A9aKe0viKEXQdAWqdNZKNCi8rd/oOP99/9
lMbFudAbX6nL2DSb1OG2Z7NWEqgIAzjmpwYYPCKeVz5Q8R+if9/fe5+STY/55OaI33fJ2H3v
+U435VjYqbrerWe36xJItcJeqUzW71fQtXi1CTEl3w2ch7VF5oj/QyjabLnAlHgSlkSi6p7B
y5C2MnbCHlCfPnIinPhFoRcRGPjJe9nFwGs+QblvS/Chzc2WX3s/2SWm4gEUKRX4zsAJ5ocy
fa/vkxCkSxK/erWlCPf/J1T70+i5waXDN/E3enSet/WL7h94pQKpjz8OdGL4JSBHuAVGA+a+
dknqnPF0KMKLhjrgV+L7O84FhbmAP7PXm3xmiMPriXf+el5fZZequQoIagf8rdRHHhRJxQgI
0HNknkaOqs8dtrkCDQQ+PqMdEAgA7+GJfxbMdY4wslPnjH9rF4N2qfWsEN/lxaZoJYc3a6M0
2WCnHl6ahT2/tBK2w1QI4YFteR47gCvtgb6O1JHffOo2HfLmRDRiRjd1DTCHqeyX7CHhcghj
/dNRlW2Z0l5QFEcmV9U0Vhp3aFfWC4Ujfs3LU+hkAWzE7zaD5cH9J7yv/6xuZVw411x0h4Uq
sTcWMu0iM1BzELqX1DY7LwoPEb/O9Rkbf4fmLe11EzIaCa4PqARXQZc4dhSinMt6K3X4BrRs
KTfozBu74F47D8Ilbf5vSYHbuE5p/1oIDznkg/p8kW+3FxuWrycciqFTcNz215yyX39LXFnl
LzKUb/F5GwADBQf+Lwqqa8CGrRfsOAJxim63CHfty5mUc5rUSnTslGYEIOCR1BeQauyPZbPD
sDD9MZ1ZaSafanFvwFG6Llx9xkU7tzq+vKLoWkm4u5xf3vn55VjnSd1aQ9eQnUcXiL4cnBGo
TbOWI39EcyzgslzBdC++MPjcQTcA7p6JUVsP6oAB3FQWg54tuUo0Ec8bsM8b3Ev42LmuQT5N
dKHGwHsXTPtl0klk4bQk4OajHsiy1BMahpT27jWjJlMiJc+IWJ0mghkKHt926s/ymfdf5Hkd
Q1cyvsz5tryVI3Fx78XeSYfQvuuwqp2H139pXGEkg0n6KdUOetdZWhe70YGNPw1yjWJT1IhM
BBgRAgAMBQI+PqMdBQkJZgGAAAoJEIxxjTtQcuH17p4An3r1QpVC9yhnW2cSAjq+kr72GX0e
AJ4295kl6NxYEuFApmr1+0uUq/SlsYhMBBgRAgAMBQJHrJT8BQkNMFjfAAoJEIxxjTtQcuH1
pc4An0I965H3JY2GTrizp+dCezxbhexaAJ48FhocFYvfhZtgeUWb6aPvgQZHT4hUBBgRAgAM
BQI+PqMdBQkJZgGAABIJEIxxjTtQcuH1B2VHUEcAAQHungCfevVClUL3KGdbZxICOr6SvvYZ
fR4Anjb3mSXo3FgS4UCmavX7S5Sr9KWxiFQEGBECAAwFAk53Pe0FCRP7AbgAEgdlR1BHAAEB
CRCMcY07UHLh9RSbAJsFivb5sESf8vYE5yfD1n9AVa6FEwCgpWAIWbl9p1DcB+L5RCUBw6mG
uck=
=yia9
-----END PGP PUBLIC KEY BLOCK-----</code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/load-data-local-security.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="load-data-local-security">
</a>
8.1.6 Security Considerations for LOAD DATA LOCAL
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045252580688">
</a>
<p>
The
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
statement loads a
data file into a table. The statement can load a file located on
the server host, or, if the
<code class="literal">
LOCAL
</code>
keyword is
specified, on the client host.
</p>
<p>
The
<code class="literal">
LOCAL
</code>
version of
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD
DATA
</code>
</a>
has two potential security issues:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Because
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
LOCAL
</code>
</a>
is an SQL statement, parsing occurs on the
server side, and transfer of the file from the client host to
the server host is initiated by the MySQL server, which tells
the client the file named in the statement. In theory, a
patched server could tell the client program to transfer a
file of the server's choosing rather than the file named in
the statement. Such a server could access any file on the
client host to which the client user has read access. (A
patched server could in fact reply with a file-transfer
request to any statement, not just
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
LOCAL
</code>
</a>
, so a more fundamental issue is that clients
should not connect to untrusted servers.)
</p>
</li>
<li class="listitem">
<p>
In a Web environment where the clients are connecting from a
Web server, a user could use
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
LOCAL
</code>
</a>
to read any files that the Web server process
has read access to (assuming that a user could run any
statement against the SQL server). In this environment, the
client with respect to the MySQL server actually is the Web
server, not a remote program being run by users who connect to
the Web server.
</p>
</li>
</ul>
</div>
<p>
To avoid connecting to untrusted servers, clients can establish a
secure connection and verify the server identity by connecting
using the
<a class="link" href="connection-options.html#option_general_ssl-mode">
<code class="option">
--ssl-mode=VERIFY_IDENTITY
</code>
</a>
option
and the appropriate CA certificate. To implement this level of
verification, you must first ensure that the CA certificate for
the server is reliably available to the replica, otherwise
availability issues will result. For more information, see
<a class="xref" href="connection-options.html#encrypted-connection-options" title="Command Options for Encrypted Connections">
Command Options for Encrypted Connections
</a>
.
</p>
<p>
To avoid
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
issues, clients
should avoid using
<code class="literal">
LOCAL
</code>
unless proper
client-side precautions have been taken.
</p>
<p>
For control over local data loading, MySQL permits the capability
to be enabled or disabled. MySQL also enables clients to restrict
local data loading operations to files located in a designated
directory.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="load-data-local-security.html#load-data-local-configuration" title="Enabling or Disabling Local Data Loading Capability">
Enabling or Disabling Local Data Loading Capability
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="load-data-local-security.html#load-data-local-permitted-files" title="Restricting Files Permitted for Local Data Loading">
Restricting Files Permitted for Local Data Loading
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="load-data-local-security.html#load-data-local-shell" title="MySQL Shell and Local Data Loading">
MySQL Shell and Local Data Loading
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="load-data-local-configuration">
</a>
Enabling or Disabling Local Data Loading Capability
</h4>
</div>
</div>
</div>
<p>
Administrators and applications can configure whether to permit
local data loading as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
On the server side:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The
<a class="link" href="server-system-variables.html#sysvar_local_infile">
<code class="literal">
local_infile
</code>
</a>
system
variable controls server-side
<code class="literal">
LOCAL
</code>
capability. Depending on the
<a class="link" href="server-system-variables.html#sysvar_local_infile">
<code class="literal">
local_infile
</code>
</a>
setting,
the server refuses or permits local data loading by
clients that request local data loading.
</p>
</li>
<li class="listitem">
<p>
By default,
<a class="link" href="server-system-variables.html#sysvar_local_infile">
<code class="literal">
local_infile
</code>
</a>
is
disabled. (This is a change from previous versions of
MySQL.) To cause the server to refuse or permit
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
LOCAL
</code>
</a>
statements explicitly (regardless of how
client programs and libraries are configured at build
time or runtime), start
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
with
<a class="link" href="server-system-variables.html#sysvar_local_infile">
<code class="literal">
local_infile
</code>
</a>
disabled
or enabled.
<a class="link" href="server-system-variables.html#sysvar_local_infile">
<code class="literal">
local_infile
</code>
</a>
can also
be set at runtime.
</p>
<a class="indexterm" name="idm46045252544624">
</a>
<a class="indexterm" name="idm46045252543536">
</a>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
On the client side:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The
<a class="link" href="source-configuration-options.html#option_cmake_enabled_local_infile">
<code class="option">
ENABLED_LOCAL_INFILE
</code>
</a>
<span class="command">
<strong>
CMake
</strong>
</span>
option controls the compiled-in
default
<code class="literal">
LOCAL
</code>
capability for the
MySQL client library (see
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
). Clients
that make no explicit arrangements therefore have
<code class="literal">
LOCAL
</code>
capability disabled or enabled
according to the
<a class="link" href="source-configuration-options.html#option_cmake_enabled_local_infile">
<code class="option">
ENABLED_LOCAL_INFILE
</code>
</a>
setting specified at MySQL build time.
</p>
<a class="indexterm" name="idm46045252534864">
</a>
<a class="indexterm" name="idm46045252533408">
</a>
</li>
<li class="listitem">
<p>
By default, the client library in MySQL binary
distributions is compiled with
<a class="link" href="source-configuration-options.html#option_cmake_enabled_local_infile">
<code class="option">
ENABLED_LOCAL_INFILE
</code>
</a>
disabled. If you compile MySQL from source, configure it
with
<a class="link" href="source-configuration-options.html#option_cmake_enabled_local_infile">
<code class="option">
ENABLED_LOCAL_INFILE
</code>
</a>
disabled or enabled based on whether clients that make
no explicit arrangements should have
<code class="literal">
LOCAL
</code>
capability disabled or enabled.
</p>
</li>
<li class="listitem">
<p>
For client programs that use the C API, local data
loading capability is determined by the default compiled
into the MySQL client library. To enable or disable it
explicitly, invoke the
<a class="ulink" href="/doc/c-api/8.4/en/mysql-options.html" target="_top">
<code class="literal">
mysql_options()
</code>
</a>
C API
function to disable or enable the
<code class="literal">
MYSQL_OPT_LOCAL_INFILE
</code>
option. See
<a class="ulink" href="/doc/c-api/8.4/en/mysql-options.html" target="_top">
mysql_options()
</a>
.
</p>
<a class="indexterm" name="idm46045252524256">
</a>
</li>
<li class="listitem">
<p>
For the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, local data
loading capability is determined by the default compiled
into the MySQL client library. To disable or enable it
explicitly, use the
<a class="link" href="mysql-command-options.html#option_mysql_local-infile">
<code class="option">
--local-infile=0
</code>
</a>
or
<a class="link" href="mysql-command-options.html#option_mysql_local-infile">
<code class="option">
--local-infile[=1]
</code>
</a>
option.
</p>
<a class="indexterm" name="idm46045252518480">
</a>
<a class="indexterm" name="idm46045252516992">
</a>
</li>
<li class="listitem">
<p>
For the
<a class="link" href="mysqlimport.html" title="6.5.5 mysqlimport — A Data Import Program">
<span class="command">
<strong>
mysqlimport
</strong>
</span>
</a>
client, local
data loading is not used by default. To disable or
enable it explicitly, use the
<a class="link" href="mysqlimport.html#option_mysqlimport_local">
<code class="option">
--local=0
</code>
</a>
or
<a class="link" href="mysqlimport.html#option_mysqlimport_local">
<code class="option">
--local[=1]
</code>
</a>
option.
</p>
<a class="indexterm" name="idm46045252511344">
</a>
<a class="indexterm" name="idm46045252509856">
</a>
</li>
<li class="listitem">
<p>
If you use
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
LOCAL
</code>
</a>
in Perl scripts or other programs that
read the
<code class="literal">
[client]
</code>
group from option
files, you can add a
<code class="literal">
local-infile
</code>
option setting to that group. To prevent problems for
programs that do not understand this option, specify it
using the
<a class="link" href="option-modifiers.html" title="6.2.2.4 Program Option Modifiers">
<code class="literal">
loose-
</code>
</a>
prefix:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa4454218"><div class="copy-help left">Press ⌘+C to 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">[client]</span>
<span class="token constant">loose-local-infile</span><span class="token attr-value"><span class="token punctuation">=</span>0</span></code></pre>
</div>
<p>
or:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa12328480"><div class="copy-help left">Press ⌘+C to 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">[client]</span>
<span class="token constant">loose-local-infile</span><span class="token attr-value"><span class="token punctuation">=</span>1</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
In all cases, successful use of a
<code class="literal">
LOCAL
</code>
load operation by a client also
requires that the server permits local loading.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
If
<code class="literal">
LOCAL
</code>
capability is disabled, on either
the server or client side, a client that attempts to issue a
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
LOCAL
</code>
</a>
statement receives the following error message:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa33645788"><div class="copy-help left">Press ⌘+C to 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 3950 (42000): Loading local data is disabled; this must be
enabled on both the client and server side</code></pre>
</div>
<a class="indexterm" name="idm46045252495328">
</a>
<a class="indexterm" name="idm46045252493760">
</a>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="load-data-local-permitted-files">
</a>
Restricting Files Permitted for Local Data Loading
</h4>
</div>
</div>
</div>
<p>
The MySQL client library enables client applications to restrict
local data loading operations to files located in a designated
directory. Certain MySQL client programs take advantage of this
capability.
</p>
<p>
Client programs that use the C API can control which files to
permit for load data loading using the
<code class="literal">
MYSQL_OPT_LOCAL_INFILE
</code>
and
<code class="literal">
MYSQL_OPT_LOAD_DATA_LOCAL_DIR
</code>
options of the
<a class="ulink" href="/doc/c-api/8.4/en/mysql-options.html" target="_top">
<code class="literal">
mysql_options()
</code>
</a>
C API function
(see
<a class="ulink" href="/doc/c-api/8.4/en/mysql-options.html" target="_top">
mysql_options()
</a>
).
</p>
<a class="indexterm" name="idm46045252486304">
</a>
<a class="indexterm" name="idm46045252484816">
</a>
<p>
The effect of
<code class="literal">
MYSQL_OPT_LOAD_DATA_LOCAL_DIR
</code>
depends on whether
<code class="literal">
LOCAL
</code>
data loading is
enabled or disabled:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If
<code class="literal">
LOCAL
</code>
data loading is enabled, either
by default in the MySQL client library or by explicitly
enabling
<code class="literal">
MYSQL_OPT_LOCAL_INFILE
</code>
, the
<code class="literal">
MYSQL_OPT_LOAD_DATA_LOCAL_DIR
</code>
option has
no effect.
</p>
</li>
<li class="listitem">
<p>
If
<code class="literal">
LOCAL
</code>
data loading is disabled, either
by default in the MySQL client library or by explicitly
disabling
<code class="literal">
MYSQL_OPT_LOCAL_INFILE
</code>
, the
<code class="literal">
MYSQL_OPT_LOAD_DATA_LOCAL_DIR
</code>
option can
be used to designate a permitted directory for locally
loaded files. In this case,
<code class="literal">
LOCAL
</code>
data
loading is permitted but restricted to files located in the
designated directory. Interpretation of the
<code class="literal">
MYSQL_OPT_LOAD_DATA_LOCAL_DIR
</code>
value is as
follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If the value is the null pointer (the default), it names
no directory, with the result that no files are
permitted for
<code class="literal">
LOCAL
</code>
data loading.
</p>
</li>
<li class="listitem">
<p>
If the value is a directory path name,
<code class="literal">
LOCAL
</code>
data loading is permitted but
restricted to files located in the named directory.
Comparison of the directory path name and the path name
of files to be loaded is case-sensitive regardless of
the case sensitivity of the underlying file system.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
MySQL client programs use the preceding
<a class="ulink" href="/doc/c-api/8.4/en/mysql-options.html" target="_top">
<code class="literal">
mysql_options()
</code>
</a>
options 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 has a
<a class="link" href="mysql-command-options.html#option_mysql_load-data-local-dir">
<code class="option">
--load-data-local-dir
</code>
</a>
option
that takes a directory path or an empty string.
<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 option value to set the
<code class="literal">
MYSQL_OPT_LOAD_DATA_LOCAL_DIR
</code>
option
(with an empty string setting the value to the null
pointer). The effect of
<a class="link" href="mysql-command-options.html#option_mysql_load-data-local-dir">
<code class="option">
--load-data-local-dir
</code>
</a>
depends
on whether
<code class="literal">
LOCAL
</code>
data loading is enabled:
</p>
<a class="indexterm" name="idm46045252460384">
</a>
<a class="indexterm" name="idm46045252458880">
</a>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If
<code class="literal">
LOCAL
</code>
data loading is enabled,
either by default in the MySQL client library or by
specifying
<a class="link" href="mysql-command-options.html#option_mysql_local-infile">
<code class="option">
--local-infile[=1]
</code>
</a>
, the
<a class="link" href="mysql-command-options.html#option_mysql_load-data-local-dir">
<code class="option">
--load-data-local-dir
</code>
</a>
option is ignored.
</p>
</li>
<li class="listitem">
<p>
If
<code class="literal">
LOCAL
</code>
data loading is disabled,
either by default in the MySQL client library or by
specifying
<a class="link" href="mysql-command-options.html#option_mysql_local-infile">
<code class="option">
--local-infile=0
</code>
</a>
, the
<a class="link" href="mysql-command-options.html#option_mysql_load-data-local-dir">
<code class="option">
--load-data-local-dir
</code>
</a>
option applies.
</p>
</li>
</ul>
</div>
<p>
When
<a class="link" href="mysql-command-options.html#option_mysql_load-data-local-dir">
<code class="option">
--load-data-local-dir
</code>
</a>
applies, the option value designates the directory in which
local data files must be located. Comparison of the
directory path name and the path name of files to be loaded
is case-sensitive regardless of the case sensitivity of the
underlying file system. If the option value is the empty
string, it names no directory, with the result that no files
are permitted for local data loading.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysqlimport.html" title="6.5.5 mysqlimport — A Data Import Program">
<span class="command">
<strong>
mysqlimport
</strong>
</span>
</a>
sets
<code class="literal">
MYSQL_OPT_LOAD_DATA_LOCAL_DIR
</code>
for each
file that it processes so that the directory containing the
file is the permitted local loading directory.
</p>
</li>
<li class="listitem">
<p>
For data loading operations corresponding to
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
statements,
<a class="link" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
<span class="command">
<strong>
mysqlbinlog
</strong>
</span>
</a>
extracts the files from the
binary log events, writes them as temporary files to the
local file system, and writes
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
LOCAL
</code>
</a>
statements to cause the files to be loaded.
By default,
<a class="link" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
<span class="command">
<strong>
mysqlbinlog
</strong>
</span>
</a>
writes these
temporary files to an operating system-specific directory.
The
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_local-load">
<code class="option">
--local-load
</code>
</a>
option
can be used to explicitly specify the directory where
<a class="link" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
<span class="command">
<strong>
mysqlbinlog
</strong>
</span>
</a>
should prepare local
temporary files.
</p>
<a class="indexterm" name="idm46045252436512">
</a>
<a class="indexterm" name="idm46045252435024">
</a>
<p>
Because other processes can write files to the default
system-specific directory, it is advisable to specify the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_local-load">
<code class="option">
--local-load
</code>
</a>
option to
<a class="link" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
<span class="command">
<strong>
mysqlbinlog
</strong>
</span>
</a>
to designate a different
directory for data files, and then designate that same
directory by specifying the
<a class="link" href="mysql-command-options.html#option_mysql_load-data-local-dir">
<code class="option">
--load-data-local-dir
</code>
</a>
option
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>
when processing the output from
<a class="link" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
<span class="command">
<strong>
mysqlbinlog
</strong>
</span>
</a>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="load-data-local-shell">
</a>
MySQL Shell and Local Data Loading
</h4>
</div>
</div>
</div>
<p>
MySQL Shell provides a number of utilities to dump tables,
schemas, or server instances and load them into other instances.
When you use these utilities to handle the data, MySQL Shell
provides additional functions such as input preprocessing,
multithreaded parallel loading, file compression and
decompression, and handling access to Oracle Cloud
Infrastructure Object Storage buckets. To get the best
functionality, always use the most recent version available of
MySQL Shell's dump and dump loading utilities.
</p>
<p>
MySQL Shell's data upload utilities use
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA LOCAL
INFILE
</code>
</a>
statements to upload data, so the
<a class="link" href="server-system-variables.html#sysvar_local_infile">
<code class="literal">
local_infile
</code>
</a>
system variable
must be set to
<code class="literal">
ON
</code>
on the target server
instance. You can do this before uploading the data, and remove
it again afterwards. The utilities handle the file transfer
requests safely to deal with the security considerations
discussed in this topic.
</p>
<p>
MySQL Shell includes these dump and dump loading utilities:
</p>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
Table export utility
<code class="literal">
util.exportTable()
</code>
</span>
</dt>
<dd>
<p>
Exports a MySQL relational table into a data file, which
can be uploaded to a MySQL server instance using
MySQL Shell's parallel table import utility, imported to
a different application, or used as a logical backup. The
utility has preset options and customization options to
produce different output formats.
</p>
</dd>
<dt>
<span class="term">
Parallel table import utility
<code class="literal">
util.importTable()
</code>
</span>
</dt>
<dd>
<p>
Imports a data file to a MySQL relational table. The data
file can be the output from MySQL Shell's table export
utility or another format supported by the utility's
preset and customization options. The utility can carry
out input preprocessing before adding the data to the
table. It can accept multiple data files to merge into a
single relational table, and automatically decompresses
compressed files.
</p>
</dd>
<dt>
<span class="term">
Instance dump utility
<code class="literal">
util.dumpInstance()
</code>
, schema dump utility
<code class="literal">
util.dumpSchemas()
</code>
, and table dump
utility
<code class="literal">
util.dumpTables()
</code>
</span>
</dt>
<dd>
<p>
Export an instance, schema, or table to a set of dump
files, which can then be uploaded to a MySQL instance
using MySQL Shell's dump loading utility. The utilities
provide Oracle Cloud Infrastructure Object Storage
streaming, HeatWave Service compatibility checks and modifications,
and the ability to carry out a dry run to identify issues
before proceeding with the dump.
</p>
</dd>
<dt>
<span class="term">
Dump loading utility
<code class="literal">
util.loadDump()
</code>
</span>
</dt>
<dd>
<p>
Import dump files created using MySQL Shell's instance,
schema, or table dump utility into a HeatWave Service DB System or a
MySQL Server instance. The utility manages the upload
process and provides data streaming from remote storage,
parallel loading of tables or table chunks, progress state
tracking, resume and reset capability, and the option of
concurrent loading while the dump is still taking place.
MySQL Shell’s parallel table import utility can be used
in combination with the dump loading utility to modify
data before uploading it to the target MySQL instance.
</p>
</dd>
</dl>
</div>
<p>
For details of the utilities, see
<a class="ulink" href="/doc/mysql-shell/8.4/en/mysql-shell-utilities.html" target="_top">
MySQL Shell Utilities
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/local-variable-scope.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="local-variable-scope">
</a>
15.6.4.2 Local Variable Scope and Resolution
</h4>
</div>
</div>
</div>
<p>
The scope of a local variable is the
<a class="link" href="begin-end.html" title="15.6.1 BEGIN ... END Compound Statement">
<code class="literal">
BEGIN ...
END
</code>
</a>
block within which it is declared. The variable
can be referred to in blocks nested within the declaring block,
except those blocks that declare a variable with the same name.
</p>
<p>
Because local variables are in scope only during stored program
execution, references to them are not permitted in prepared
statements created within a stored program. Prepared statement
scope is the current session, not the stored program, so the
statement could be executed after the program ends, at which
point the variables would no longer be in scope. For example,
<code class="literal">
SELECT ... INTO
<em class="replaceable">
<code>
local_var
</code>
</em>
</code>
cannot be used as
a prepared statement. This restriction also applies to stored
procedure and function parameters. See
<a class="xref" href="prepare.html" title="15.5.1 PREPARE Statement">
Section 15.5.1, “PREPARE Statement”
</a>
.
</p>
<p>
A local variable should not have the same name as a table
column. If an SQL statement, such as a
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT ...
INTO
</code>
</a>
statement, contains a reference to a column and a
declared local variable with the same name, MySQL currently
interprets the reference as the name of a variable. Consider the
following procedure definition:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa90742809"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">PROCEDURE</span> sp1 <span class="token punctuation">(</span>x <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">DECLARE</span> xname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">)</span> <span class="token keyword">DEFAULT</span> <span class="token string">'bob'</span><span class="token punctuation">;</span>
<span class="token keyword">DECLARE</span> newname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">xid</span> <span class="token datatype">INT</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> xname<span class="token punctuation">,</span> id <span class="token keyword">INTO</span> newname<span class="token punctuation">,</span> <span class="token keyword">xid</span>
<span class="token keyword">FROM</span> table1 <span class="token keyword">WHERE</span> xname <span class="token operator">=</span> xname<span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> newname<span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
MySQL interprets
<code class="literal">
xname
</code>
in the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement as a reference
to the
<code class="literal">
xname
</code>
<span class="emphasis">
<em>
variable
</em>
</span>
rather than the
<code class="literal">
xname
</code>
<span class="emphasis">
<em>
column
</em>
</span>
. Consequently, when the procedure
<code class="literal">
sp1()
</code>
is called, the
<code class="literal">
newname
</code>
variable returns the value
<code class="literal">
'bob'
</code>
regardless of the value of the
<code class="literal">
table1.xname
</code>
column.
</p>
<p>
Similarly, the cursor definition in the following procedure
contains a
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement that
refers to
<code class="literal">
xname
</code>
. MySQL interprets this as a
reference to the variable of that name rather than a column
reference.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa99421060"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">PROCEDURE</span> sp2 <span class="token punctuation">(</span>x <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">DECLARE</span> xname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">)</span> <span class="token keyword">DEFAULT</span> <span class="token string">'bob'</span><span class="token punctuation">;</span>
<span class="token keyword">DECLARE</span> newname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">xid</span> <span class="token datatype">INT</span><span class="token punctuation">;</span>
<span class="token keyword">DECLARE</span> done <span class="token datatype">TINYINT</span> <span class="token keyword">DEFAULT</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token keyword">DECLARE</span> cur1 <span class="token keyword">CURSOR</span> <span class="token keyword">FOR</span> <span class="token keyword">SELECT</span> xname<span class="token punctuation">,</span> id <span class="token keyword">FROM</span> table1<span class="token punctuation">;</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">CONTINUE</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> <span class="token operator">NOT</span> <span class="token keyword">FOUND</span> <span class="token keyword">SET</span> done <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token keyword">OPEN</span> cur1<span class="token punctuation">;</span>
read_loop: <span class="token keyword">LOOP</span>
<span class="token keyword">FETCH</span> <span class="token keyword">FROM</span> cur1 <span class="token keyword">INTO</span> newname<span class="token punctuation">,</span> <span class="token keyword">xid</span><span class="token punctuation">;</span>
<span class="token keyword">IF</span> done <span class="token keyword">THEN</span> <span class="token keyword">LEAVE</span> read_loop<span class="token punctuation">;</span> <span class="token keyword">END</span> <span class="token keyword">IF</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> newname<span class="token punctuation">;</span>
<span class="token keyword">END</span> <span class="token keyword">LOOP</span><span class="token punctuation">;</span>
<span class="token keyword">CLOSE</span> cur1<span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
See also
<a class="xref" href="stored-program-restrictions.html" title="27.8 Restrictions on Stored Programs">
Section 27.8, “Restrictions on Stored Programs”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-buffer-pool.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-buffer-pool">
</a>
17.5.1 Buffer Pool
</h3>
</div>
</div>
</div>
<p>
The buffer pool is an area in main memory where
<code class="literal">
InnoDB
</code>
caches table and index data as it is
accessed. The buffer pool permits frequently used data to be
accessed directly from memory, which speeds up processing. On
dedicated servers, up to 80% of physical memory is often assigned to
the buffer pool.
</p>
<p>
For efficiency of high-volume read operations, the buffer pool is
divided into pages that can potentially hold multiple rows. For
efficiency of cache management, the buffer pool is implemented as a
linked list of pages; data that is rarely used is aged out of the
cache using a variation of the least recently used (LRU) algorithm.
</p>
<p>
Knowing how to take advantage of the buffer pool to keep frequently
accessed data in memory is an important aspect of MySQL tuning.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-buffer-pool-lru">
</a>
Buffer Pool LRU Algorithm
</h4>
</div>
</div>
</div>
<p>
The buffer pool is managed as a list using a variation of the LRU
algorithm. When room is needed to add a new page to the buffer
pool, the least recently used page is evicted and a new page is
added to the middle of the list. This midpoint insertion strategy
treats the list as two sublists:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
At the head, a sublist of new (
<span class="quote">
“
<span class="quote">
young
</span>
”
</span>
) pages
that were accessed recently
</p>
</li>
<li class="listitem">
<p>
At the tail, a sublist of old pages that were accessed less
recently
</p>
</li>
</ul>
</div>
<div class="figure">
<a name="innodb-buffer-pool-list">
</a>
<p class="title">
<b>
Figure 17.2 Buffer Pool List
</b>
</p>
<div class="figure-contents">
<div class="mediaobject">
<img alt="Content is described in the surrounding text." src="images/innodb-buffer-pool-list.png" style="width: 100%; max-width: 376px;"/>
</div>
</div>
</div>
<br class="figure-break"/>
<p>
The algorithm keeps frequently used pages in the new sublist. The
old sublist contains less frequently used pages; these pages are
candidates for
<a class="link" href="glossary.html#glos_eviction" title="eviction">
eviction
</a>
.
</p>
<p>
By default, the algorithm operates as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
3/8 of the buffer pool is devoted to the old sublist.
</p>
</li>
<li class="listitem">
<p>
The midpoint of the list is the boundary where the tail of the
new sublist meets the head of the old sublist.
</p>
</li>
<li class="listitem">
<p>
When
<code class="literal">
InnoDB
</code>
reads a page into the buffer
pool, it initially inserts it at the midpoint (the head of the
old sublist). A page can be read because it is required for a
user-initiated operation such as an SQL query, or as part of a
<a class="link" href="glossary.html#glos_read_ahead" title="read-ahead">
read-ahead
</a>
operation
performed automatically by
<code class="literal">
InnoDB
</code>
.
</p>
</li>
<li class="listitem">
<p>
Accessing a page in the old sublist makes it
<span class="quote">
“
<span class="quote">
young
</span>
”
</span>
, moving it to the head of the new
sublist. If the page was read because it was required by a
user-initiated operation, the first access occurs immediately
and the page is made young. If the page was read due to a
read-ahead operation, the first access does not occur
immediately and might not occur at all before the page is
evicted.
</p>
</li>
<li class="listitem">
<p>
As the database operates, pages in the buffer pool that are
not accessed
<span class="quote">
“
<span class="quote">
age
</span>
”
</span>
by moving toward the tail of
the list. Pages in both the new and old sublists age as other
pages are made new. Pages in the old sublist also age as pages
are inserted at the midpoint. Eventually, a page that remains
unused reaches the tail of the old sublist and is evicted.
</p>
</li>
</ul>
</div>
<p>
By default, pages read by queries are immediately moved into the
new sublist, meaning they stay in the buffer pool longer. A table
scan, performed for a
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
operation or a
<code class="literal">
SELECT
</code>
statement with no
<code class="literal">
WHERE
</code>
clause, for example, can bring a large
amount of data into the buffer pool and evict an equivalent amount
of older data, even if the new data is never used again.
Similarly, pages that are loaded by the read-ahead background
thread and accessed only once are moved to the head of the new
list. These situations can push frequently used pages to the old
sublist where they become subject to eviction. For information
about optimizing this behavior, see
<a class="xref" href="innodb-performance-midpoint_insertion.html" title="17.8.3.3 Making the Buffer Pool Scan Resistant">
Section 17.8.3.3, “Making the Buffer Pool Scan Resistant”
</a>
, and
<a class="xref" href="innodb-performance-read_ahead.html" title="17.8.3.4 Configuring InnoDB Buffer Pool Prefetching (Read-Ahead)">
Section 17.8.3.4, “Configuring InnoDB Buffer Pool Prefetching (Read-Ahead)”
</a>
.
</p>
<p>
<code class="literal">
InnoDB
</code>
Standard Monitor output contains several
fields in the
<code class="literal">
BUFFER POOL AND MEMORY
</code>
section
regarding operation of the buffer pool LRU algorithm. For details,
see
<a class="xref" href="innodb-buffer-pool.html#innodb-buffer-pool-monitoring" title="Monitoring the Buffer Pool Using the InnoDB Standard Monitor">
Monitoring the Buffer Pool Using the InnoDB Standard Monitor
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-buffer-pool-configuration">
</a>
Buffer Pool Configuration
</h4>
</div>
</div>
</div>
<p>
You can configure the various aspects of the buffer pool to
improve performance.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Ideally, you set the size of the buffer pool to as large a
value as practical, leaving enough memory for other processes
on the server to run without excessive paging. The larger the
buffer pool, the more
<code class="literal">
InnoDB
</code>
acts like an
in-memory database, reading data from disk once and then
accessing the data from memory during subsequent reads. See
<a class="xref" href="innodb-buffer-pool-resize.html" title="17.8.3.1 Configuring InnoDB Buffer Pool Size">
Section 17.8.3.1, “Configuring InnoDB Buffer Pool Size”
</a>
.
</p>
</li>
<li class="listitem">
<p>
On 64-bit systems with sufficient memory, you can split the
buffer pool into multiple parts to minimize contention for
memory structures among concurrent operations. For details,
see
<a class="xref" href="innodb-multiple-buffer-pools.html" title="17.8.3.2 Configuring Multiple Buffer Pool Instances">
Section 17.8.3.2, “Configuring Multiple Buffer Pool Instances”
</a>
.
</p>
</li>
<li class="listitem">
<p>
You can keep frequently accessed data in memory regardless of
sudden spikes of activity from operations that would bring
large amounts of infrequently accessed data into the buffer
pool. For details, see
<a class="xref" href="innodb-performance-midpoint_insertion.html" title="17.8.3.3 Making the Buffer Pool Scan Resistant">
Section 17.8.3.3, “Making the Buffer Pool Scan Resistant”
</a>
.
</p>
</li>
<li class="listitem">
<p>
You can control how and when to perform read-ahead requests to
prefetch pages into the buffer pool asynchronously in
anticipation of impending need for them. For details, see
<a class="xref" href="innodb-performance-read_ahead.html" title="17.8.3.4 Configuring InnoDB Buffer Pool Prefetching (Read-Ahead)">
Section 17.8.3.4, “Configuring InnoDB Buffer Pool Prefetching (Read-Ahead)”
</a>
.
</p>
</li>
<li class="listitem">
<p>
You can control when background flushing occurs and whether or
not the rate of flushing is dynamically adjusted based on
workload. For details, see
<a class="xref" href="innodb-buffer-pool-flushing.html" title="17.8.3.5 Configuring Buffer Pool Flushing">
Section 17.8.3.5, “Configuring Buffer Pool Flushing”
</a>
.
</p>
</li>
<li class="listitem">
<p>
You can configure how
<code class="literal">
InnoDB
</code>
preserves the
current buffer pool state to avoid a lengthy warmup period
after a server restart. For details, see
<a class="xref" href="innodb-preload-buffer-pool.html" title="17.8.3.6 Saving and Restoring the Buffer Pool State">
Section 17.8.3.6, “Saving and Restoring the Buffer Pool State”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-buffer-pool-monitoring">
</a>
Monitoring the Buffer Pool Using the InnoDB Standard Monitor
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045167129552">
</a>
<a class="indexterm" name="idm46045167128480">
</a>
<a class="indexterm" name="idm46045167126992">
</a>
<p>
<code class="literal">
InnoDB
</code>
Standard Monitor output, which can be
accessed using
<a class="link" href="innodb-standard-monitor.html" title="17.17.3 InnoDB Standard Monitor and Lock Monitor Output">
<code class="literal">
SHOW
ENGINE INNODB STATUS
</code>
</a>
, provides metrics regarding
operation of the buffer pool. Buffer pool metrics are located in
the
<code class="literal">
BUFFER POOL AND MEMORY
</code>
section of
<code class="literal">
InnoDB
</code>
Standard Monitor output:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18327531"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token comment" spellcheck="true">----------------------</span>
BUFFER POOL <span class="token operator">AND</span> <span class="token keyword">MEMORY</span>
<span class="token comment" spellcheck="true">----------------------</span>
Total large <span class="token keyword">memory</span> allocated <span class="token number">2198863872</span>
Dictionary <span class="token keyword">memory</span> allocated <span class="token number">776332</span>
Buffer pool size <span class="token number">131072</span>
Free buffers <span class="token number">124908</span>
<span class="token keyword">Database</span> pages <span class="token number">5720</span>
<span class="token keyword">Old</span> <span class="token keyword">database</span> pages <span class="token number">2071</span>
Modified db pages <span class="token number">910</span>
Pending <span class="token keyword">reads</span> <span class="token number">0</span>
Pending writes: LRU <span class="token number">0</span><span class="token punctuation">,</span> <span class="token keyword">flush</span> <span class="token keyword">list</span> <span class="token number">0</span><span class="token punctuation">,</span> single <span class="token keyword">page</span> <span class="token number">0</span>
Pages made young <span class="token number">4</span><span class="token punctuation">,</span> <span class="token operator">not</span> young <span class="token number">0</span>
<span class="token number">0.10</span> youngs<span class="token operator">/</span>s<span class="token punctuation">,</span> <span class="token number">0.00</span> non<span class="token operator">-</span>youngs<span class="token operator">/</span>s
Pages <span class="token keyword">read</span> <span class="token number">197</span><span class="token punctuation">,</span> created <span class="token number">5523</span><span class="token punctuation">,</span> written <span class="token number">5060</span>
<span class="token number">0.00</span> <span class="token keyword">reads</span><span class="token operator">/</span>s<span class="token punctuation">,</span> <span class="token number">190.89</span> creates<span class="token operator">/</span>s<span class="token punctuation">,</span> <span class="token number">244.94</span> writes<span class="token operator">/</span>s
Buffer pool hit rate <span class="token number">1000</span> <span class="token operator">/</span> <span class="token number">1000</span><span class="token punctuation">,</span> young<span class="token operator">-</span>making rate <span class="token number">0</span> <span class="token operator">/</span> <span class="token number">1000</span> <span class="token operator">not</span>
<span class="token number">0</span> <span class="token operator">/</span> <span class="token number">1000</span>
Pages <span class="token keyword">read</span> ahead <span class="token number">0.00</span><span class="token operator">/</span>s<span class="token punctuation">,</span> evicted <span class="token keyword">without</span> access <span class="token number">0.00</span><span class="token operator">/</span>s<span class="token punctuation">,</span> <span class="token keyword">Random</span> <span class="token keyword">read</span>
ahead <span class="token number">0.00</span><span class="token operator">/</span>s
LRU len: <span class="token number">5720</span><span class="token punctuation">,</span> unzip_LRU len: <span class="token number">0</span>
I<span class="token operator">/</span>O sum<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>:cur<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">,</span> unzip sum<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>:cur<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span></code></pre>
</div>
<p>
The following table describes buffer pool metrics reported by the
<code class="literal">
InnoDB
</code>
Standard Monitor.
</p>
<p>
Per second averages provided in
<code class="literal">
InnoDB
</code>
Standard
Monitor output are based on the elapsed time since
<code class="literal">
InnoDB
</code>
Standard Monitor output was last
printed.
</p>
<div class="table">
<a name="innodb-buffer-pool-metrics">
</a>
<p class="title">
<b>
Table 17.2 InnoDB Buffer Pool Metrics
</b>
</p>
<div class="table-contents">
<table summary="InnoDB buffer pool metrics reported by the InnoDB Standard Monitor.">
<colgroup>
<col style="width: 35%"/>
<col style="width: 65%"/>
</colgroup>
<thead>
<tr>
<th>
Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Total memory allocated
</td>
<td>
The total memory allocated for the buffer pool in bytes.
</td>
</tr>
<tr>
<td>
Dictionary memory allocated
</td>
<td>
The total memory allocated for the
<code class="literal">
InnoDB
</code>
data
dictionary in bytes.
</td>
</tr>
<tr>
<td>
Buffer pool size
</td>
<td>
The total size in pages allocated to the buffer pool.
</td>
</tr>
<tr>
<td>
Free buffers
</td>
<td>
The total size in pages of the buffer pool free list.
</td>
</tr>
<tr>
<td>
Database pages
</td>
<td>
The total size in pages of the buffer pool LRU list.
</td>
</tr>
<tr>
<td>
Old database pages
</td>
<td>
The total size in pages of the buffer pool old LRU sublist.
</td>
</tr>
<tr>
<td>
Modified db pages
</td>
<td>
The current number of pages modified in the buffer pool.
</td>
</tr>
<tr>
<td>
Pending reads
</td>
<td>
The number of buffer pool pages waiting to be read into the buffer pool.
</td>
</tr>
<tr>
<td>
Pending writes LRU
</td>
<td>
The number of old dirty pages within the buffer pool to be written from
the bottom of the LRU list.
</td>
</tr>
<tr>
<td>
Pending writes flush list
</td>
<td>
The number of buffer pool pages to be flushed during checkpointing.
</td>
</tr>
<tr>
<td>
Pending writes single page
</td>
<td>
The number of pending independent page writes within the buffer pool.
</td>
</tr>
<tr>
<td>
Pages made young
</td>
<td>
The total number of pages made young in the buffer pool LRU list (moved
to the head of sublist of
<span class="quote">
“
<span class="quote">
new
</span>
”
</span>
pages).
</td>
</tr>
<tr>
<td>
Pages made not young
</td>
<td>
The total number of pages not made young in the buffer pool LRU list
(pages that have remained in the
<span class="quote">
“
<span class="quote">
old
</span>
”
</span>
sublist
without being made young).
</td>
</tr>
<tr>
<td>
youngs/s
</td>
<td>
The per second average of accesses to old pages in the buffer pool LRU
list that have resulted in making pages young. See the notes
that follow this table for more information.
</td>
</tr>
<tr>
<td>
non-youngs/s
</td>
<td>
The per second average of accesses to old pages in the buffer pool LRU
list that have resulted in not making pages young. See the
notes that follow this table for more information.
</td>
</tr>
<tr>
<td>
Pages read
</td>
<td>
The total number of pages read from the buffer pool.
</td>
</tr>
<tr>
<td>
Pages created
</td>
<td>
The total number of pages created within the buffer pool.
</td>
</tr>
<tr>
<td>
Pages written
</td>
<td>
The total number of pages written from the buffer pool.
</td>
</tr>
<tr>
<td>
reads/s
</td>
<td>
The per second average number of buffer pool page reads per second.
</td>
</tr>
<tr>
<td>
creates/s
</td>
<td>
The average number of buffer pool pages created per second.
</td>
</tr>
<tr>
<td>
writes/s
</td>
<td>
The average number of buffer pool page writes per second.
</td>
</tr>
<tr>
<td>
Buffer pool hit rate
</td>
<td>
The buffer pool page hit rate for pages read from the buffer pool vs
from disk storage.
</td>
</tr>
<tr>
<td>
young-making rate
</td>
<td>
The average hit rate at which page accesses have resulted in making
pages young. See the notes that follow this table for more
information.
</td>
</tr>
<tr>
<td>
not (young-making rate)
</td>
<td>
The average hit rate at which page accesses have not resulted in making
pages young. See the notes that follow this table for more
information.
</td>
</tr>
<tr>
<td>
Pages read ahead
</td>
<td>
The per second average of read ahead operations.
</td>
</tr>
<tr>
<td>
Pages evicted without access
</td>
<td>
The per second average of the pages evicted without being accessed from
the buffer pool.
</td>
</tr>
<tr>
<td>
Random read ahead
</td>
<td>
The per second average of random read ahead operations.
</td>
</tr>
<tr>
<td>
LRU len
</td>
<td>
The total size in pages of the buffer pool LRU list.
</td>
</tr>
<tr>
<td>
unzip_LRU len
</td>
<td>
The length (in pages) of the buffer pool unzip_LRU list.
</td>
</tr>
<tr>
<td>
I/O sum
</td>
<td>
The total number of buffer pool LRU list pages accessed.
</td>
</tr>
<tr>
<td>
I/O cur
</td>
<td>
The total number of buffer pool LRU list pages accessed in the current
interval.
</td>
</tr>
<tr>
<td>
I/O unzip sum
</td>
<td>
The total number of buffer pool unzip_LRU list pages decompressed.
</td>
</tr>
<tr>
<td>
I/O unzip cur
</td>
<td>
The total number of buffer pool unzip_LRU list pages decompressed in the
current interval.
</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: 258.297px;">
Name
</th>
<th style="width: 479.703px;">
Description
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<p>
<span class="bold">
<strong>
Notes
</strong>
</span>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The
<code class="literal">
youngs/s
</code>
metric is applicable only to
old pages. It is based on the number of page accesses. There
can be multiple accesses for a given page, all of which are
counted. If you see very low
<code class="literal">
youngs/s
</code>
values when there are no large scans occurring, consider
reducing the delay time or increasing the percentage of the
buffer pool used for the old sublist. Increasing the
percentage makes the old sublist larger so that it takes
longer for pages in that sublist to move to the tail, which
increases the likelihood that those pages are accessed again
and made young. See
<a class="xref" href="innodb-performance-midpoint_insertion.html" title="17.8.3.3 Making the Buffer Pool Scan Resistant">
Section 17.8.3.3, “Making the Buffer Pool Scan Resistant”
</a>
.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
non-youngs/s
</code>
metric is applicable only
to old pages. It is based on the number of page accesses.
There can be multiple accesses for a given page, all of which
are counted. If you do not see a higher
<code class="literal">
non-youngs/s
</code>
value when performing large
table scans (and a higher
<code class="literal">
youngs/s
</code>
value),
increase the delay value. See
<a class="xref" href="innodb-performance-midpoint_insertion.html" title="17.8.3.3 Making the Buffer Pool Scan Resistant">
Section 17.8.3.3, “Making the Buffer Pool Scan Resistant”
</a>
.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
young-making
</code>
rate accounts for all
buffer pool page accesses, not just accesses for pages in the
old sublist. The
<code class="literal">
young-making
</code>
rate and
<code class="literal">
not
</code>
rate do not normally add up to the
overall buffer pool hit rate. Page hits in the old sublist
cause pages to move to the new sublist, but page hits in the
new sublist cause pages to move to the head of the list only
if they are a certain distance from the head.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
not (young-making rate)
</code>
is the average hit
rate at which page accesses have not resulted in making pages
young due to the delay defined by
<a class="link" href="innodb-parameters.html#sysvar_innodb_old_blocks_time">
<code class="literal">
innodb_old_blocks_time
</code>
</a>
not
being met, or due to page hits in the new sublist that did not
result in pages being moved to the head. This rate accounts
for all buffer pool page accesses, not just accesses for pages
in the old sublist.
</p>
</li>
</ul>
</div>
<p>
Buffer pool
<a class="link" href="server-status-variables.html" title="7.1.10 Server Status Variables">
server status
variables
</a>
and the
<a class="link" href="information-schema-innodb-buffer-pool-stats-table.html" title="28.4.4 The INFORMATION_SCHEMA INNODB_BUFFER_POOL_STATS Table">
<code class="literal">
INNODB_BUFFER_POOL_STATS
</code>
</a>
table
provide many of the same buffer pool metrics found in
<code class="literal">
InnoDB
</code>
Standard Monitor output. For more
information, see
<a class="xref" href="innodb-information-schema-buffer-pool-tables.html#innodb-information-schema-buffer-pool-stats-example" title="Example 17.10 Querying the INNODB_BUFFER_POOL_STATS Table">
Example 17.10, “Querying the INNODB_BUFFER_POOL_STATS Table”
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-features-flush.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-features-flush">
</a>
19.5.1.13 Replication and FLUSH
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045135622384">
</a>
<a class="indexterm" name="idm46045135620896">
</a>
<p>
Some forms of the
<a class="link" href="flush.html" title="15.7.8.3 FLUSH Statement">
<code class="literal">
FLUSH
</code>
</a>
statement
are not logged because they could cause problems if replicated
to a replica:
<a class="link" href="flush.html#flush-logs">
<code class="literal">
FLUSH LOGS
</code>
</a>
and
<a class="link" href="flush.html#flush-tables-with-read-lock">
<code class="literal">
FLUSH TABLES WITH READ LOCK
</code>
</a>
. For
a syntax example, see
<a class="xref" href="flush.html" title="15.7.8.3 FLUSH Statement">
Section 15.7.8.3, “FLUSH Statement”
</a>
. The
<a class="link" href="flush.html#flush-tables">
<code class="literal">
FLUSH TABLES
</code>
</a>
,
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
,
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
, and
<a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
<code class="literal">
REPAIR TABLE
</code>
</a>
statements are
written to the binary log and thus replicated to replicas. This
is not normally a problem because these statements do not modify
table data.
</p>
<p>
However, this behavior can cause difficulties under certain
circumstances. If you replicate the privilege tables in the
<code class="literal">
mysql
</code>
database and update those tables
directly without using
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
, you
must issue a
<a class="link" href="flush.html#flush-privileges">
<code class="literal">
FLUSH PRIVILEGES
</code>
</a>
on
the replicas to put the new privileges into effect. In addition,
if you use
<a class="link" href="flush.html#flush-tables">
<code class="literal">
FLUSH TABLES
</code>
</a>
when
renaming a
<code class="literal">
MyISAM
</code>
table that is part of a
<code class="literal">
MERGE
</code>
table, you must issue
<a class="link" href="flush.html#flush-tables">
<code class="literal">
FLUSH TABLES
</code>
</a>
manually on the
replicas. These statements are written to the binary log unless
you specify
<code class="literal">
NO_WRITE_TO_BINLOG
</code>
or its alias
<code class="literal">
LOCAL
</code>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/error-lost-connection.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="error-lost-connection">
</a>
B.3.2.3 Lost connection to MySQL server
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045054471168">
</a>
<a class="indexterm" name="idm46045054469712">
</a>
<a class="indexterm" name="idm46045054468224">
</a>
<p>
There are three likely causes for this error message.
</p>
<p>
Usually it indicates network connectivity trouble and you
should check the condition of your network if this error
occurs frequently. If the error message includes
<span class="quote">
“
<span class="quote">
during
query,
</span>
”
</span>
this is probably the case you are experiencing.
</p>
<p>
Sometimes the
<span class="quote">
“
<span class="quote">
during query
</span>
”
</span>
form happens when
millions of rows are being sent as part of one or more
queries. If you know that this is happening, you should try
increasing
<a class="link" href="server-system-variables.html#sysvar_net_read_timeout">
<code class="literal">
net_read_timeout
</code>
</a>
from its default of 30 seconds to 60 seconds or longer,
sufficient for the data transfer to complete.
</p>
<p>
More rarely, it can happen when the client is attempting the
initial connection to the server. In this case, if your
<a class="link" href="server-system-variables.html#sysvar_connect_timeout">
<code class="literal">
connect_timeout
</code>
</a>
value is set
to only a few seconds, you may be able to resolve the problem
by increasing it to ten seconds, perhaps more if you have a
very long distance or slow connection. You can determine
whether you are experiencing this more uncommon cause by using
<code class="literal">
SHOW GLOBAL STATUS LIKE 'Aborted_connects'
</code>
.
It increases by one for each initial connection attempt that
the server aborts. You may see
<span class="quote">
“
<span class="quote">
reading authorization
packet
</span>
”
</span>
as part of the error message; if so, that also
suggests that this is the solution that you need.
</p>
<p>
If the cause is none of those just described, you may be
experiencing a problem with
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
values that are larger
than
<a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
<code class="literal">
max_allowed_packet
</code>
</a>
,
which can cause this error with some clients. Sometime you may
see an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_net_packet_too_large" target="_top">
<code class="literal">
ER_NET_PACKET_TOO_LARGE
</code>
</a>
error, and that confirms that you need to increase
<a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
<code class="literal">
max_allowed_packet
</code>
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/channels-with-prev-replication.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="channels-with-prev-replication">
</a>
19.2.2.2 Compatibility with Previous Replication Statements
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045138141424">
</a>
<p>
When a replica has multiple channels and a
<code class="literal">
FOR CHANNEL
<em class="replaceable">
<code>
channel
</code>
</em>
</code>
option is not
specified, a valid statement generally acts on all available
channels, with some specific exceptions.
</p>
<p>
For example, the following statements behave as expected for all
except certain Group Replication channels:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START REPLICA
</code>
</a>
starts
replication threads for all channels, except the
<code class="literal">
group_replication_recovery
</code>
and
<code class="literal">
group_replication_applier
</code>
channels.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
<code class="literal">
STOP REPLICA
</code>
</a>
stops replication
threads for all channels, except the
<code class="literal">
group_replication_recovery
</code>
and
<code class="literal">
group_replication_applier
</code>
channels.
</p>
</li>
<li class="listitem">
<p>
<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>
reports the
status for all channels, except the
<code class="literal">
group_replication_applier
</code>
channel.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="reset-replica.html" title="15.4.2.3 RESET REPLICA Statement">
<code class="literal">
RESET REPLICA
</code>
</a>
resets all
channels.
</p>
</li>
</ul>
</div>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
Use
<a class="link" href="reset-replica.html" title="15.4.2.3 RESET REPLICA Statement">
<code class="literal">
RESET REPLICA
</code>
</a>
with caution as
this statement deletes all existing channels, purges their relay
log files, and recreates only the default channel.
</p>
</div>
<p>
Some replication statements cannot operate on all channels. In
this case, error 1964
<span class="errortext">
Multiple channels exist on the
replica. Please provide channel name as an argument.
</span>
is generated. The following statements and functions generate this
error when used in a multi-source replication topology and a
<code class="literal">
FOR CHANNEL
<em class="replaceable">
<code>
channel
</code>
</em>
</code>
option is not used to specify which channel to act on:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<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>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE REPLICATION SOURCE TO
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="replication-functions-synchronization.html#function_source-pos-wait">
<code class="literal">
SOURCE_POS_WAIT()
</code>
</a>
</p>
</li>
</ul>
</div>
<p>
Note that a default channel always exists in a single source
replication topology, where statements and functions behave as in
previous versions of MySQL.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-transaction-scheduling.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-transaction-scheduling">
</a>
17.7.6 Transaction Scheduling
</h3>
</div>
</div>
</div>
<p>
<code class="literal">
InnoDB
</code>
uses the Contention-Aware Transaction
Scheduling (CATS) algorithm to prioritize transactions that are
waiting for locks. When multiple transactions are waiting for a
lock on the same object, the CATS algorithm determines which
transaction receives the lock first.
</p>
<p>
The CATS algorithm prioritizes waiting transactions by assigning a
scheduling weight, which is computed based on the number of
transactions that a transaction blocks. For example, if two
transactions are waiting for a lock on the same object, the
transaction that blocks the most transactions is assigned a
greater scheduling weight. If weights are equal, priority is given
to the longest waiting transaction.
</p>
<p>
You can view transaction scheduling weights by querying the
<code class="literal">
TRX_SCHEDULE_WEIGHT
</code>
column in the Information
Schema
<a class="link" href="information-schema-innodb-trx-table.html" title="28.4.28 The INFORMATION_SCHEMA INNODB_TRX Table">
<code class="literal">
INNODB_TRX
</code>
</a>
table. Weights are
computed for waiting transactions only. Waiting transactions are
those in a
<code class="literal">
LOCK WAIT
</code>
transaction execution
state, as reported by the
<code class="literal">
TRX_STATE
</code>
column. A
transaction that is not waiting for a lock reports a NULL
<code class="literal">
TRX_SCHEDULE_WEIGHT
</code>
value.
</p>
<p>
<a class="link" href="information-schema-innodb-metrics-table.html" title="28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table">
<code class="literal">
INNODB_METRICS
</code>
</a>
counters are provided
for monitoring of code-level transaction scheduling events. For
information about using
<a class="link" href="information-schema-innodb-metrics-table.html" title="28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table">
<code class="literal">
INNODB_METRICS
</code>
</a>
counters, see
<a class="xref" href="innodb-information-schema-metrics-table.html" title="17.15.6 InnoDB INFORMATION_SCHEMA Metrics Table">
Section 17.15.6, “InnoDB INFORMATION_SCHEMA Metrics Table”
</a>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
lock_rec_release_attempts
</code>
</p>
<p>
The number of attempts to release record locks. A single
attempt may lead to zero or more record locks being released,
as there may be zero or more record locks in a single
structure.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
lock_rec_grant_attempts
</code>
</p>
<p>
The number of attempts to grant record locks. A single attempt
may result in zero or more record locks being granted.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
lock_schedule_refreshes
</code>
</p>
<p>
The number of times the wait-for graph was analyzed to update
the scheduled transaction weights.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-features-row-searches.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-features-row-searches">
</a>
19.5.1.27 Replication and Row Searches
</h4>
</div>
</div>
</div>
<p>
When a replica using row-based replication format applies an
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
or
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
operation, it must search
the relevant table for the matching rows. The algorithm used to
carry out this process uses one of the table's indexes to carry
out the search as the first choice, and a hash table if there
are no suitable indexes.
</p>
<p>
The algorithm first assesses the available indexes in the table
definition to see if there is any suitable index to use, and if
there are multiple possibilities, which index is the best fit
for the operation. The algorithm ignores the following types of
index:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Fulltext indexes.
</p>
</li>
<li class="listitem">
<p>
Hidden indexes.
</p>
</li>
<li class="listitem">
<p>
Generated indexes.
</p>
</li>
<li class="listitem">
<p>
Multi-valued indexes.
</p>
</li>
<li class="listitem">
<p>
Any index where the before-image of the row event does not
contain all the columns of the index.
</p>
</li>
</ul>
</div>
<p>
If there are no suitable indexes after ruling out these index
types, the algorithm does not use an index for the search. If
there are suitable indexes, one index is selected from the
candidates, in the following priority order:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
A primary key.
</p>
</li>
<li class="listitem">
<p>
A unique index where every column in the index has a NOT
NULL attribute. If more than one such index is available,
the algorithm chooses the leftmost of these indexes.
</p>
</li>
<li class="listitem">
<p>
Any other index. If more than one such index is available,
the algorithm chooses the leftmost of these indexes.
</p>
</li>
</ol>
</div>
<p>
If the algorithm is able to select a primary key or a unique
index where every column in the index has a
<code class="literal">
NOT
NULL
</code>
attribute, it uses this index to iterate over the
rows in the
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
or
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
operation. For each row in
the row event, the algorithm looks up the row in the index to
locate the table record to update. If no matching record is
found, it returns the error
<span class="errortext">
ER_KEY_NOT_FOUND
</span>
and stops the
replication applier thread.
</p>
<p>
If the algorithm was not able to find a suitable index, or was
only able to find an index that was non-unique or contained
nulls, a hash table is used to assist in identifying the table
records. The algorithm creates a hash table containing the rows
in the
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
or
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
operation, with the key as
the full before-image of the row. The algorithm then iterates
over all the records in the target table, using the selected
index if it found one, or else performing a full table scan. For
each record in the target table, it determines whether that row
exists in the hash table. If the row is found in the hash table,
the record in the target table is updated, and the row is
deleted from the hash table. When all the records in the target
table have been checked, the algorithm verifies whether the hash
table is now empty. If there are any unmatched rows remaining in
the hash table, the algorithm returns the error
<span class="errortext">
ER_KEY_NOT_FOUND
</span>
and stops the
replication applier thread.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-responses-failure-exit.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="group-replication-responses-failure-exit">
</a>
20.7.7.4 Exit Action
</h4>
</div>
</div>
</div>
<p>
The
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_exit_state_action">
<code class="literal">
group_replication_exit_state_action
</code>
</a>
system variable specifies what Group Replication does when the
member leaves the group unintentionally due to an error or
problem, and either fails to auto-rejoin or does not try. Note
that in the case of an expelled member, the member does not know
that it was expelled until it reconnects to the group, so the
specified action is only taken if the member manages to
reconnect, or if the member raises a suspicion on itself and
expels itself.
</p>
<p>
In order of impact, the exit actions are as follows:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
If
<code class="literal">
READ_ONLY
</code>
is the exit action, the
instance switches MySQL to super read only mode by setting
the system variable
<a class="link" href="server-system-variables.html#sysvar_super_read_only">
<code class="literal">
super_read_only
</code>
</a>
to
<code class="literal">
ON
</code>
. When the member is in super read only
mode, clients cannot make any updates, even if they have the
<a class="link" href="privileges-provided.html#priv_connection-admin">
<code class="literal">
CONNECTION_ADMIN
</code>
</a>
privilege
(or the deprecated
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege). However, clients can still read data, and
because updates are no longer being made, there is a
probability of stale reads which increases over time. With
this setting, you therefore need to pro-actively monitor the
servers for failures. This exit action is the default; after
is taken, the member's status is shown as
<code class="literal">
ERROR
</code>
in the view of the group.
</p>
</li>
<li class="listitem">
<p>
If
<code class="literal">
OFFLINE_MODE
</code>
is the exit action, the
instance switches MySQL to offline mode by setting the
system variable
<a class="link" href="server-system-variables.html#sysvar_offline_mode">
<code class="literal">
offline_mode
</code>
</a>
to
<code class="literal">
ON
</code>
. When the member is in offline mode,
connected client users are disconnected on their next
request and connections are no longer accepted, with the
exception of client users that have the
<a class="link" href="privileges-provided.html#priv_connection-admin">
<code class="literal">
CONNECTION_ADMIN
</code>
</a>
privilege
(or the deprecated
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege). Group Replication also sets the system variable
<a class="link" href="server-system-variables.html#sysvar_super_read_only">
<code class="literal">
super_read_only
</code>
</a>
to
<code class="literal">
ON
</code>
, so clients cannot make any updates,
even if they have connected with the
<a class="link" href="privileges-provided.html#priv_connection-admin">
<code class="literal">
CONNECTION_ADMIN
</code>
</a>
or
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege. This exit
action prevents both updates and stale reads (with the
exception of reads by client users with the stated
privileges), and enables proxy tools such as MySQL Router to
recognize that the server is unavailable and redirect client
connections. It also leaves the instance running so that an
administrator can attempt to resolve the issue without
shutting down MySQL. After this exit action is taken, the
member's status is displayed as
<code class="literal">
ERROR
</code>
in
the view of the group (not
<code class="literal">
OFFLINE
</code>
, which
means a member has Group Replication functionality available
but does not currently belong to a group).
</p>
</li>
<li class="listitem">
<p>
If
<code class="literal">
ABORT_SERVER
</code>
is the exit action, the
instance shuts down MySQL. Instructing the member to shut
itself down prevents all stale reads and client updates, but
it means that the MySQL Server instance is unavailable and
must be restarted, even if the issue could have been
resolved without that step. After this exit action is taken,
the member is removed from the listing of servers in the
view of the group.
</p>
</li>
</ol>
</div>
<p>
Bear in mind that operator intervention is required whatever
exit action is set, as an ex-member that has exhausted its
auto-rejoin attempts (or never had any) and has been expelled
from the group is not allowed to rejoin without a restart of
Group Replication. The exit action only influences whether or
not clients can still read data on the server that was unable to
rejoin the group, and whether or not the server stays running.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
If a failure occurs before the member has successfully joined
the group, the exit action specified by
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_exit_state_action">
<code class="literal">
group_replication_exit_state_action
</code>
</a>
<span class="emphasis">
<em>
is not taken
</em>
</span>
. This is the case if there
is a failure during the local configuration check, or a
mismatch between the configuration of the joining member and
the configuration of the group. In these situations, the
<a class="link" href="server-system-variables.html#sysvar_super_read_only">
<code class="literal">
super_read_only
</code>
</a>
system
variable is left with its original value, and the server does
not shut down MySQL. To ensure that the server cannot accept
updates when Group Replication did not start, we therefore
recommend that
<a class="link" href="server-system-variables.html#sysvar_super_read_only">
<code class="literal">
super_read_only=ON
</code>
</a>
is set in
the server's configuration file at startup, which Group
Replication changes to
<code class="literal">
OFF
</code>
on primary
members after it has been started successfully. This safeguard
is particularly important when the server is configured to
start Group Replication on server boot
(
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_start_on_boot">
<code class="literal">
group_replication_start_on_boot=ON
</code>
</a>
),
but it is also useful when Group Replication is started
manually using a
<a class="link" href="start-group-replication.html" title="15.4.3.1 START GROUP_REPLICATION Statement">
<code class="literal">
START
GROUP_REPLICATION
</code>
</a>
statement.
</p>
</div>
<p>
If a failure occurs after the member has successfully joined the
group, the specified exit action is taken. This is the case in
the following situations:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
<span class="emphasis">
<em>
Applier error
</em>
</span>
- There is an error in
the replication applier. This issue is not recoverable.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Distributed recovery not possible
</em>
</span>
-
There is an issue that means Group Replication's distributed
recovery process (which uses remote cloning operations and
state transfer from the binary log) cannot be completed.
Group Replication retries distributed recovery automatically
where this makes sense, but stops if there are no more
options to complete the process. For details, see
<a class="xref" href="group-replication-distributed-recovery-fault.html" title="20.5.4.4 Fault Tolerance for Distributed Recovery">
Section 20.5.4.4, “Fault Tolerance for Distributed Recovery”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Group configuration change error
</em>
</span>
- An
error occurred during a group-wide configuration change
carried out using a function, as described in
<a class="xref" href="group-replication-configuring-online-group.html" title="20.5.1 Configuring an Online Group">
Section 20.5.1, “Configuring an Online Group”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Primary election error
</em>
</span>
- An error
occurred during election of a new primary member for a group
in single-primary mode, as described in
<a class="xref" href="group-replication-single-primary-mode.html" title="20.1.3.1 Single-Primary Mode">
Section 20.1.3.1, “Single-Primary Mode”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Unreachable majority timeout
</em>
</span>
- The
member has lost contact with a majority of the group members
so is in a minority, and a timeout that was set by the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_unreachable_majority_timeout">
<code class="literal">
group_replication_unreachable_majority_timeout
</code>
</a>
system variable has expired.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Member expelled from group
</em>
</span>
- A
suspicion has been raised on the member, and any timeout set
by the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_member_expel_timeout">
<code class="literal">
group_replication_member_expel_timeout
</code>
</a>
system variable has expired, and the member has resumed
communication with the group and found that it has been
expelled.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Out of auto-rejoin attempts
</em>
</span>
- The
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_autorejoin_tries">
<code class="literal">
group_replication_autorejoin_tries
</code>
</a>
system variable was set to specify a number of auto-rejoin
attempts after a loss of majority or expulsion, and the
member completed this number of attempts without success.
</p>
</li>
</ol>
</div>
<p>
The following table summarizes the failure scenarios and actions
in each case:
</p>
<div class="table">
<a name="idm46045131925856">
</a>
<p class="title">
<b>
Table 20.3 Exit actions in Group Replication failure situations
</b>
</p>
<div class="table-contents">
<table frame="all" summary="Summarizes how the selected exit action does or does not operate depending on the failure situation">
<colgroup>
<col align="left" style="width: 33%"/>
<col align="left" style="width: 33%"/>
<col align="left" style="width: 33%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
<p>
Failure situation
</p>
</th>
<th scope="col">
<p>
Group Replication started with
<code class="literal">
START
GROUP_REPLICATION
</code>
</p>
</th>
<th scope="col">
<p>
Group Replication started with
<code class="literal">
group_replication_start_on_boot =ON
</code>
</p>
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
<p>
Member fails local configuration check
</p>
<p>
Mismatch between joining member and group configuration
</p>
</th>
<td>
<p>
<code class="literal">
super_read_only
</code>
and
<code class="literal">
offline_mode
</code>
unchanged
</p>
<p>
MySQL continues running
</p>
<p>
Set
<code class="literal">
super_read_only=ON
</code>
at startup to
prevent updates
</p>
</td>
<td>
<p>
<code class="literal">
super_read_only
</code>
and
<code class="literal">
offline_mode
</code>
unchanged
</p>
<p>
MySQL continues running
</p>
<p>
Set
<code class="literal">
super_read_only=ON
</code>
at startup to
prevent updates (Important)
</p>
</td>
</tr>
<tr>
<th scope="row">
<p>
Applier error on member
</p>
<p>
Distributed recovery not possible
</p>
<p>
Group configuration change error
</p>
<p>
Primary election error
</p>
<p>
Unreachable majority timeout
</p>
<p>
Member expelled from group
</p>
<p>
Out of auto-rejoin attempts
</p>
</th>
<td>
<p>
<code class="literal">
super_read_only
</code>
set to
<code class="literal">
ON
</code>
</p>
<p>
OR
</p>
<p>
<code class="literal">
offline_mode
</code>
and
<code class="literal">
super_read_only
</code>
set to
<code class="literal">
ON
</code>
</p>
<p>
OR
</p>
<p>
MySQL shuts down
</p>
</td>
<td>
<p>
<code class="literal">
super_read_only
</code>
set to
<code class="literal">
ON
</code>
</p>
<p>
OR
</p>
<p>
<code class="literal">
offline_mode
</code>
and
<code class="literal">
super_read_only
</code>
set to
<code class="literal">
ON
</code>
</p>
<p>
OR
</p>
<p>
MySQL shuts down
</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-innodb-ft-index-table-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-innodb-ft-index-table-table">
</a>
28.4.19 The INFORMATION_SCHEMA INNODB_FT_INDEX_TABLE Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045076751568">
</a>
<p>
The
<a class="link" href="information-schema-innodb-ft-index-table-table.html" title="28.4.19 The INFORMATION_SCHEMA INNODB_FT_INDEX_TABLE Table">
<code class="literal">
INNODB_FT_INDEX_TABLE
</code>
</a>
table
provides information about the inverted index used to process text
searches against the
<code class="literal">
FULLTEXT
</code>
index of an
<code class="literal">
InnoDB
</code>
table.
</p>
<p>
This table is empty initially. Before querying it, set the value
of the
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_aux_table">
<code class="literal">
innodb_ft_aux_table
</code>
</a>
system
variable to the name (including the database name) of the table
that contains the
<code class="literal">
FULLTEXT
</code>
index (for example,
<code class="literal">
test/articles
</code>
).
</p>
<p>
For related usage information and examples, see
<a class="xref" href="innodb-information-schema-fulltext_index-tables.html" title="17.15.4 InnoDB INFORMATION_SCHEMA FULLTEXT Index Tables">
Section 17.15.4, “InnoDB INFORMATION_SCHEMA FULLTEXT Index Tables”
</a>
.
</p>
<p>
The
<a class="link" href="information-schema-innodb-ft-index-table-table.html" title="28.4.19 The INFORMATION_SCHEMA INNODB_FT_INDEX_TABLE Table">
<code class="literal">
INNODB_FT_INDEX_TABLE
</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">
WORD
</code>
</p>
<p>
A word extracted from the text of the columns that are part of
a
<code class="literal">
FULLTEXT
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
FIRST_DOC_ID
</code>
</p>
<p>
The first document ID in which this word appears in the
<code class="literal">
FULLTEXT
</code>
index.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
LAST_DOC_ID
</code>
</p>
<p>
The last document ID in which this word appears in the
<code class="literal">
FULLTEXT
</code>
index.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DOC_COUNT
</code>
</p>
<p>
The number of rows in which this word appears in the
<code class="literal">
FULLTEXT
</code>
index. The same word can occur
several times within the cache table, once for each
combination of
<code class="literal">
DOC_ID
</code>
and
<code class="literal">
POSITION
</code>
values.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DOC_ID
</code>
</p>
<p>
The document ID of the row containing the word. This value
might reflect the value of an ID column that you defined for
the underlying table, or it can be a sequence value generated
by
<code class="literal">
InnoDB
</code>
when the table contains no
suitable column.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
POSITION
</code>
</p>
<p>
The position of this particular instance of the word within
the relevant document identified by the
<code class="literal">
DOC_ID
</code>
value.
</p>
</li>
</ul>
</div>
<h4>
<a name="idm46045076722448">
</a>
Notes
</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
This table is empty initially. Before querying it, set the
value of the
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_aux_table">
<code class="literal">
innodb_ft_aux_table
</code>
</a>
system
variable to the name (including the database name) of the
table that contains the
<code class="literal">
FULLTEXT
</code>
index (for
example,
<code class="literal">
test/articles
</code>
). The following
example demonstrates how to use the
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_aux_table">
<code class="literal">
innodb_ft_aux_table
</code>
</a>
system
variable to show information about a
<code class="literal">
FULLTEXT
</code>
index for a specified table.
Before information for newly inserted rows appears in
<code class="literal">
INNODB_FT_INDEX_TABLE
</code>
, the
<code class="literal">
FULLTEXT
</code>
index cache must be flushed to
disk. This is accomplished by running an
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
operation on the
indexed table with the
<a class="link" href="innodb-parameters.html#sysvar_innodb_optimize_fulltext_only">
<code class="literal">
innodb_optimize_fulltext_only
</code>
</a>
system variable enabled. (The example disables that variable
again at the end because it is intended to be enabled only
temporarily.)
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa97746523"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> articles <span class="token punctuation">(</span>
id <span class="token datatype">INT</span> <span class="token keyword">UNSIGNED</span> <span class="token keyword">AUTO_INCREMENT</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>
title <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">200</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
body <span class="token datatype">TEXT</span><span class="token punctuation">,</span>
<span class="token keyword">FULLTEXT</span> <span class="token punctuation">(</span>title<span class="token punctuation">,</span>body<span class="token punctuation">)</span>
<span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>InnoDB<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> articles <span class="token punctuation">(</span>title<span class="token punctuation">,</span>body<span class="token punctuation">)</span> <span class="token keyword">VALUES</span>
<span class="token punctuation">(</span><span class="token string">'MySQL Tutorial'</span><span class="token punctuation">,</span><span class="token string">'DBMS stands for DataBase ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token string">'How To Use MySQL Well'</span><span class="token punctuation">,</span><span class="token string">'After you went through a ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token string">'Optimizing MySQL'</span><span class="token punctuation">,</span><span class="token string">'In this tutorial we show ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token string">'1001 MySQL Tricks'</span><span class="token punctuation">,</span><span class="token string">'1. Never run mysqld as root. 2. ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token string">'MySQL vs. YourSQL'</span><span class="token punctuation">,</span><span class="token string">'In the following database comparison ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token string">'MySQL Security'</span><span class="token punctuation">,</span><span class="token string">'When configured properly, MySQL ...'</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">GLOBAL</span> innodb_optimize_fulltext_only<span class="token operator">=</span><span class="token keyword">ON</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">OPTIMIZE</span> <span class="token keyword">TABLE</span> articles<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Table <span class="token punctuation">|</span> Op <span class="token punctuation">|</span> Msg_type <span class="token punctuation">|</span> Msg_text <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> test.articles <span class="token punctuation">|</span> optimize <span class="token punctuation">|</span> status <span class="token punctuation">|</span> OK <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> innodb_ft_aux_table <span class="token operator">=</span> <span class="token string">'test/articles'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> WORD<span class="token punctuation">,</span> DOC_COUNT<span class="token punctuation">,</span> DOC_ID<span class="token punctuation">,</span> POSITION
<span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_FT_INDEX_TABLE <span class="token keyword">LIMIT</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 class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> WORD <span class="token punctuation">|</span> DOC_COUNT <span class="token punctuation">|</span> DOC_ID <span class="token punctuation">|</span> POSITION <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1001 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> after <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 22 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> comparison <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 44 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> configured <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> 20 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> database <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 31 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> innodb_optimize_fulltext_only<span class="token operator">=</span><span class="token keyword">OFF</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
You must have the
<a class="link" href="privileges-provided.html#priv_process">
<code class="literal">
PROCESS
</code>
</a>
privilege to query this table.
</p>
</li>
<li class="listitem">
<p>
Use the
<code class="literal">
INFORMATION_SCHEMA
</code>
<a class="link" href="information-schema-columns-table.html" title="28.3.8 The INFORMATION_SCHEMA COLUMNS Table">
<code class="literal">
COLUMNS
</code>
</a>
table or the
<a class="link" href="show-columns.html" title="15.7.7.6 SHOW COLUMNS Statement">
<code class="literal">
SHOW COLUMNS
</code>
</a>
statement to view
additional information about the columns of this table,
including data types and default values.
</p>
</li>
<li class="listitem">
<p>
For more information about
<code class="literal">
InnoDB
</code>
<code class="literal">
FULLTEXT
</code>
search, see
<a class="xref" href="innodb-fulltext-index.html" title="17.6.2.4 InnoDB Full-Text Indexes">
Section 17.6.2.4, “InnoDB Full-Text Indexes”
</a>
, and
<a class="xref" href="fulltext-search.html" title="14.9 Full-Text Search Functions">
Section 14.9, “Full-Text Search Functions”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/optimization-indexes.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="optimization-indexes">
</a>
10.3 Optimization and Indexes
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<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>
</div>
<a class="indexterm" name="idm46045227577968">
</a>
<p>
The best way to improve the performance of
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
operations is to create
indexes on one or more of the columns that are tested in the
query. The index entries act like pointers to the table rows,
allowing the query to quickly determine which rows match a
condition in the
<code class="literal">
WHERE
</code>
clause, and retrieve the
other column values for those rows. All MySQL data types can be
indexed.
</p>
<p>
Although it can be tempting to create an indexes for every
possible column used in a query, unnecessary indexes waste space
and waste time for MySQL to determine which indexes to use.
Indexes also add to the cost of inserts, updates, and deletes
because each index must be updated. You must find the right
balance to achieve fast queries using the optimal set of indexes.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-persistent-stats.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="innodb-persistent-stats">
</a>
17.8.10.1 Configuring Persistent Optimizer Statistics Parameters
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045162470496">
</a>
<a class="indexterm" name="idm46045162469024">
</a>
<a class="indexterm" name="idm46045162467520">
</a>
<a class="indexterm" name="idm46045162466016">
</a>
<a class="indexterm" name="idm46045162464512">
</a>
<p>
The persistent optimizer statistics feature improves
<a class="link" href="glossary.html#glos_plan_stability" title="plan stability">
plan stability
</a>
by
storing statistics to disk and making them persistent across
server restarts so that the
<a class="link" href="glossary.html#glos_optimizer" title="optimizer">
optimizer
</a>
is more likely
to make consistent choices each time for a given query.
</p>
<p>
Optimizer statistics are persisted to disk when
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_persistent">
<code class="literal">
innodb_stats_persistent=ON
</code>
</a>
or
when individual tables are defined with
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
STATS_PERSISTENT=1
</code>
</a>
.
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_persistent">
<code class="literal">
innodb_stats_persistent
</code>
</a>
is
enabled by default.
</p>
<p>
Formerly, optimizer statistics were cleared when restarting the
server and after some other types of operations, and recomputed
on the next table access. Consequently, different estimates
could be produced when recalculating statistics leading to
different choices in query execution plans and variation in
query performance.
</p>
<p>
Persistent statistics are stored in the
<code class="literal">
mysql.innodb_table_stats
</code>
and
<code class="literal">
mysql.innodb_index_stats
</code>
tables. See
<a class="xref" href="innodb-persistent-stats.html#innodb-persistent-stats-tables" title="17.8.10.1.5 InnoDB Persistent Statistics Tables">
Section 17.8.10.1.5, “InnoDB Persistent Statistics Tables”
</a>
.
</p>
<p>
If you prefer not to persist optimizer statistics to disk, see
<a class="xref" href="innodb-statistics-estimation.html" title="17.8.10.2 Configuring Non-Persistent Optimizer Statistics Parameters">
Section 17.8.10.2, “Configuring Non-Persistent Optimizer Statistics Parameters”
</a>
</p>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="innodb-persistent-stats-auto-recalc">
</a>
17.8.10.1.1 Configuring Automatic Statistics Calculation for Persistent Optimizer
Statistics
</h5>
</div>
</div>
</div>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_auto_recalc">
<code class="literal">
innodb_stats_auto_recalc
</code>
</a>
variable, which is enabled by default, controls whether
statistics are calculated automatically when a table undergoes
changes to more than 10% of its rows. You can also configure
automatic statistics recalculation for individual tables by
specifying the
<code class="literal">
STATS_AUTO_RECALC
</code>
clause
when creating or altering a table.
</p>
<p>
Because of the asynchronous nature of automatic statistics
recalculation, which occurs in the background, statistics may
not be recalculated instantly after running a DML operation
that affects more than 10% of a table, even when
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_auto_recalc">
<code class="literal">
innodb_stats_auto_recalc
</code>
</a>
is
enabled. Statistics recalculation can be delayed by few
seconds in some cases. If up-to-date statistics are required
immediately, run
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
to initiate a synchronous (foreground) recalculation of
statistics.
</p>
<p>
If
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_auto_recalc">
<code class="literal">
innodb_stats_auto_recalc
</code>
</a>
is disabled, you can ensure the accuracy of optimizer
statistics by executing the
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE
TABLE
</code>
</a>
statement after making substantial changes to
indexed columns. You might also consider adding
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
to setup scripts
that you run after loading data, and running
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
on a schedule at
times of low activity.
</p>
<p>
When an index is added to an existing table, or when a column
is added or dropped, index statistics are calculated and added
to the
<code class="literal">
innodb_index_stats
</code>
table regardless
of the value of
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_auto_recalc">
<code class="literal">
innodb_stats_auto_recalc
</code>
</a>
.
</p>
<p>
For a histogram with
<code class="literal">
AUTO UPDATE
</code>
enabled
(see
<a class="xref" href="analyze-table.html#analyze-table-histogram-statistics-analysis" title="Histogram Statistics Analysis">
Histogram Statistics Analysis
</a>
),
automatic recalculation of persistent statistics also causes
the histogram to be updated.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="innodb-persistent-stats-table-configuration">
</a>
17.8.10.1.2 Configuring Optimizer Statistics Parameters for Individual Tables
</h5>
</div>
</div>
</div>
<p>
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_persistent">
<code class="literal">
innodb_stats_persistent
</code>
</a>
,
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_auto_recalc">
<code class="literal">
innodb_stats_auto_recalc
</code>
</a>
, and
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_persistent_sample_pages">
<code class="literal">
innodb_stats_persistent_sample_pages
</code>
</a>
are global variables. To override these system-wide settings
and configure optimizer statistics parameters for individual
tables, you can define
<code class="literal">
STATS_PERSISTENT
</code>
,
<code class="literal">
STATS_AUTO_RECALC
</code>
, and
<code class="literal">
STATS_SAMPLE_PAGES
</code>
clauses in
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
or
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statements.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
STATS_PERSISTENT
</code>
specifies whether to
enable
<a class="link" href="glossary.html#glos_persistent_statistics" title="persistent statistics">
persistent
statistics
</a>
for an
<code class="literal">
InnoDB
</code>
table.
The value
<code class="literal">
DEFAULT
</code>
causes the persistent
statistics setting for the table to be determined by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_persistent">
<code class="literal">
innodb_stats_persistent
</code>
</a>
setting. A value of
<code class="literal">
1
</code>
enables
persistent statistics for the table, while a value of
<code class="literal">
0
</code>
disables the feature. After enabling
persistent statistics for an individual table, use
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
to calculate
statistics after table data is loaded.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
STATS_AUTO_RECALC
</code>
specifies whether to
automatically recalculate
<a class="link" href="glossary.html#glos_persistent_statistics" title="persistent statistics">
persistent
statistics
</a>
. The value
<code class="literal">
DEFAULT
</code>
causes the persistent statistics setting for the table to
be determined by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_auto_recalc">
<code class="literal">
innodb_stats_auto_recalc
</code>
</a>
setting. A value of
<code class="literal">
1
</code>
causes statistics
to be recalculated when 10% of table data has changed. A
value
<code class="literal">
0
</code>
prevents automatic
recalculation for the table. When using a value of 0, use
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
to
recalculate statistics after making substantial changes to
the table.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
STATS_SAMPLE_PAGES
</code>
specifies the number
of index pages to sample when cardinality and other
statistics are calculated for an indexed column, by an
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
operation,
for example.
</p>
</li>
</ul>
</div>
<p>
All three clauses are specified in the following
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa38207923"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> <span class="token punctuation">`</span>t1<span class="token punctuation">`</span> <span class="token punctuation">(</span>
<span class="token punctuation">`</span>id<span class="token punctuation">`</span> <span class="token datatype">int</span><span class="token punctuation">(</span><span class="token number">8</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">auto_increment</span><span class="token punctuation">,</span>
<span class="token punctuation">`</span><span class="token keyword">data</span><span class="token punctuation">`</span> <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 punctuation">`</span><span class="token datatype">date</span><span class="token punctuation">`</span> <span class="token datatype">datetime</span><span class="token punctuation">,</span>
<span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">INDEX</span> <span class="token punctuation">`</span>DATE_IX<span class="token punctuation">`</span> <span class="token punctuation">(</span><span class="token punctuation">`</span><span class="token datatype">date</span><span class="token punctuation">`</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>InnoDB<span class="token punctuation">,</span>
<span class="token keyword">STATS_PERSISTENT</span><span class="token operator">=</span><span class="token number">1</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">STATS_SAMPLE_PAGES</span><span class="token operator">=</span><span class="token number">25</span><span class="token punctuation">;</span></code></pre>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="innodb-persistent-stats-pages-sampled">
</a>
17.8.10.1.3 Configuring the Number of Sampled Pages for InnoDB Optimizer Statistics
</h5>
</div>
</div>
</div>
<p>
The 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. Operations such as
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE
TABLE
</code>
</a>
cause
<code class="literal">
InnoDB
</code>
to sample
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 sampling technique is known as a
<a class="link" href="glossary.html#glos_random_dive" title="random dive">
random dive
</a>
.
</p>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_persistent_sample_pages">
<code class="literal">
innodb_stats_persistent_sample_pages
</code>
</a>
controls the number of sampled pages. You can adjust the
setting at runtime to manage the quality of statistics
estimates used by the optimizer. The default value is 20.
Consider modifying the setting when encountering the following
issues:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
<span class="emphasis">
<em>
Statistics are not accurate enough and the
optimizer chooses suboptimal plans
</em>
</span>
, as shown in
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
output. You can
check the accuracy of statistics by comparing the actual
cardinality of an index (determined by running
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
DISTINCT
</code>
</a>
on the index columns) with the
estimates in the
<code class="literal">
mysql.innodb_index_stats
</code>
table.
</p>
<p>
If it is determined that statistics are not accurate
enough, the value of
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_persistent_sample_pages">
<code class="literal">
innodb_stats_persistent_sample_pages
</code>
</a>
should be increased until the statistics estimates are
sufficiently accurate. Increasing
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_persistent_sample_pages">
<code class="literal">
innodb_stats_persistent_sample_pages
</code>
</a>
too much, however, could cause
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
to run
slowly.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
is
too slow
</em>
</span>
. In this case
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_persistent_sample_pages">
<code class="literal">
innodb_stats_persistent_sample_pages
</code>
</a>
should be decreased until
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE
TABLE
</code>
</a>
execution time is acceptable. Decreasing
the value too much, however, could lead to the first
problem of inaccurate statistics and suboptimal query
execution plans.
</p>
<p>
If a balance cannot be achieved between accurate
statistics and
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE
TABLE
</code>
</a>
execution time, consider decreasing the
number of indexed columns in the table or limiting the
number of partitions to reduce
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
complexity.
The number of columns in the table's primary key is also
important to consider, as primary key columns are appended
to each nonunique index.
</p>
<p>
For related information, see
<a class="xref" href="innodb-analyze-table-complexity.html" title="17.8.10.3 Estimating ANALYZE TABLE Complexity for InnoDB Tables">
Section 17.8.10.3, “Estimating ANALYZE TABLE Complexity for InnoDB Tables”
</a>
.
</p>
</li>
</ol>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="innodb-persistent-stats-delete-marked">
</a>
17.8.10.1.4 Including Delete-marked Records in Persistent Statistics Calculations
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045162371248">
</a>
<a class="indexterm" name="idm46045162370144">
</a>
<p>
By default,
<code class="literal">
InnoDB
</code>
reads uncommitted data
when calculating statistics. In the case of an uncommitted
transaction that deletes rows from a table, delete-marked
records are excluded when calculating row estimates and index
statistics, which can lead to non-optimal execution plans for
other transactions that are operating on the table
concurrently using a transaction isolation level other than
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_read-uncommitted">
<code class="literal">
READ UNCOMMITTED
</code>
</a>
. To avoid
this scenario,
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_include_delete_marked">
<code class="literal">
innodb_stats_include_delete_marked
</code>
</a>
can be enabled to ensure that delete-marked records are
included when calculating persistent optimizer statistics.
</p>
<p>
When
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_include_delete_marked">
<code class="literal">
innodb_stats_include_delete_marked
</code>
</a>
is enabled,
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
considers delete-marked records when recalculating statistics.
</p>
<p>
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_include_delete_marked">
<code class="literal">
innodb_stats_include_delete_marked
</code>
</a>
is a global setting that affects all
<code class="literal">
InnoDB
</code>
tables, and it is only applicable to persistent optimizer
statistics.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="innodb-persistent-stats-tables">
</a>
17.8.10.1.5 InnoDB Persistent Statistics Tables
</h5>
</div>
</div>
</div>
<p>
The persistent statistics feature relies on the internally
managed tables in the
<code class="literal">
mysql
</code>
database, named
<code class="literal">
innodb_table_stats
</code>
and
<code class="literal">
innodb_index_stats
</code>
. These tables are set up
automatically in all install, upgrade, and build-from-source
procedures.
</p>
<div class="table">
<a name="innodb-table-stats-table">
</a>
<p class="title">
<b>
Table 17.6 Columns of innodb_table_stats
</b>
</p>
<div class="table-contents">
<table summary="Columns of the mysql.innodb_table_stats table.">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<thead>
<tr>
<th>
Column name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code class="literal">
database_name
</code>
</td>
<td>
Database name
</td>
</tr>
<tr>
<td>
<code class="literal">
table_name
</code>
</td>
<td>
Table name, partition name, or subpartition name
</td>
</tr>
<tr>
<td>
<code class="literal">
last_update
</code>
</td>
<td>
A timestamp indicating the last time that
<code class="literal">
InnoDB
</code>
updated this row
</td>
</tr>
<tr>
<td>
<code class="literal">
n_rows
</code>
</td>
<td>
The number of rows in the table
</td>
</tr>
<tr>
<td>
<code class="literal">
clustered_index_size
</code>
</td>
<td>
The size of the primary index, in pages
</td>
</tr>
<tr>
<td>
<code class="literal">
sum_of_other_index_sizes
</code>
</td>
<td>
The total size of other (non-primary) indexes, in pages
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<div class="table">
<a name="innodb-index-stats-table">
</a>
<p class="title">
<b>
Table 17.7 Columns of innodb_index_stats
</b>
</p>
<div class="table-contents">
<table summary="Columns of the mysql.innodb_index_stats table.">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<thead>
<tr>
<th>
Column name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code class="literal">
database_name
</code>
</td>
<td>
Database name
</td>
</tr>
<tr>
<td>
<code class="literal">
table_name
</code>
</td>
<td>
Table name, partition name, or subpartition name
</td>
</tr>
<tr>
<td>
<code class="literal">
index_name
</code>
</td>
<td>
Index name
</td>
</tr>
<tr>
<td>
<code class="literal">
last_update
</code>
</td>
<td>
A timestamp indicating the last time the row was updated
</td>
</tr>
<tr>
<td>
<code class="literal">
stat_name
</code>
</td>
<td>
The name of the statistic, whose value is reported in the
<code class="literal">
stat_value
</code>
column
</td>
</tr>
<tr>
<td>
<code class="literal">
stat_value
</code>
</td>
<td>
The value of the statistic that is named in
<code class="literal">
stat_name
</code>
column
</td>
</tr>
<tr>
<td>
<code class="literal">
sample_size
</code>
</td>
<td>
The number of pages sampled for the estimate provided in the
<code class="literal">
stat_value
</code>
column
</td>
</tr>
<tr>
<td>
<code class="literal">
stat_description
</code>
</td>
<td>
Description of the statistic that is named in the
<code class="literal">
stat_name
</code>
column
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
The
<code class="literal">
innodb_table_stats
</code>
and
<code class="literal">
innodb_index_stats
</code>
tables include a
<code class="literal">
last_update
</code>
column that shows when index
statistics were last updated:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69569339"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> innodb_table_stats \G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
database_name<span class="token punctuation">:</span> sakila
table_name<span class="token punctuation">:</span> actor
last_update<span class="token punctuation">:</span> 2014-05-28 16<span class="token punctuation">:</span>16<span class="token punctuation">:</span>44
n_rows<span class="token punctuation">:</span> 200
clustered_index_size<span class="token punctuation">:</span> 1
sum_of_other_index_sizes<span class="token punctuation">:</span> 1
...</span></code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa19077813"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> innodb_index_stats \G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
database_name<span class="token punctuation">:</span> sakila
table_name<span class="token punctuation">:</span> actor
index_name<span class="token punctuation">:</span> PRIMARY
last_update<span class="token punctuation">:</span> 2014-05-28 16<span class="token punctuation">:</span>16<span class="token punctuation">:</span>44
stat_name<span class="token punctuation">:</span> n_diff_pfx01
stat_value<span class="token punctuation">:</span> 200
sample_size<span class="token punctuation">:</span> 1
...</span></code></pre>
</div>
<p>
The
<code class="literal">
innodb_table_stats
</code>
and
<code class="literal">
innodb_index_stats
</code>
tables can be updated
manually, which makes it possible to force a specific query
optimization plan or test alternative plans without modifying
the database. If you manually update statistics, use the
<code class="literal">
FLUSH TABLE
<em class="replaceable">
<code>
tbl_name
</code>
</em>
</code>
statement to
load the updated statistics.
</p>
<p>
Persistent statistics are considered local information,
because they relate to the server instance. The
<code class="literal">
innodb_table_stats
</code>
and
<code class="literal">
innodb_index_stats
</code>
tables are therefore not
replicated when automatic statistics recalculation takes
place. If you run
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
to initiate a synchronous recalculation of statistics, the
statement is replicated (unless you suppressed logging for
it), and recalculation takes place on replicas.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="innodb-persistent-stats-tables-example">
</a>
17.8.10.1.6 InnoDB Persistent Statistics Tables Example
</h5>
</div>
</div>
</div>
<p>
The
<code class="literal">
innodb_table_stats
</code>
table contains one
row for each table. The following example demonstrates the
type of data collected.
</p>
<p>
Table
<code class="literal">
t1
</code>
contains a primary index (columns
<code class="literal">
a
</code>
,
<code class="literal">
b
</code>
) secondary index
(columns
<code class="literal">
c
</code>
,
<code class="literal">
d
</code>
), and
unique index (columns
<code class="literal">
e
</code>
,
<code class="literal">
f
</code>
):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa85099225"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>
a <span class="token datatype">INT</span><span class="token punctuation">,</span> b <span class="token datatype">INT</span><span class="token punctuation">,</span> c <span class="token datatype">INT</span><span class="token punctuation">,</span> d <span class="token datatype">INT</span><span class="token punctuation">,</span> e <span class="token datatype">INT</span><span class="token punctuation">,</span> f <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span>a<span class="token punctuation">,</span> b<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">KEY</span> i1 <span class="token punctuation">(</span>c<span class="token punctuation">,</span> d<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">UNIQUE</span> <span class="token keyword">KEY</span> i2uniq <span class="token punctuation">(</span>e<span class="token punctuation">,</span> f<span class="token punctuation">)</span>
<span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>INNODB<span class="token punctuation">;</span></code></pre>
</div>
<p>
After inserting five rows of sample data, table
<code class="literal">
t1
</code>
appears as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa81368807"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> t1<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> a <span class="token punctuation">|</span> b <span class="token punctuation">|</span> c <span class="token punctuation">|</span> d <span class="token punctuation">|</span> e <span class="token punctuation">|</span> f <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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> 10 <span class="token punctuation">|</span> 11 <span class="token punctuation">|</span> 100 <span class="token punctuation">|</span> 101 <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> 10 <span class="token punctuation">|</span> 11 <span class="token punctuation">|</span> 200 <span class="token punctuation">|</span> 102 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> 11 <span class="token punctuation">|</span> 100 <span class="token punctuation">|</span> 103 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> 12 <span class="token punctuation">|</span> 200 <span class="token punctuation">|</span> 104 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> 12 <span class="token punctuation">|</span> 100 <span class="token punctuation">|</span> 105 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 immediately update statistics, run
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
(if
<a class="link" href="innodb-parameters.html#sysvar_innodb_stats_auto_recalc">
<code class="literal">
innodb_stats_auto_recalc
</code>
</a>
is
enabled, statistics are updated automatically within a few
seconds assuming that the 10% threshold for changed table rows
is reached):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa49850196"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">ANALYZE</span> <span class="token keyword">TABLE</span> t1<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 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>
<span class="token output"><span class="token punctuation">|</span> test.t1 <span class="token punctuation">|</span> analyze <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></code></pre>
</div>
<p>
Table statistics for table
<code class="literal">
t1
</code>
show the last
time
<code class="literal">
InnoDB
</code>
updated the table statistics
(
<code class="literal">
2014-03-14 14:36:34
</code>
), the number of rows
in the table (
<code class="literal">
5
</code>
), the clustered index size
(
<code class="literal">
1
</code>
page), and the combined size of the
other indexes (
<code class="literal">
2
</code>
pages).
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa67574776"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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>innodb_table_stats <span class="token keyword">WHERE</span> <span class="token keyword">table_name</span> <span class="token operator">like</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>
database_name<span class="token punctuation">:</span> test
table_name<span class="token punctuation">:</span> t1
last_update<span class="token punctuation">:</span> 2014-03-14 14<span class="token punctuation">:</span>36<span class="token punctuation">:</span>34
n_rows<span class="token punctuation">:</span> 5
clustered_index_size<span class="token punctuation">:</span> 1
sum_of_other_index_sizes<span class="token punctuation">:</span> 2</span></code></pre>
</div>
<p>
The
<code class="literal">
innodb_index_stats
</code>
table contains
multiple rows for each index. Each row in the
<code class="literal">
innodb_index_stats
</code>
table provides data
related to a particular index statistic which is named in the
<code class="literal">
stat_name
</code>
column and described in the
<code class="literal">
stat_description
</code>
column. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa49556240"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> index_name<span class="token punctuation">,</span> stat_name<span class="token punctuation">,</span> stat_value<span class="token punctuation">,</span> stat_description
<span class="token keyword">FROM</span> mysql<span class="token punctuation">.</span>innodb_index_stats <span class="token keyword">WHERE</span> <span class="token keyword">table_name</span> <span class="token operator">like</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>
<span class="token output"><span class="token punctuation">|</span> index_name <span class="token punctuation">|</span> stat_name <span class="token punctuation">|</span> stat_value <span class="token punctuation">|</span> stat_description <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> PRIMARY <span class="token punctuation">|</span> n_diff_pfx01 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> a <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> PRIMARY <span class="token punctuation">|</span> n_diff_pfx02 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> a,b <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> PRIMARY <span class="token punctuation">|</span> n_leaf_pages <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> Number of leaf pages in the index <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> PRIMARY <span class="token punctuation">|</span> size <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> Number of pages in the index <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> i1 <span class="token punctuation">|</span> n_diff_pfx01 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> c <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> i1 <span class="token punctuation">|</span> n_diff_pfx02 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> c,d <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> i1 <span class="token punctuation">|</span> n_diff_pfx03 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> c,d,a <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> i1 <span class="token punctuation">|</span> n_diff_pfx04 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> c,d,a,b <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> i1 <span class="token punctuation">|</span> n_leaf_pages <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> Number of leaf pages in the index <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> i1 <span class="token punctuation">|</span> size <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> Number of pages in the index <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> i2uniq <span class="token punctuation">|</span> n_diff_pfx01 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> e <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> i2uniq <span class="token punctuation">|</span> n_diff_pfx02 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> e,f <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> i2uniq <span class="token punctuation">|</span> n_leaf_pages <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> Number of leaf pages in the index <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> i2uniq <span class="token punctuation">|</span> size <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> Number of pages in the index <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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
<code class="literal">
stat_name
</code>
column shows the following
types of statistics:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
size
</code>
: Where
<code class="literal">
stat_name
</code>
=
<code class="literal">
size
</code>
, the
<code class="literal">
stat_value
</code>
column displays the total
number of pages in the index.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
n_leaf_pages
</code>
: Where
<code class="literal">
stat_name
</code>
=
<code class="literal">
n_leaf_pages
</code>
,
the
<code class="literal">
stat_value
</code>
column displays the
number of leaf pages in the index.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
n_diff_pfx
<em class="replaceable">
<code>
NN
</code>
</em>
</code>
:
Where
<code class="literal">
stat_name
</code>
=
<code class="literal">
n_diff_pfx01
</code>
,
the
<code class="literal">
stat_value
</code>
column displays the
number of distinct values in the first column of the
index. Where
<code class="literal">
stat_name
</code>
=
<code class="literal">
n_diff_pfx02
</code>
,
the
<code class="literal">
stat_value
</code>
column displays the
number of distinct values in the first two columns of the
index, and so on. Where
<code class="literal">
stat_name
</code>
=
<code class="literal">
n_diff_pfx
<em class="replaceable">
<code>
NN
</code>
</em>
</code>
,
the
<code class="literal">
stat_description
</code>
column shows a
comma separated list of the index columns that are
counted.
</p>
</li>
</ul>
</div>
<p>
To further illustrate the
<code class="literal">
n_diff_pfx
<em class="replaceable">
<code>
NN
</code>
</em>
</code>
statistic, which provides cardinality data, consider once
again the
<code class="literal">
t1
</code>
table example that was
introduced previously. As shown below, the
<code class="literal">
t1
</code>
table is created with a primary index
(columns
<code class="literal">
a
</code>
,
<code class="literal">
b
</code>
), a
secondary index (columns
<code class="literal">
c
</code>
,
<code class="literal">
d
</code>
), and a unique index (columns
<code class="literal">
e
</code>
,
<code class="literal">
f
</code>
):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa83634878"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>
a <span class="token datatype">INT</span><span class="token punctuation">,</span> b <span class="token datatype">INT</span><span class="token punctuation">,</span> c <span class="token datatype">INT</span><span class="token punctuation">,</span> d <span class="token datatype">INT</span><span class="token punctuation">,</span> e <span class="token datatype">INT</span><span class="token punctuation">,</span> f <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span>a<span class="token punctuation">,</span> b<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">KEY</span> i1 <span class="token punctuation">(</span>c<span class="token punctuation">,</span> d<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">UNIQUE</span> <span class="token keyword">KEY</span> i2uniq <span class="token punctuation">(</span>e<span class="token punctuation">,</span> f<span class="token punctuation">)</span>
<span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>INNODB<span class="token punctuation">;</span></code></pre>
</div>
<p>
After inserting five rows of sample data, table
<code class="literal">
t1
</code>
appears as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa98197488"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> t1<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> a <span class="token punctuation">|</span> b <span class="token punctuation">|</span> c <span class="token punctuation">|</span> d <span class="token punctuation">|</span> e <span class="token punctuation">|</span> f <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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> 10 <span class="token punctuation">|</span> 11 <span class="token punctuation">|</span> 100 <span class="token punctuation">|</span> 101 <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> 10 <span class="token punctuation">|</span> 11 <span class="token punctuation">|</span> 200 <span class="token punctuation">|</span> 102 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> 11 <span class="token punctuation">|</span> 100 <span class="token punctuation">|</span> 103 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> 12 <span class="token punctuation">|</span> 200 <span class="token punctuation">|</span> 104 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> 12 <span class="token punctuation">|</span> 100 <span class="token punctuation">|</span> 105 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 you query the
<code class="literal">
index_name
</code>
,
<code class="literal">
stat_name
</code>
,
<code class="literal">
stat_value
</code>
,
and
<code class="literal">
stat_description
</code>
, where
<code class="literal">
stat_name LIKE 'n_diff%'
</code>
, the following
result set is returned:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20357205"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> index_name<span class="token punctuation">,</span> stat_name<span class="token punctuation">,</span> stat_value<span class="token punctuation">,</span> stat_description
<span class="token keyword">FROM</span> mysql<span class="token punctuation">.</span>innodb_index_stats
<span class="token keyword">WHERE</span> <span class="token keyword">table_name</span> <span class="token operator">like</span> <span class="token string">'t1'</span> <span class="token operator">AND</span> stat_name <span class="token operator">LIKE</span> <span class="token string">'n_diff%'</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>
<span class="token output"><span class="token punctuation">|</span> index_name <span class="token punctuation">|</span> stat_name <span class="token punctuation">|</span> stat_value <span class="token punctuation">|</span> stat_description <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> PRIMARY <span class="token punctuation">|</span> n_diff_pfx01 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> a <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> PRIMARY <span class="token punctuation">|</span> n_diff_pfx02 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> a,b <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> i1 <span class="token punctuation">|</span> n_diff_pfx01 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> c <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> i1 <span class="token punctuation">|</span> n_diff_pfx02 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> c,d <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> i1 <span class="token punctuation">|</span> n_diff_pfx03 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> c,d,a <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> i1 <span class="token punctuation">|</span> n_diff_pfx04 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> c,d,a,b <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> i2uniq <span class="token punctuation">|</span> n_diff_pfx01 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> e <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> i2uniq <span class="token punctuation">|</span> n_diff_pfx02 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> e,f <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 the
<code class="literal">
PRIMARY
</code>
index, there are two
<code class="literal">
n_diff%
</code>
rows. The number of rows is equal
to the number of columns in the index.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
For nonunique indexes,
<code class="literal">
InnoDB
</code>
appends the
columns of the primary key.
</p>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Where
<code class="literal">
index_name
</code>
=
<code class="literal">
PRIMARY
</code>
and
<code class="literal">
stat_name
</code>
=
<code class="literal">
n_diff_pfx01
</code>
,
the
<code class="literal">
stat_value
</code>
is
<code class="literal">
1
</code>
,
which indicates that there is a single distinct value in
the first column of the index (column
<code class="literal">
a
</code>
). The number of distinct values in
column
<code class="literal">
a
</code>
is confirmed by viewing the
data in column
<code class="literal">
a
</code>
in table
<code class="literal">
t1
</code>
, in which there is a single distinct
value (
<code class="literal">
1
</code>
). The counted column
(
<code class="literal">
a
</code>
) is shown in the
<code class="literal">
stat_description
</code>
column of the result
set.
</p>
</li>
<li class="listitem">
<p>
Where
<code class="literal">
index_name
</code>
=
<code class="literal">
PRIMARY
</code>
and
<code class="literal">
stat_name
</code>
=
<code class="literal">
n_diff_pfx02
</code>
,
the
<code class="literal">
stat_value
</code>
is
<code class="literal">
5
</code>
,
which indicates that there are five distinct values in the
two columns of the index (
<code class="literal">
a,b
</code>
). The
number of distinct values in columns
<code class="literal">
a
</code>
and
<code class="literal">
b
</code>
is confirmed by viewing the data
in columns
<code class="literal">
a
</code>
and
<code class="literal">
b
</code>
in table
<code class="literal">
t1
</code>
, in which there are five
distinct values: (
<code class="literal">
1,1
</code>
),
(
<code class="literal">
1,2
</code>
), (
<code class="literal">
1,3
</code>
),
(
<code class="literal">
1,4
</code>
) and (
<code class="literal">
1,5
</code>
). The
counted columns (
<code class="literal">
a,b
</code>
) are shown in the
<code class="literal">
stat_description
</code>
column of the result
set.
</p>
</li>
</ul>
</div>
<p>
For the secondary index (
<code class="literal">
i1
</code>
), there are
four
<code class="literal">
n_diff%
</code>
rows. Only two columns are
defined for the secondary index (
<code class="literal">
c,d
</code>
) but
there are four
<code class="literal">
n_diff%
</code>
rows for the
secondary index because
<code class="literal">
InnoDB
</code>
suffixes all
nonunique indexes with the primary key. As a result, there are
four
<code class="literal">
n_diff%
</code>
rows instead of two to account
for the both the secondary index columns
(
<code class="literal">
c,d
</code>
) and the primary key columns
(
<code class="literal">
a,b
</code>
).
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Where
<code class="literal">
index_name
</code>
=
<code class="literal">
i1
</code>
and
<code class="literal">
stat_name
</code>
=
<code class="literal">
n_diff_pfx01
</code>
,
the
<code class="literal">
stat_value
</code>
is
<code class="literal">
1
</code>
,
which indicates that there is a single distinct value in
the first column of the index (column
<code class="literal">
c
</code>
). The number of distinct values in
column
<code class="literal">
c
</code>
is confirmed by viewing the
data in column
<code class="literal">
c
</code>
in table
<code class="literal">
t1
</code>
, in which there is a single distinct
value: (
<code class="literal">
10
</code>
). The counted column
(
<code class="literal">
c
</code>
) is shown in the
<code class="literal">
stat_description
</code>
column of the result
set.
</p>
</li>
<li class="listitem">
<p>
Where
<code class="literal">
index_name
</code>
=
<code class="literal">
i1
</code>
and
<code class="literal">
stat_name
</code>
=
<code class="literal">
n_diff_pfx02
</code>
,
the
<code class="literal">
stat_value
</code>
is
<code class="literal">
2
</code>
,
which indicates that there are two distinct values in the
first two columns of the index (
<code class="literal">
c,d
</code>
).
The number of distinct values in columns
<code class="literal">
c
</code>
an
<code class="literal">
d
</code>
is confirmed
by viewing the data in columns
<code class="literal">
c
</code>
and
<code class="literal">
d
</code>
in table
<code class="literal">
t1
</code>
, in
which there are two distinct values:
(
<code class="literal">
10,11
</code>
) and (
<code class="literal">
10,12
</code>
).
The counted columns (
<code class="literal">
c,d
</code>
) are shown in
the
<code class="literal">
stat_description
</code>
column of the
result set.
</p>
</li>
<li class="listitem">
<p>
Where
<code class="literal">
index_name
</code>
=
<code class="literal">
i1
</code>
and
<code class="literal">
stat_name
</code>
=
<code class="literal">
n_diff_pfx03
</code>
,
the
<code class="literal">
stat_value
</code>
is
<code class="literal">
2
</code>
,
which indicates that there are two distinct values in the
first three columns of the index
(
<code class="literal">
c,d,a
</code>
). The number of distinct values
in columns
<code class="literal">
c
</code>
,
<code class="literal">
d
</code>
, and
<code class="literal">
a
</code>
is confirmed by viewing the data in
column
<code class="literal">
c
</code>
,
<code class="literal">
d
</code>
, and
<code class="literal">
a
</code>
in table
<code class="literal">
t1
</code>
, in
which there are two distinct values:
(
<code class="literal">
10,11,1
</code>
) and
(
<code class="literal">
10,12,1
</code>
). The counted columns
(
<code class="literal">
c,d,a
</code>
) are shown in the
<code class="literal">
stat_description
</code>
column of the result
set.
</p>
</li>
<li class="listitem">
<p>
Where
<code class="literal">
index_name
</code>
=
<code class="literal">
i1
</code>
and
<code class="literal">
stat_name
</code>
=
<code class="literal">
n_diff_pfx04
</code>
,
the
<code class="literal">
stat_value
</code>
is
<code class="literal">
5
</code>
,
which indicates that there are five distinct values in the
four columns of the index (
<code class="literal">
c,d,a,b
</code>
).
The number of distinct values in columns
<code class="literal">
c
</code>
,
<code class="literal">
d
</code>
,
<code class="literal">
a
</code>
and
<code class="literal">
b
</code>
is confirmed
by viewing the data in columns
<code class="literal">
c
</code>
,
<code class="literal">
d
</code>
,
<code class="literal">
a
</code>
, and
<code class="literal">
b
</code>
in table
<code class="literal">
t1
</code>
, in
which there are five distinct values:
(
<code class="literal">
10,11,1,1
</code>
),
(
<code class="literal">
10,11,1,2
</code>
),
(
<code class="literal">
10,11,1,3
</code>
),
(
<code class="literal">
10,12,1,4
</code>
), and
(
<code class="literal">
10,12,1,5
</code>
). The counted columns
(
<code class="literal">
c,d,a,b
</code>
) are shown in the
<code class="literal">
stat_description
</code>
column of the result
set.
</p>
</li>
</ul>
</div>
<p>
For the unique index (
<code class="literal">
i2uniq
</code>
), there are
two
<code class="literal">
n_diff%
</code>
rows.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Where
<code class="literal">
index_name
</code>
=
<code class="literal">
i2uniq
</code>
and
<code class="literal">
stat_name
</code>
=
<code class="literal">
n_diff_pfx01
</code>
,
the
<code class="literal">
stat_value
</code>
is
<code class="literal">
2
</code>
,
which indicates that there are two distinct values in the
first column of the index (column
<code class="literal">
e
</code>
).
The number of distinct values in column
<code class="literal">
e
</code>
is confirmed by viewing the data in
column
<code class="literal">
e
</code>
in table
<code class="literal">
t1
</code>
, in which there are two distinct
values: (
<code class="literal">
100
</code>
) and
(
<code class="literal">
200
</code>
). The counted column
(
<code class="literal">
e
</code>
) is shown in the
<code class="literal">
stat_description
</code>
column of the result
set.
</p>
</li>
<li class="listitem">
<p>
Where
<code class="literal">
index_name
</code>
=
<code class="literal">
i2uniq
</code>
and
<code class="literal">
stat_name
</code>
=
<code class="literal">
n_diff_pfx02
</code>
,
the
<code class="literal">
stat_value
</code>
is
<code class="literal">
5
</code>
,
which indicates that there are five distinct values in the
two columns of the index (
<code class="literal">
e,f
</code>
). The
number of distinct values in columns
<code class="literal">
e
</code>
and
<code class="literal">
f
</code>
is confirmed by viewing the data
in columns
<code class="literal">
e
</code>
and
<code class="literal">
f
</code>
in table
<code class="literal">
t1
</code>
, in which there are five
distinct values: (
<code class="literal">
100,101
</code>
),
(
<code class="literal">
200,102
</code>
),
(
<code class="literal">
100,103
</code>
),
(
<code class="literal">
200,104
</code>
), and
(
<code class="literal">
100,105
</code>
). The counted columns
(
<code class="literal">
e,f
</code>
) are shown in the
<code class="literal">
stat_description
</code>
column of the result
set.
</p>
</li>
</ul>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="innodb-persistent-stats-tables-index-size">
</a>
17.8.10.1.7 Retrieving Index Size Using the innodb_index_stats Table
</h5>
</div>
</div>
</div>
<p>
You can retrieve the index size for tables, partitions, or
subpartitions can using the
<code class="literal">
innodb_index_stats
</code>
table. In the following
example, index sizes are retrieved for table
<code class="literal">
t1
</code>
. For a definition of table
<code class="literal">
t1
</code>
and corresponding index statistics, see
<a class="xref" href="innodb-persistent-stats.html#innodb-persistent-stats-tables-example" title="17.8.10.1.6 InnoDB Persistent Statistics Tables Example">
Section 17.8.10.1.6, “InnoDB Persistent Statistics Tables Example”
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa65780812"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">SUM</span><span class="token punctuation">(</span>stat_value<span class="token punctuation">)</span> pages<span class="token punctuation">,</span> index_name<span class="token punctuation">,</span>
<span class="token function">SUM</span><span class="token punctuation">(</span>stat_value<span class="token punctuation">)</span><span class="token operator">*</span><span class="token variable">@@innodb_page_size</span> size
<span class="token keyword">FROM</span> mysql<span class="token punctuation">.</span>innodb_index_stats <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 operator">AND</span> stat_name <span class="token operator">=</span> <span class="token string">'size'</span> <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> index_name<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> pages <span class="token punctuation">|</span> index_name <span class="token punctuation">|</span> size <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> PRIMARY <span class="token punctuation">|</span> 16384 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> i1 <span class="token punctuation">|</span> 16384 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> i2uniq <span class="token punctuation">|</span> 16384 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 partitions or subpartitions, you can use the same query
with a modified
<code class="literal">
WHERE
</code>
clause to retrieve
index sizes. For example, the following query retrieves index
sizes for partitions of table
<code class="literal">
t1
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa70278540"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">SUM</span><span class="token punctuation">(</span>stat_value<span class="token punctuation">)</span> pages<span class="token punctuation">,</span> index_name<span class="token punctuation">,</span>
<span class="token function">SUM</span><span class="token punctuation">(</span>stat_value<span class="token punctuation">)</span><span class="token operator">*</span><span class="token variable">@@innodb_page_size</span> size
<span class="token keyword">FROM</span> mysql<span class="token punctuation">.</span>innodb_index_stats <span class="token keyword">WHERE</span> <span class="token keyword">table_name</span> <span class="token operator">like</span> <span class="token string">'t1#P%'</span>
<span class="token operator">AND</span> stat_name <span class="token operator">=</span> <span class="token string">'size'</span> <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> index_name<span class="token punctuation">;</span></code></pre>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/selinux-file-context.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="selinux-file-context">
</a>
8.7.4 SELinux File Context
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045231610304">
</a>
<p>
The MySQL Server reads from and writes to many files. If the
SELinux context is not set correctly for these files, access to
the files could be denied.
</p>
<p>
The instructions that follow use the
<code class="literal">
semanage
</code>
binary to manage file context; on RHEL, it's part of the
<code class="literal">
policycoreutils-python-utils
</code>
package:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa33778886"><div class="copy-help left">Press ⌘+C to 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">yum install <span class="token property">-y</span> policycoreutils-python-utils</code></pre>
</div>
<p>
After installing the
<code class="literal">
semanage
</code>
binary, you can
list MySQL file contexts using
<code class="literal">
semanage
</code>
with
the
<code class="literal">
fcontext
</code>
option.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa60693652"><div class="copy-help left">Press ⌘+C to 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">semanage fcontext <span class="token property">-l</span> | grep <span class="token property">-i</span> mysql</code></pre>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="selinux-context-data-dir">
</a>
Setting the MySQL Data Directory Context
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045231600432">
</a>
<p>
The default data directory location is
<code class="filename">
/var/lib/mysql/
</code>
; and the SELinux context
used is
<code class="literal">
mysqld_db_t
</code>
.
</p>
<p>
If you edit the configuration file to use a different location
for the data directory, or for any of the files normally in the
data directory (such as the binary logs), you may need to set
the context for the new location. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa11768816"><div class="copy-help left">Press ⌘+C to 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">semanage fcontext <span class="token property">-a</span> <span class="token property">-t</span> mysqld_db_t <span class="token atrule">"/path/to/my/custom/datadir(/.*)?"</span>
restorecon <span class="token property">-Rv</span> /path/to/my/custom/datadir
semanage fcontext <span class="token property">-a</span> <span class="token property">-t</span> mysqld_db_t <span class="token atrule">"/path/to/my/custom/logdir(/.*)?"</span>
restorecon <span class="token property">-Rv</span> /path/to/my/custom/logdir</code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="selinux-context-error-log">
</a>
Setting the MySQL Error Log File Context
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045231593808">
</a>
<p>
The default location for RedHat RPMs is
<code class="filename">
/var/log/mysqld.log
</code>
; and the SELinux
context type used is
<code class="literal">
mysqld_log_t
</code>
.
</p>
<p>
If you edit the configuration file to use a different location,
you may need to set the context for the new location. For
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa57333900"><div class="copy-help left">Press ⌘+C to 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">semanage fcontext <span class="token property">-a</span> <span class="token property">-t</span> mysqld_log_t <span class="token atrule">"/path/to/my/custom/error.log"</span>
restorecon <span class="token property">-Rv</span> /path/to/my/custom/error<span class="token punctuation">.</span>log</code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="selinux-context-pid-file">
</a>
Setting the PID File Context
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045231587536">
</a>
<p>
The default location for the PID file is
<code class="filename">
/var/run/mysqld/mysqld.pid
</code>
; and the SELinux
context type used is
<code class="literal">
mysqld_var_run_t
</code>
.
</p>
<p>
If you edit the configuration file to use a different location,
you may need to set the context for the new location. For
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa46590078"><div class="copy-help left">Press ⌘+C to 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">semanage fcontext <span class="token property">-a</span> <span class="token property">-t</span> mysqld_var_run_t <span class="token atrule">"/path/to/my/custom/pidfile/directory/.*?"</span>
restorecon <span class="token property">-Rv</span> /path/to/my/custom/pidfile/directory</code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="selinux-context-unix-domain-socket">
</a>
Setting the Unix Domain Socket Context
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045231581120">
</a>
<p>
The default location for the Unix domain socket is
<code class="filename">
/var/lib/mysql/mysql.sock
</code>
; and the SELinux
context type used is
<code class="literal">
mysqld_var_run_t
</code>
.
</p>
<p>
If you edit the configuration file to use a different location,
you may need to set the context for the new location. For
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa72850745"><div class="copy-help left">Press ⌘+C to 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">semanage fcontext <span class="token property">-a</span> <span class="token property">-t</span> mysqld_var_run_t <span class="token atrule">"/path/to/my/custom/mysql\.sock"</span>
restorecon <span class="token property">-Rv</span> /path/to/my/custom/mysql<span class="token punctuation">.</span>sock</code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="selinux-context-secure-file-priv">
</a>
Setting the secure_file_priv Directory Context
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045231574720">
</a>
<p>
For MySQL versions since 5.6.34, 5.7.16, and 8.0.11.
</p>
<p>
Installing the MySQL Server RPM creates a
<code class="filename">
/var/lib/mysql-files/
</code>
directory but does
not set the SELinux context for it. The
<code class="filename">
/var/lib/mysql-files/
</code>
directory is intended
to be used for operations such as
<code class="literal">
SELECT ... INTO
OUTFILE
</code>
.
</p>
<p>
If you enabled the use of this directory by setting
<code class="literal">
secure_file_priv
</code>
, you may need to set the
context like so:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa94966940"><div class="copy-help left">Press ⌘+C to 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">semanage fcontext <span class="token property">-a</span> <span class="token property">-t</span> mysqld_db_t <span class="token atrule">"/var/lib/mysql-files/(/.*)?"</span>
restorecon <span class="token property">-Rv</span> /var/lib/mysql-files</code></pre>
</div>
<p>
Edit this path if you used a different location. For security
purposes, this directory should never be within the data
directory.
</p>
<p>
For more information about this variable, see the
<a class="link" href="server-system-variables.html#sysvar_secure_file_priv">
<code class="literal">
secure_file_priv
</code>
</a>
documentation.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/case-sensitivity.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="case-sensitivity">
</a>
B.3.4.1 Case Sensitivity in String Searches
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045053728000">
</a>
<a class="indexterm" name="idm46045053726544">
</a>
<p>
For nonbinary strings (
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR
</code>
</a>
,
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
,
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
), string searches use the
collation of the comparison operands. For binary strings
(
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
BINARY
</code>
</a>
,
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
,
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
), comparisons use the
numeric values of the bytes in the operands; this means that
for alphabetic characters, comparisons are case-sensitive.
</p>
<p>
A comparison between a nonbinary string and binary string is
treated as a comparison of binary strings.
</p>
<p>
Simple comparison operations (
<code class="literal">
>=, >, =, <,
<=
</code>
, sorting, and grouping) are based on each
character's
<span class="quote">
“
<span class="quote">
sort value.
</span>
”
</span>
Characters with the
same sort value are treated as the same character. For
example, if
<code class="literal">
e
</code>
and
<code class="literal">
é
</code>
have the same sort value in a
given collation, they compare as equal.
</p>
<p>
The default character set and collation are
<code class="literal">
utf8mb4
</code>
and
<code class="literal">
utf8mb4_0900_ai_ci
</code>
, so nonbinary string
comparisons are case-insensitive by default. This means that
if you search with
<code class="literal">
<em class="replaceable">
<code>
col_name
</code>
</em>
LIKE
'a%'
</code>
, you get all column values that start with
<code class="literal">
A
</code>
or
<code class="literal">
a
</code>
. To make this
search case-sensitive, make sure that one of the operands has
a case-sensitive or binary collation. For example, if you are
comparing a column and a string that both have the
<code class="literal">
utf8mb4
</code>
character set, you can use the
<code class="literal">
COLLATE
</code>
operator to cause either operand to
have the
<code class="literal">
utf8mb4_0900_as_cs
</code>
or
<code class="literal">
utf8mb4_bin
</code>
collation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa43543163"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><em class="replaceable">col_name</em> <span class="token keyword">COLLATE</span> utf8mb4_0900_as_cs <span class="token operator">LIKE</span> <span class="token string">'a%'</span>
<em class="replaceable">col_name</em> <span class="token operator">LIKE</span> <span class="token string">'a%'</span> <span class="token keyword">COLLATE</span> utf8mb4_0900_as_cs
<em class="replaceable">col_name</em> <span class="token keyword">COLLATE</span> utf8mb4_bin <span class="token operator">LIKE</span> <span class="token string">'a%'</span>
<em class="replaceable">col_name</em> <span class="token operator">LIKE</span> <span class="token string">'a%'</span> <span class="token keyword">COLLATE</span> utf8mb4_bin</code></pre>
</div>
<p>
If you want a column always to be treated in case-sensitive
fashion, declare it with a case-sensitive or binary collation.
See
<a class="xref" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
Section 15.1.20, “CREATE TABLE Statement”
</a>
.
</p>
<p>
To cause a case-sensitive comparison of nonbinary strings to
be case-insensitive, use
<code class="literal">
COLLATE
</code>
to name a
case-insensitive collation. The strings in the following
example normally are case-sensitive, but
<code class="literal">
COLLATE
</code>
changes the comparison to be
case-insensitive:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa59848825"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">NAMES</span> <span class="token string">'utf8mb4'</span><span class="token punctuation">;</span>
<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 string">'MySQL'</span> <span class="token keyword">COLLATE</span> utf8mb4_bin<span class="token punctuation">,</span>
<span class="token variable">@s2</span> <span class="token operator">=</span> <span class="token string">'mysql'</span> <span class="token keyword">COLLATE</span> utf8mb4_bin<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@s1</span> <span class="token operator">=</span> <span class="token variable">@s2</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @s1 = @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>
<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>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@s1</span> <span class="token keyword">COLLATE</span> utf8mb4_0900_ai_ci <span class="token operator">=</span> <span class="token variable">@s2</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @s1 COLLATE utf8mb4_0900_ai_ci = @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>
<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></code></pre>
</div>
<p>
A binary string is case-sensitive in comparisons. To compare
the string as case-insensitive, convert it to a nonbinary
string and use
<code class="literal">
COLLATE
</code>
to name a
case-insensitive collation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa38615973"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@s</span> <span class="token operator">=</span> <span class="token datatype">BINARY</span> <span class="token string">'MySQL'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@s</span> <span class="token operator">=</span> <span class="token string">'mysql'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @s = 'mysql' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">CONVERT</span><span class="token punctuation">(</span><span class="token variable">@s</span> <span class="token keyword">USING</span> utf8mb4<span class="token punctuation">)</span> <span class="token keyword">COLLATE</span> utf8mb4_0900_ai_ci <span class="token operator">=</span> <span class="token string">'mysql'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> CONVERT(@s USING utf8mb4) COLLATE utf8mb4_0900_ai_ci = 'mysql' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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 class="token punctuation">+</span></span></code></pre>
</div>
<p>
To determine whether a value is compared as a nonbinary or
binary string, use the
<a class="link" href="information-functions.html#function_collation">
<code class="literal">
COLLATION()
</code>
</a>
function. This
example shows that
<a class="link" href="information-functions.html#function_version">
<code class="literal">
VERSION()
</code>
</a>
returns a string that has a case-insensitive collation, so
comparisons are case-insensitive:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa9298288"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">COLLATION</span><span class="token punctuation">(</span><span class="token function">VERSION</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> COLLATION(VERSION()) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> utf8mb3_general_ci <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 binary strings, the collation value is
<code class="literal">
binary
</code>
, so comparisons are case sensitive.
One context in which you can expect to see
<code class="literal">
binary
</code>
is for compression functions, which
return binary strings as a general rule: string:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa54279686"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">COLLATION</span><span class="token punctuation">(</span><span class="token function">COMPRESS</span><span class="token punctuation">(</span><span class="token string">'x'</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>
<span class="token output"><span class="token punctuation">|</span> COLLATION(COMPRESS('x')) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> binary <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 check the sort value of a string, the
<a class="link" href="string-functions.html#function_weight-string">
<code class="literal">
WEIGHT_STRING()
</code>
</a>
may be helpful.
See
<a class="xref" href="string-functions.html" title="14.8 String Functions and Operators">
Section 14.8, “String Functions and Operators”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/retrieving-data.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="retrieving-data">
</a>
5.3.4 Retrieving Information from a Table
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="selecting-all.html">
5.3.4.1 Selecting All Data
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="selecting-rows.html">
5.3.4.2 Selecting Particular Rows
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="selecting-columns.html">
5.3.4.3 Selecting Particular Columns
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sorting-rows.html">
5.3.4.4 Sorting Rows
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="date-calculations.html">
5.3.4.5 Date Calculations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="working-with-null.html">
5.3.4.6 Working with NULL Values
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="pattern-matching.html">
5.3.4.7 Pattern Matching
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="counting-rows.html">
5.3.4.8 Counting Rows
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="multiple-tables.html">
5.3.4.9 Using More Than one Table
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045325305216">
</a>
<a class="indexterm" name="idm46045325303760">
</a>
<a class="indexterm" name="idm46045325302272">
</a>
<a class="indexterm" name="idm46045325300784">
</a>
<p>
The
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement is used to
pull information from a table. The general form of the statement
is:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa85639393"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <em class="replaceable">what_to_select</em>
<span class="token keyword">FROM</span> <em class="replaceable">which_table</em>
<span class="token keyword">WHERE</span> <em class="replaceable">conditions_to_satisfy</em><span class="token punctuation">;</span></code></pre>
</div>
<p>
<em class="replaceable">
<code>
what_to_select
</code>
</em>
indicates what you
want to see. This can be a list of columns, or
<code class="literal">
*
</code>
to indicate
<span class="quote">
“
<span class="quote">
all columns.
</span>
”
</span>
<em class="replaceable">
<code>
which_table
</code>
</em>
indicates the table from
which you want to retrieve data. The
<code class="literal">
WHERE
</code>
clause is optional. If it is present,
<em class="replaceable">
<code>
conditions_to_satisfy
</code>
</em>
specifies one
or more conditions that rows must satisfy to qualify for
retrieval.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-shell-tutorial-python-documents-modify.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-shell-tutorial-python-documents-modify">
</a>
22.4.3.4 Modify Documents
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045127077696">
</a>
<p>
You can use the
<code class="literal">
modify()
</code>
method to update one
or more documents in a collection. The X DevAPI provides
additional methods for use with the
<code class="literal">
modify()
</code>
method to:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Set and unset fields within documents.
</p>
</li>
<li class="listitem">
<p>
Append, insert, and delete arrays.
</p>
</li>
<li class="listitem">
<p>
Bind, limit, and sort the documents to be modified.
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="idm46045127071248">
</a>
Set and Unset Document Fields
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045127070560">
</a>
<p>
The
<code class="literal">
modify()
</code>
method works by filtering a
collection to include only the documents to be modified and
then applying the operations that you specify to those
documents.
</p>
<p>
In the following example, the
<code class="literal">
modify()
</code>
method uses the search condition to identify the document to
change and then the
<code class="literal">
set()
</code>
method replaces
two values within the nested demographics object.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-mysqlsh"><div class="docs-select-all right" id="sa70733852"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-py></span> db<span class="token punctuation">.</span>countryinfo<span class="token punctuation">.</span><span class="token function">modify</span><span class="token punctuation">(</span><span class="token string">"Code = 'SEA'"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token keyword">set</span><span class="token punctuation">(</span>
<span class="token string">"demographics"</span><span class="token punctuation">,</span> <span class="token punctuation">{</span><span class="token string">"LifeExpectancy"</span><span class="token punctuation">:</span> <span class="token number">78</span><span class="token punctuation">,</span> <span class="token string">"Population"</span><span class="token punctuation">:</span> <span class="token number">28</span><span class="token punctuation">}</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
After you modify a document, use the
<code class="literal">
find()
</code>
method to verify the change.
</p>
<p>
To remove content from a document, use the
<code class="literal">
modify()
</code>
and
<code class="literal">
unset()
</code>
methods. For example, the following query removes the GNP from
a document that matches the search condition.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-mysqlsh"><div class="docs-select-all right" id="sa40576593"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-py></span> db<span class="token punctuation">.</span>countryinfo<span class="token punctuation">.</span><span class="token function">modify</span><span class="token punctuation">(</span><span class="token string">"Name = 'Sealand'"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">unset</span><span class="token punctuation">(</span><span class="token string">"GNP"</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
Use the
<code class="literal">
find()
</code>
method to verify the change.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-mysqlsh"><div class="docs-select-all right" id="sa19371735"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-py></span> db<span class="token punctuation">.</span>countryinfo<span class="token punctuation">.</span><span class="token function">find</span><span class="token punctuation">(</span><span class="token string">"Name = 'Sealand'"</span><span class="token punctuation">)</span>
<span class="token inlinejson"><span class="token punctuation">{</span>
<span class="token property">"_id"</span><span class="token operator">:</span> <span class="token string">"00005e2ff4af00000000000000f4"</span><span class="token punctuation">,</span>
<span class="token property">"Name"</span><span class="token operator">:</span> <span class="token string">"Sealand"</span><span class="token punctuation">,</span>
<span class="token property">"Code:"</span><span class="token operator">:</span> <span class="token string">"SEA"</span><span class="token punctuation">,</span>
<span class="token property">"IndepYear"</span><span class="token operator">:</span> <span class="token number">1967</span><span class="token punctuation">,</span>
<span class="token property">"geography"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"Region"</span><span class="token operator">:</span> <span class="token string">"British Islands"</span><span class="token punctuation">,</span>
<span class="token property">"Continent"</span><span class="token operator">:</span> <span class="token string">"Europe"</span><span class="token punctuation">,</span>
<span class="token property">"SurfaceArea"</span><span class="token operator">:</span> <span class="token number">193</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token property">"government"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"HeadOfState"</span><span class="token operator">:</span> <span class="token string">"Michael Bates"</span><span class="token punctuation">,</span>
<span class="token property">"GovernmentForm"</span><span class="token operator">:</span> <span class="token string">"Monarchy"</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token property">"demographics"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"Population"</span><span class="token operator">:</span> <span class="token number">27</span><span class="token punctuation">,</span>
<span class="token property">"LifeExpectancy"</span><span class="token operator">:</span> <span class="token number">79</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span></span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="mysql-shell-tutorial-python-append-insert-delete">
</a>
Append, Insert, and Delete Arrays
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045127054528">
</a>
<p>
To append an element to an array field, or insert, or delete
elements in an array, use the
<code class="literal">
array_append()
</code>
,
<code class="literal">
array_insert()
</code>
, or
<code class="literal">
array_delete()
</code>
methods. The following
examples modify the
<code class="literal">
countryinfo
</code>
collection
to enable tracking of international airports.
</p>
<p>
The first example uses the
<code class="literal">
modify()
</code>
and
<code class="literal">
set()
</code>
methods to create a new Airports
field in all documents.
</p>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Caution
</div>
<p>
Use care when you modify documents without specifying a
search condition; doing so modifies all documents in the
collection.
</p>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-mysqlsh"><div class="docs-select-all right" id="sa20172744"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-py></span> db<span class="token punctuation">.</span>countryinfo<span class="token punctuation">.</span><span class="token function">modify</span><span class="token punctuation">(</span><span class="token string">"true"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token keyword">set</span><span class="token punctuation">(</span><span class="token string">"Airports"</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>
With the Airports field added, the next example uses the
<code class="literal">
array_append()
</code>
method to add a new airport
to one of the documents.
<span class="emphasis">
<em>
$.Airports
</em>
</span>
in
the following example represents the Airports field of the
current document.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-mysqlsh"><div class="docs-select-all right" id="sa69630620"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-py></span> db<span class="token punctuation">.</span>countryinfo<span class="token punctuation">.</span><span class="token function">modify</span><span class="token punctuation">(</span><span class="token string">"Name = 'France'"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">array_append</span><span class="token punctuation">(</span><span class="token string">"$.Airports"</span><span class="token punctuation">,</span> <span class="token string">"ORY"</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
Use
<code class="literal">
find()
</code>
to see the change.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-mysqlsh"><div class="docs-select-all right" id="sa54607357"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-py></span> db<span class="token punctuation">.</span>countryinfo<span class="token punctuation">.</span><span class="token function">find</span><span class="token punctuation">(</span><span class="token string">"Name = 'France'"</span><span class="token punctuation">)</span>
<span class="token inlinejson"><span class="token punctuation">{</span>
<span class="token property">"GNP"</span><span class="token operator">:</span> <span class="token number">1424285</span><span class="token punctuation">,</span>
<span class="token property">"_id"</span><span class="token operator">:</span> <span class="token string">"00005de917d80000000000000048"</span><span class="token punctuation">,</span>
<span class="token property">"Code"</span><span class="token operator">:</span> <span class="token string">"FRA"</span><span class="token punctuation">,</span>
<span class="token property">"Name"</span><span class="token operator">:</span> <span class="token string">"France"</span><span class="token punctuation">,</span>
<span class="token property">"Airports"</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token string">"ORY"</span>
<span class="token punctuation">]</span><span class="token punctuation">,</span>
<span class="token property">"IndepYear"</span><span class="token operator">:</span> <span class="token number">843</span><span class="token punctuation">,</span>
<span class="token property">"geography"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"Region"</span><span class="token operator">:</span> <span class="token string">"Western Europe"</span><span class="token punctuation">,</span>
<span class="token property">"Continent"</span><span class="token operator">:</span> <span class="token string">"Europe"</span><span class="token punctuation">,</span>
<span class="token property">"SurfaceArea"</span><span class="token operator">:</span> <span class="token number">551500</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token property">"government"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"HeadOfState"</span><span class="token operator">:</span> <span class="token string">"Jacques Chirac"</span><span class="token punctuation">,</span>
<span class="token property">"GovernmentForm"</span><span class="token operator">:</span> <span class="token string">"Republic"</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token property">"demographics"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"Population"</span><span class="token operator">:</span> <span class="token number">59225700</span><span class="token punctuation">,</span>
<span class="token property">"LifeExpectancy"</span><span class="token operator">:</span> <span class="token number">78.80000305175781</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span></span></code></pre>
</div>
<p>
To insert an element at a different position in the array, use
the
<code class="literal">
array_insert()
</code>
method to specify which
index to insert in the path expression. In this case, the
index is 0, or the first element in the array.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-mysqlsh"><div class="docs-select-all right" id="sa20066811"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-py></span> db<span class="token punctuation">.</span>countryinfo<span class="token punctuation">.</span><span class="token function">modify</span><span class="token punctuation">(</span><span class="token string">"Name = 'France'"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">array_insert</span><span class="token punctuation">(</span><span class="token string">"$.Airports[0]"</span><span class="token punctuation">,</span> <span class="token string">"CDG"</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
To delete an element from the array, you must pass to the
<code class="literal">
array_delete()
</code>
method the index of the
element to be deleted.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-mysqlsh"><div class="docs-select-all right" id="sa81317692"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-py></span> db<span class="token punctuation">.</span>countryinfo<span class="token punctuation">.</span><span class="token function">modify</span><span class="token punctuation">(</span><span class="token string">"Name = 'France'"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">array_delete</span><span class="token punctuation">(</span><span class="token string">"$.Airports[1]"</span><span class="token punctuation">)</span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="idm46045127031520">
</a>
Related Information
</h5>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The
<a class="link" href="json.html#json-paths" title="Searching and Modifying JSON Values">
MySQL Reference
Manual
</a>
provides instructions to help you search for
and modify JSON values.
</p>
</li>
<li class="listitem">
<p>
See
<a class="ulink" href="/doc/x-devapi-userguide/en/crud-ebnf-collection-crud-functions.html#crud-ebnf-collectionmodifyfunction" target="_top">
CollectionModifyFunction
</a>
for the full syntax definition.
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/using-spatial-indexes.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="using-spatial-indexes">
</a>
13.4.11 Using Spatial Indexes
</h3>
</div>
</div>
</div>
<p>
The optimizer investigates whether available spatial indexes can
be involved in the search for queries that use a function such
as
<a class="link" href="spatial-relation-functions-mbr.html#function_mbrcontains">
<code class="literal">
MBRContains()
</code>
</a>
or
<a class="link" href="spatial-relation-functions-mbr.html#function_mbrwithin">
<code class="literal">
MBRWithin()
</code>
</a>
in the
<code class="literal">
WHERE
</code>
clause. The following query finds all
objects that are in the given rectangle:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34248895"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">@poly</span> <span class="token operator">=</span>
<span class="token prompt"> -></span> <span class="token string">'Polygon((30000 15000,
31000 15000,
31000 16000,
30000 16000,
30000 15000))'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> fid<span class="token punctuation">,</span><span class="token function">ST_AsText</span><span class="token punctuation">(</span>g<span class="token punctuation">)</span> <span class="token keyword">FROM</span> geom <span class="token keyword">WHERE</span>
<span class="token prompt"> -></span> <span class="token function">MBRContains</span><span class="token punctuation">(</span><span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token variable">@poly</span><span class="token punctuation">)</span><span class="token punctuation">,</span>g<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>
<span class="token output"><span class="token punctuation">|</span> fid <span class="token punctuation">|</span> ST_AsText(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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 21 <span class="token punctuation">|</span> LINESTRING(30350.4 15828.8,30350.6 15845,30333.8 15845,30 ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 22 <span class="token punctuation">|</span> LINESTRING(30350.6 15871.4,30350.6 15887.8,30334 15887.8, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 23 <span class="token punctuation">|</span> LINESTRING(30350.6 15914.2,30350.6 15930.4,30334 15930.4, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 24 <span class="token punctuation">|</span> LINESTRING(30290.2 15823,30290.2 15839.4,30273.4 15839.4, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 25 <span class="token punctuation">|</span> LINESTRING(30291.4 15866.2,30291.6 15882.4,30274.8 15882. ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 26 <span class="token punctuation">|</span> LINESTRING(30291.6 15918.2,30291.6 15934.4,30275 15934.4, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 249 <span class="token punctuation">|</span> LINESTRING(30337.8 15938.6,30337.8 15946.8,30320.4 15946. ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> LINESTRING(30250.4 15129.2,30248.8 15138.4,30238.2 15136. ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> LINESTRING(30220.2 15122.8,30217.2 15137.8,30207.6 15136, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> LINESTRING(30179 15114.4,30176.6 15129.4,30167 15128,3016 ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> LINESTRING(30155.2 15121.4,30140.4 15118.6,30142 15109,30 ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> LINESTRING(30192.4 15085,30177.6 15082.2,30179.2 15072.4, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> LINESTRING(30244 15087,30229 15086.2,30229.4 15076.4,3024 ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 7 <span class="token punctuation">|</span> LINESTRING(30200.6 15059.4,30185.6 15058.6,30186 15048.8, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> LINESTRING(30179.6 15017.8,30181 15002.8,30190.8 15003.6, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 11 <span class="token punctuation">|</span> LINESTRING(30154.2 15000.4,30168.6 15004.8,30166 15014.2, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 13 <span class="token punctuation">|</span> LINESTRING(30105 15065.8,30108.4 15050.8,30118 15053,3011 ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 154 <span class="token punctuation">|</span> LINESTRING(30276.2 15143.8,30261.4 15141,30263 15131.4,30 ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 155 <span class="token punctuation">|</span> LINESTRING(30269.8 15084,30269.4 15093.4,30258.6 15093,30 ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 157 <span class="token punctuation">|</span> LINESTRING(30128.2 15011,30113.2 15010.2,30113.6 15000.4, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">20 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
Use
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
to check the way this
query is executed:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa74894485"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">@poly</span> <span class="token operator">=</span>
<span class="token prompt"> -></span> <span class="token string">'Polygon((30000 15000,
31000 15000,
31000 16000,
30000 16000,
30000 15000))'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">EXPLAIN</span> <span class="token keyword">SELECT</span> fid<span class="token punctuation">,</span><span class="token function">ST_AsText</span><span class="token punctuation">(</span>g<span class="token punctuation">)</span> <span class="token keyword">FROM</span> geom <span class="token keyword">WHERE</span>
<span class="token prompt"> -></span> <span class="token function">MBRContains</span><span class="token punctuation">(</span><span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token variable">@poly</span><span class="token punctuation">)</span><span class="token punctuation">,</span>g<span class="token punctuation">)</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
id<span class="token punctuation">:</span> 1
select_type<span class="token punctuation">:</span> SIMPLE
table<span class="token punctuation">:</span> geom
type<span class="token punctuation">:</span> range
possible_keys<span class="token punctuation">:</span> g
key<span class="token punctuation">:</span> g
key_len<span class="token punctuation">:</span> 32
ref<span class="token punctuation">:</span> NULL
rows<span class="token punctuation">:</span> 50
Extra<span class="token punctuation">:</span> Using where
</span><span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
Check what would happen without a spatial index:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa62945334"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">@poly</span> <span class="token operator">=</span>
<span class="token prompt"> -></span> <span class="token string">'Polygon((30000 15000,
31000 15000,
31000 16000,
30000 16000,
30000 15000))'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">EXPLAIN</span> <span class="token keyword">SELECT</span> fid<span class="token punctuation">,</span><span class="token function">ST_AsText</span><span class="token punctuation">(</span>g<span class="token punctuation">)</span> <span class="token keyword">FROM</span> g <span class="token keyword">IGNORE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span>g<span class="token punctuation">)</span> <span class="token keyword">WHERE</span>
<span class="token prompt"> -></span> <span class="token function">MBRContains</span><span class="token punctuation">(</span><span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token variable">@poly</span><span class="token punctuation">)</span><span class="token punctuation">,</span>g<span class="token punctuation">)</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
id<span class="token punctuation">:</span> 1
select_type<span class="token punctuation">:</span> SIMPLE
table<span class="token punctuation">:</span> geom
type<span class="token punctuation">:</span> ALL
possible_keys<span class="token punctuation">:</span> NULL
key<span class="token punctuation">:</span> NULL
key_len<span class="token punctuation">:</span> NULL
ref<span class="token punctuation">:</span> NULL
rows<span class="token punctuation">:</span> 32376
Extra<span class="token punctuation">:</span> Using where
</span><span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
Executing the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement
without the spatial index yields the same result but causes the
execution time to rise from 0.00 seconds to 0.46 seconds:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa49300592"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">@poly</span> <span class="token operator">=</span>
<span class="token prompt"> -></span> <span class="token string">'Polygon((30000 15000,
31000 15000,
31000 16000,
30000 16000,
30000 15000))'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> fid<span class="token punctuation">,</span><span class="token function">ST_AsText</span><span class="token punctuation">(</span>g<span class="token punctuation">)</span> <span class="token keyword">FROM</span> geom <span class="token keyword">IGNORE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">(</span>g<span class="token punctuation">)</span> <span class="token keyword">WHERE</span>
<span class="token prompt"> -></span> <span class="token function">MBRContains</span><span class="token punctuation">(</span><span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token variable">@poly</span><span class="token punctuation">)</span><span class="token punctuation">,</span>g<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>
<span class="token output"><span class="token punctuation">|</span> fid <span class="token punctuation">|</span> ST_AsText(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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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> LINESTRING(30250.4 15129.2,30248.8 15138.4,30238.2 15136. ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> LINESTRING(30220.2 15122.8,30217.2 15137.8,30207.6 15136, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> LINESTRING(30179 15114.4,30176.6 15129.4,30167 15128,3016 ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> LINESTRING(30155.2 15121.4,30140.4 15118.6,30142 15109,30 ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> LINESTRING(30192.4 15085,30177.6 15082.2,30179.2 15072.4, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> LINESTRING(30244 15087,30229 15086.2,30229.4 15076.4,3024 ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 7 <span class="token punctuation">|</span> LINESTRING(30200.6 15059.4,30185.6 15058.6,30186 15048.8, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> LINESTRING(30179.6 15017.8,30181 15002.8,30190.8 15003.6, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 11 <span class="token punctuation">|</span> LINESTRING(30154.2 15000.4,30168.6 15004.8,30166 15014.2, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 13 <span class="token punctuation">|</span> LINESTRING(30105 15065.8,30108.4 15050.8,30118 15053,3011 ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 21 <span class="token punctuation">|</span> LINESTRING(30350.4 15828.8,30350.6 15845,30333.8 15845,30 ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 22 <span class="token punctuation">|</span> LINESTRING(30350.6 15871.4,30350.6 15887.8,30334 15887.8, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 23 <span class="token punctuation">|</span> LINESTRING(30350.6 15914.2,30350.6 15930.4,30334 15930.4, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 24 <span class="token punctuation">|</span> LINESTRING(30290.2 15823,30290.2 15839.4,30273.4 15839.4, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 25 <span class="token punctuation">|</span> LINESTRING(30291.4 15866.2,30291.6 15882.4,30274.8 15882. ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 26 <span class="token punctuation">|</span> LINESTRING(30291.6 15918.2,30291.6 15934.4,30275 15934.4, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 154 <span class="token punctuation">|</span> LINESTRING(30276.2 15143.8,30261.4 15141,30263 15131.4,30 ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 155 <span class="token punctuation">|</span> LINESTRING(30269.8 15084,30269.4 15093.4,30258.6 15093,30 ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 157 <span class="token punctuation">|</span> LINESTRING(30128.2 15011,30113.2 15010.2,30113.6 15000.4, ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 249 <span class="token punctuation">|</span> LINESTRING(30337.8 15938.6,30337.8 15946.8,30320.4 15946. ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">20 rows in set (0.46 sec)</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-status-variables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="performance-schema-status-variables">
</a>
29.16 Performance Schema Status Variables
</h2>
</div>
</div>
</div>
<p>
The Performance Schema implements several status variables that
provide information about instrumentation that could not be loaded
or created due to memory constraints:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8824589"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'perf%'</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> 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>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_accounts_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_cond_classes_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_cond_instances_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_digest_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_file_classes_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_file_handles_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_file_instances_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_hosts_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_index_stat_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_locker_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_memory_classes_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_metadata_lock_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_meter_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_metric_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_mutex_classes_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_mutex_instances_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_nested_statement_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_prepared_statements_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_program_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_rwlock_classes_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_rwlock_instances_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_session_connect_attrs_longest_seen <span class="token punctuation">|</span> 131 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_session_connect_attrs_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_socket_classes_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_socket_instances_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_stage_classes_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_statement_classes_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_table_handles_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_table_instances_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_table_lock_stat_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_thread_classes_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_thread_instances_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Performance_schema_users_lost <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
For information on using these variables to check Performance
Schema status, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
<p>
Performance Schema status variables have the following meanings:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="statvar_Performance_schema_accounts_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_accounts_lost">
<code class="literal">
Performance_schema_accounts_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064534336">
</a>
<a class="indexterm" name="idm46045064533296">
</a>
<p>
The number of times a row could not be added to the
<a class="link" href="performance-schema-accounts-table.html" title="29.12.8.1 The accounts Table">
<code class="literal">
accounts
</code>
</a>
table because it was
full.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_cond_classes_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_cond_classes_lost">
<code class="literal">
Performance_schema_cond_classes_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064527472">
</a>
<a class="indexterm" name="idm46045064526432">
</a>
<p>
How many condition instruments could not be loaded.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_cond_instances_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_cond_instances_lost">
<code class="literal">
Performance_schema_cond_instances_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064521920">
</a>
<a class="indexterm" name="idm46045064520880">
</a>
<p>
How many condition instrument instances could not be created.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_digest_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_digest_lost">
<code class="literal">
Performance_schema_digest_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064516416">
</a>
<a class="indexterm" name="idm46045064515312">
</a>
<p>
The number of digest instances that could not be instrumented
in the
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_digest
</code>
</a>
table. This can be nonzero if the value of
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_digests_size">
<code class="literal">
performance_schema_digests_size
</code>
</a>
is too small.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_file_classes_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_file_classes_lost">
<code class="literal">
Performance_schema_file_classes_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064508112">
</a>
<a class="indexterm" name="idm46045064507072">
</a>
<p>
How many file instruments could not be loaded.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_file_handles_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_file_handles_lost">
<code class="literal">
Performance_schema_file_handles_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064502496">
</a>
<a class="indexterm" name="idm46045064501456">
</a>
<p>
How many file instrument instances could not be opened.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_file_instances_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_file_instances_lost">
<code class="literal">
Performance_schema_file_instances_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064496928">
</a>
<a class="indexterm" name="idm46045064495888">
</a>
<p>
How many file instrument instances could not be created.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_hosts_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_hosts_lost">
<code class="literal">
Performance_schema_hosts_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064491488">
</a>
<a class="indexterm" name="idm46045064490384">
</a>
<p>
The number of times a row could not be added to the
<a class="link" href="performance-schema-hosts-table.html" title="29.12.8.2 The hosts Table">
<code class="literal">
hosts
</code>
</a>
table because it was full.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_index_stat_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_index_stat_lost">
<code class="literal">
Performance_schema_index_stat_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064484576">
</a>
<a class="indexterm" name="idm46045064483536">
</a>
<p>
The number of indexes for which statistics were lost. This can
be nonzero if the value of
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_index_stat">
<code class="literal">
performance_schema_max_index_stat
</code>
</a>
is too small.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_locker_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_locker_lost">
<code class="literal">
Performance_schema_locker_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064477696">
</a>
<a class="indexterm" name="idm46045064476592">
</a>
<p>
How many events are
<span class="quote">
“
<span class="quote">
lost
</span>
”
</span>
or not recorded, due
to the following conditions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Events are recursive (for example, waiting for A caused a
wait on B, which caused a wait on C).
</p>
</li>
<li class="listitem">
<p>
The depth of the nested events stack is greater than the
limit imposed by the implementation.
</p>
</li>
</ul>
</div>
<p>
Events recorded by the Performance Schema are not recursive,
so this variable should always be 0.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_memory_classes_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_memory_classes_lost">
<code class="literal">
Performance_schema_memory_classes_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064468864">
</a>
<a class="indexterm" name="idm46045064467824">
</a>
<p>
The number of times a memory instrument could not be loaded.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_metadata_lock_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_metadata_lock_lost">
<code class="literal">
Performance_schema_metadata_lock_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064463232">
</a>
<a class="indexterm" name="idm46045064462192">
</a>
<p>
The number of metadata locks that could not be instrumented in
the
<a class="link" href="performance-schema-metadata-locks-table.html" title="29.12.13.3 The metadata_locks Table">
<code class="literal">
metadata_locks
</code>
</a>
table. This
can be nonzero if the value of
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_metadata_locks">
<code class="literal">
performance_schema_max_metadata_locks
</code>
</a>
is too small.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_meter_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_meter_lost">
<code class="literal">
Performance_schema_meter_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064455136">
</a>
<a class="indexterm" name="idm46045064454032">
</a>
<p>
Number of meter instruments that failed to be created.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_metric_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_metric_lost">
<code class="literal">
Performance_schema_metric_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064449568">
</a>
<a class="indexterm" name="idm46045064448464">
</a>
<p>
Number of metric instruments that failed to be created.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_mutex_classes_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_mutex_classes_lost">
<code class="literal">
Performance_schema_mutex_classes_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064443872">
</a>
<a class="indexterm" name="idm46045064442832">
</a>
<p>
How many mutex instruments could not be loaded.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_mutex_instances_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_mutex_instances_lost">
<code class="literal">
Performance_schema_mutex_instances_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064438256">
</a>
<a class="indexterm" name="idm46045064437216">
</a>
<p>
How many mutex instrument instances could not be created.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_nested_statement_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_nested_statement_lost">
<code class="literal">
Performance_schema_nested_statement_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064432672">
</a>
<a class="indexterm" name="idm46045064431552">
</a>
<p>
The number of stored program statements for which statistics
were lost. This can be nonzero if the value of
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_statement_stack">
<code class="literal">
performance_schema_max_statement_stack
</code>
</a>
is too small.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_prepared_statements_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_prepared_statements_lost">
<code class="literal">
Performance_schema_prepared_statements_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064425600">
</a>
<a class="indexterm" name="idm46045064424480">
</a>
<p>
The number of prepared statements that could not be
instrumented in the
<a class="link" href="performance-schema-prepared-statements-instances-table.html" title="29.12.6.4 The prepared_statements_instances Table">
<code class="literal">
prepared_statements_instances
</code>
</a>
table. This can be nonzero if the value of
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_prepared_statements_instances">
<code class="literal">
performance_schema_max_prepared_statements_instances
</code>
</a>
is too small.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_program_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_program_lost">
<code class="literal">
Performance_schema_program_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064417232">
</a>
<a class="indexterm" name="idm46045064416128">
</a>
<p>
The number of stored programs for which statistics were lost.
This can be nonzero if the value of
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_program_instances">
<code class="literal">
performance_schema_max_program_instances
</code>
</a>
is too small.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_rwlock_classes_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_rwlock_classes_lost">
<code class="literal">
Performance_schema_rwlock_classes_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064410208">
</a>
<a class="indexterm" name="idm46045064409168">
</a>
<p>
How many rwlock instruments could not be loaded.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_rwlock_instances_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_rwlock_instances_lost">
<code class="literal">
Performance_schema_rwlock_instances_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064404720">
</a>
<a class="indexterm" name="idm46045064403600">
</a>
<p>
How many rwlock instrument instances could not be created.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_session_connect_attrs_longest_seen">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_session_connect_attrs_longest_seen">
<code class="literal">
Performance_schema_session_connect_attrs_longest_seen
</code>
</a>
</p>
<a class="indexterm" name="idm46045064398960">
</a>
<a class="indexterm" name="idm46045064397920">
</a>
<p>
In addition to the connection attribute size-limit check
performed by the Performance Schema against the value of the
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_session_connect_attrs_size">
<code class="literal">
performance_schema_session_connect_attrs_size
</code>
</a>
system variable, the server performs a preliminary check,
imposing a limit of 64KB on the aggregate size of connection
attribute data it accepts. If a client attempts to send more
than 64KB of attribute data, the server rejects the
connection. Otherwise, the server considers the attribute
buffer valid and tracks the size of the longest such buffer in
the
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_session_connect_attrs_longest_seen">
<code class="literal">
Performance_schema_session_connect_attrs_longest_seen
</code>
</a>
status variable. If this value is larger than
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_session_connect_attrs_size">
<code class="literal">
performance_schema_session_connect_attrs_size
</code>
</a>
,
DBAs may wish to increase the latter value, or, alternatively,
investigate which clients are sending large amounts of
attribute data.
</p>
<p>
For more information about connection attributes, see
<a class="xref" href="performance-schema-connection-attribute-tables.html" title="29.12.9 Performance Schema Connection Attribute Tables">
Section 29.12.9, “Performance Schema Connection Attribute Tables”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_session_connect_attrs_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_session_connect_attrs_lost">
<code class="literal">
Performance_schema_session_connect_attrs_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064387504">
</a>
<a class="indexterm" name="idm46045064386384">
</a>
<p>
The number of connections for which connection attribute
truncation has occurred. For a given connection, if the client
sends connection attribute key-value pairs for which the
aggregate size is larger than the reserved storage permitted
by the value of the
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_session_connect_attrs_size">
<code class="literal">
performance_schema_session_connect_attrs_size
</code>
</a>
system variable, the Performance Schema truncates the
attribute data and increments
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_session_connect_attrs_lost">
<code class="literal">
Performance_schema_session_connect_attrs_lost
</code>
</a>
.
If this value is nonzero, you may wish to set
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_session_connect_attrs_size">
<code class="literal">
performance_schema_session_connect_attrs_size
</code>
</a>
to a larger value.
</p>
<p>
For more information about connection attributes, see
<a class="xref" href="performance-schema-connection-attribute-tables.html" title="29.12.9 Performance Schema Connection Attribute Tables">
Section 29.12.9, “Performance Schema Connection Attribute Tables”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_socket_classes_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_socket_classes_lost">
<code class="literal">
Performance_schema_socket_classes_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064376240">
</a>
<a class="indexterm" name="idm46045064375200">
</a>
<p>
How many socket instruments could not be loaded.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_socket_instances_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_socket_instances_lost">
<code class="literal">
Performance_schema_socket_instances_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064370672">
</a>
<a class="indexterm" name="idm46045064369552">
</a>
<p>
How many socket instrument instances could not be created.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_stage_classes_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_stage_classes_lost">
<code class="literal">
Performance_schema_stage_classes_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064365008">
</a>
<a class="indexterm" name="idm46045064363968">
</a>
<p>
How many stage instruments could not be loaded.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_statement_classes_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_statement_classes_lost">
<code class="literal">
Performance_schema_statement_classes_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064359504">
</a>
<a class="indexterm" name="idm46045064358384">
</a>
<p>
How many statement instruments could not be loaded.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_table_handles_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_table_handles_lost">
<code class="literal">
Performance_schema_table_handles_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064353856">
</a>
<a class="indexterm" name="idm46045064352816">
</a>
<p>
How many table instrument instances could not be opened. This
can be nonzero if the value of
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_table_handles">
<code class="literal">
performance_schema_max_table_handles
</code>
</a>
is too small.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_table_instances_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_table_instances_lost">
<code class="literal">
Performance_schema_table_instances_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064346848">
</a>
<a class="indexterm" name="idm46045064345808">
</a>
<p>
How many table instrument instances could not be created.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_table_lock_stat_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_table_lock_stat_lost">
<code class="literal">
Performance_schema_table_lock_stat_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064341216">
</a>
<a class="indexterm" name="idm46045064340176">
</a>
<p>
The number of tables for which lock statistics were lost. This
can be nonzero if the value of
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_table_lock_stat">
<code class="literal">
performance_schema_max_table_lock_stat
</code>
</a>
is too small.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_thread_classes_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_thread_classes_lost">
<code class="literal">
Performance_schema_thread_classes_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064334208">
</a>
<a class="indexterm" name="idm46045064333168">
</a>
<p>
How many thread instruments could not be loaded.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_thread_instances_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_thread_instances_lost">
<code class="literal">
Performance_schema_thread_instances_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064328704">
</a>
<a class="indexterm" name="idm46045064327584">
</a>
<p>
The number of thread instances that could not be instrumented
in the
<a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
<code class="literal">
threads
</code>
</a>
table. This can be
nonzero if the value of
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_thread_instances">
<code class="literal">
performance_schema_max_thread_instances
</code>
</a>
is too small.
</p>
</li>
<li class="listitem">
<p>
<a name="statvar_Performance_schema_users_lost">
</a>
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_users_lost">
<code class="literal">
Performance_schema_users_lost
</code>
</a>
</p>
<a class="indexterm" name="idm46045064320448">
</a>
<a class="indexterm" name="idm46045064319344">
</a>
<p>
The number of times a row could not be added to the
<a class="link" href="performance-schema-users-table.html" title="29.12.8.3 The users Table">
<code class="literal">
users
</code>
</a>
table because it was full.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/optimizing-innodb.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="optimizing-innodb">
</a>
10.5 Optimizing for InnoDB Tables
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<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>
</div>
<a class="indexterm" name="idm46045226282016">
</a>
<a class="indexterm" name="idm46045226280144">
</a>
<p>
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
is the storage engine that
MySQL customers typically use in production databases where
reliability and concurrency are important.
<code class="literal">
InnoDB
</code>
is the default storage engine in MySQL.
This section explains how to optimize database operations for
<code class="literal">
InnoDB
</code>
tables.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/window-function-optimization.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="window-function-optimization">
</a>
10.2.1.21 Window Function Optimization
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045228524720">
</a>
<a class="indexterm" name="idm46045228523232">
</a>
<p>
Window functions affect the strategies the optimizer
considers:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Derived table merging for a subquery is disabled if the
subquery has window functions. The subquery is always
materialized.
</p>
</li>
<li class="listitem">
<p>
Semijoins are not applicable to window function
optimization because semijoins apply to subqueries in
<code class="literal">
WHERE
</code>
and
<code class="literal">
JOIN ...
ON
</code>
, which cannot contain window functions.
</p>
</li>
<li class="listitem">
<p>
The optimizer processes multiple windows that have the
same ordering requirements in sequence, so sorting can be
skipped for windows following the first one.
</p>
</li>
<li class="listitem">
<p>
The optimizer makes no attempt to merge windows that could
be evaluated in a single step (for example, when multiple
<code class="literal">
OVER
</code>
clauses contain identical window
definitions). The workaround is to define the window in a
<code class="literal">
WINDOW
</code>
clause and refer to the window
name in the
<code class="literal">
OVER
</code>
clauses.
</p>
</li>
</ul>
</div>
<p>
An aggregate function not used as a window function is
aggregated in the outermost possible query. For example, in
this query, MySQL sees that
<code class="literal">
COUNT(t1.b)
</code>
is
something that cannot exist in the outer query because of its
placement in the
<code class="literal">
WHERE
</code>
clause:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa81995684"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> t1<span class="token punctuation">.</span>a <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token function">COUNT</span><span class="token punctuation">(</span>t1<span class="token punctuation">.</span>b<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t2<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Consequently, MySQL aggregates inside the subquery, treating
<code class="literal">
t1.b
</code>
as a constant and returning the count
of rows of
<code class="literal">
t2
</code>
.
</p>
<p>
Replacing
<code class="literal">
WHERE
</code>
with
<code class="literal">
HAVING
</code>
results in an error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa88770672"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> t1 <span class="token keyword">HAVING</span> t1<span class="token punctuation">.</span>a <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token function">COUNT</span><span class="token punctuation">(</span>t1<span class="token punctuation">.</span>b<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t2<span class="token punctuation">)</span><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 'test.t1.a'; this is
incompatible with sql_mode=only_full_group_by</span></code></pre>
</div>
<p>
The error occurs because
<code class="literal">
COUNT(t1.b)
</code>
can
exist in the
<code class="literal">
HAVING
</code>
, and so makes the outer
query aggregated.
</p>
<p>
Window functions (including aggregate functions used as window
functions) do not have the preceding complexity. They always
aggregate in the subquery where they are written, never in the
outer query.
</p>
<p>
Window function evaluation may be affected by the value of the
<a class="link" href="server-system-variables.html#sysvar_windowing_use_high_precision">
<code class="literal">
windowing_use_high_precision
</code>
</a>
system variable, which determines whether to compute window
operations without loss of precision. By default,
<a class="link" href="server-system-variables.html#sysvar_windowing_use_high_precision">
<code class="literal">
windowing_use_high_precision
</code>
</a>
is enabled.
</p>
<p>
For some moving frame aggregates, the inverse aggregate
function can be applied to remove values from the aggregate.
This can improve performance but possibly with a loss of
precision. For example, adding a very small floating-point
value to a very large value causes the very small value to be
<span class="quote">
“
<span class="quote">
hidden
</span>
”
</span>
by the large value. When inverting the
large value later, the effect of the small value is lost.
</p>
<p>
Loss of precision due to inverse aggregation is a factor only
for operations on floating-point (approximate-value) data
types. For other types, inverse aggregation is safe; this
includes
<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>
, which permits
a fractional part but is an exact-value type.
</p>
<p>
For faster execution, MySQL always uses inverse aggregation
when it is safe:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For floating-point values, inverse aggregation is not
always safe and might result in loss of precision. The
default is to avoid inverse aggregation, which is slower
but preserves precision. If it is permissible to sacrifice
safety for speed,
<a class="link" href="server-system-variables.html#sysvar_windowing_use_high_precision">
<code class="literal">
windowing_use_high_precision
</code>
</a>
can be disabled to permit inverse aggregation.
</p>
</li>
<li class="listitem">
<p>
For nonfloating-point data types, inverse aggregation is
always safe and is used regardless of the
<a class="link" href="server-system-variables.html#sysvar_windowing_use_high_precision">
<code class="literal">
windowing_use_high_precision
</code>
</a>
value.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_windowing_use_high_precision">
<code class="literal">
windowing_use_high_precision
</code>
</a>
has no effect on
<a class="link" href="aggregate-functions.html#function_min">
<code class="literal">
MIN()
</code>
</a>
and
<a class="link" href="aggregate-functions.html#function_max">
<code class="literal">
MAX()
</code>
</a>
, which do not use
inverse aggregation in any case.
</p>
</li>
</ul>
</div>
<p>
For evaluation of the variance functions
<a class="link" href="aggregate-functions.html#function_stddev-pop">
<code class="literal">
STDDEV_POP()
</code>
</a>
,
<a class="link" href="aggregate-functions.html#function_stddev-samp">
<code class="literal">
STDDEV_SAMP()
</code>
</a>
,
<a class="link" href="aggregate-functions.html#function_var-pop">
<code class="literal">
VAR_POP()
</code>
</a>
,
<a class="link" href="aggregate-functions.html#function_var-samp">
<code class="literal">
VAR_SAMP()
</code>
</a>
, and their synonyms,
evaluation can occur in optimized mode or default mode.
Optimized mode may produce slightly different results in the
last significant digits. If such differences are permissible,
<a class="link" href="server-system-variables.html#sysvar_windowing_use_high_precision">
<code class="literal">
windowing_use_high_precision
</code>
</a>
can be disabled to permit optimized mode.
</p>
<a class="indexterm" name="idm46045228477664">
</a>
<a class="indexterm" name="idm46045228476176">
</a>
<p>
For
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
, windowing
execution plan information is too extensive to display in
traditional output format. To see windowing information, use
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
FORMAT=JSON
</code>
</a>
and look for the
<code class="literal">
windowing
</code>
element.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/declare-condition.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="declare-condition">
</a>
15.6.7.1 DECLARE ... CONDITION Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045176070592">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa89639331"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">DECLARE</span> <em class="replaceable">condition_name</em> <span class="token keyword">CONDITION</span> <span class="token keyword">FOR</span> <em class="replaceable">condition_value</em>
<em class="replaceable">condition_value</em>: {
<em class="replaceable">mysql_error_code</em>
<span class="token operator">|</span> <span class="token keyword">SQLSTATE</span> <span class="token punctuation">[</span><span class="token keyword">VALUE</span><span class="token punctuation">]</span> <em class="replaceable">sqlstate_value</em>
}</code></pre>
</div>
<p>
The
<a class="link" href="declare-condition.html" title="15.6.7.1 DECLARE ... CONDITION Statement">
<code class="literal">
DECLARE
... CONDITION
</code>
</a>
statement declares a named error
condition, associating a name with a condition that needs
specific handling. The name can be referred to in a subsequent
<a class="link" href="declare-handler.html" title="15.6.7.2 DECLARE ... HANDLER Statement">
<code class="literal">
DECLARE ...
HANDLER
</code>
</a>
statement (see
<a class="xref" href="declare-handler.html" title="15.6.7.2 DECLARE ... HANDLER Statement">
Section 15.6.7.2, “DECLARE ... HANDLER Statement”
</a>
).
</p>
<p>
Condition declarations must appear before cursor or handler
declarations.
</p>
<p>
The
<em class="replaceable">
<code>
condition_value
</code>
</em>
for
<a class="link" href="declare-condition.html" title="15.6.7.1 DECLARE ... CONDITION Statement">
<code class="literal">
DECLARE ...
CONDITION
</code>
</a>
indicates the specific condition or class of
conditions to associate with the condition name. It can take the
following forms:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<em class="replaceable">
<code>
mysql_error_code
</code>
</em>
: An integer
literal indicating a MySQL error code.
</p>
<p>
Do not use MySQL error code 0 because that indicates success
rather than an error condition. For a list of MySQL error
codes, see
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html" target="_top">
Server Error Message Reference
</a>
.
</p>
</li>
<li class="listitem">
<p>
SQLSTATE [VALUE]
<em class="replaceable">
<code>
sqlstate_value
</code>
</em>
:
A 5-character string literal indicating an SQLSTATE value.
</p>
<p>
Do not use SQLSTATE values that begin with
<code class="literal">
'00'
</code>
because those indicate success
rather than an error condition. For a list of SQLSTATE
values, see
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html" target="_top">
Server Error Message Reference
</a>
.
</p>
</li>
</ul>
</div>
<p>
Condition names referred to in
<a class="link" href="signal.html" title="15.6.7.5 SIGNAL Statement">
<code class="literal">
SIGNAL
</code>
</a>
or use
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
statements must be
associated with SQLSTATE values, not MySQL error codes.
</p>
<p>
Using names for conditions can help make stored program code
clearer. For example, this handler applies to attempts to drop a
nonexistent table, but that is apparent only if you know that
1051 is the MySQL error code for
<span class="quote">
“
<span class="quote">
unknown table
</span>
”
</span>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa36058060"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">DECLARE</span> <span class="token keyword">CONTINUE</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> <span class="token number">1051</span>
<span class="token keyword">BEGIN</span>
<span class="token comment" spellcheck="true">-- body of handler</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
By declaring a name for the condition, the purpose of the
handler is more readily seen:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa93727808"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">DECLARE</span> no_such_table <span class="token keyword">CONDITION</span> <span class="token keyword">FOR</span> <span class="token number">1051</span><span class="token punctuation">;</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">CONTINUE</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> no_such_table
<span class="token keyword">BEGIN</span>
<span class="token comment" spellcheck="true">-- body of handler</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Here is a named condition for the same condition, but based on
the corresponding SQLSTATE value rather than the MySQL error
code:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63951923"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">DECLARE</span> no_such_table <span class="token keyword">CONDITION</span> <span class="token keyword">FOR</span> <span class="token keyword">SQLSTATE</span> <span class="token string">'42S02'</span><span class="token punctuation">;</span>
<span class="token keyword">DECLARE</span> <span class="token keyword">CONTINUE</span> <span class="token keyword">HANDLER</span> <span class="token keyword">FOR</span> no_such_table
<span class="token keyword">BEGIN</span>
<span class="token comment" spellcheck="true">-- body of handler</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/reset-replica.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="reset-replica">
</a>
15.4.2.3 RESET REPLICA Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045177145376">
</a>
<a class="indexterm" name="idm46045177144304">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa72892668"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">RESET</span> <span class="token keyword">REPLICA</span> <span class="token punctuation">[</span><span class="token keyword">ALL</span><span class="token punctuation">]</span> <span class="token punctuation">[</span><em class="replaceable">channel_option</em><span class="token punctuation">]</span>
<em class="replaceable">channel_option</em>:
<span class="token keyword">FOR</span> <span class="token keyword">CHANNEL</span> <span class="token keyword"><em class="replaceable">channel</em></span></code></pre>
</div>
<p>
<code class="literal">
RESET REPLICA
</code>
makes the replica forget its
position in the source's binary log.
</p>
<p>
This statement is meant to be used for a clean start; it clears
the replication metadata repositories, deletes all the relay log
files, and starts a new relay log file. It also resets to 0 the
replication delay specified with the
<code class="literal">
SOURCE_DELAY
</code>
option of the
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE REPLICATION SOURCE TO
</code>
</a>
statement.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
All relay log files are deleted, even if they have not been
completely executed by the replication SQL thread. (This is a
condition likely to exist on a replica if you have issued a
<a class="link" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
<code class="literal">
STOP
REPLICA
</code>
</a>
statement or if the replica is highly
loaded.)
</p>
</div>
<p>
For a server where GTIDs are in use
(
<a class="link" href="replication-options-gtids.html#sysvar_gtid_mode">
<code class="literal">
gtid_mode
</code>
</a>
is
<code class="literal">
ON
</code>
), issuing
<code class="literal">
RESET REPLICA
</code>
has no effect on the GTID execution history. The statement does
not change the values of
<code class="literal">
gtid_executed
</code>
or
<code class="literal">
gtid_purged
</code>
, or the
<code class="literal">
mysql.gtid_executed
</code>
table. If you need to
reset the GTID execution history, use
<a class="link" href="reset-binary-logs-and-gtids.html" title="15.4.1.2 RESET BINARY LOGS AND GTIDS Statement">
<code class="literal">
RESET
BINARY LOGS AND GTIDS
</code>
</a>
, even if the GTID-enabled server
is a replica where binary logging is disabled.
</p>
<p>
<code class="literal">
RESET REPLICA
</code>
requires the
<a class="link" href="privileges-provided.html#priv_reload">
<code class="literal">
RELOAD
</code>
</a>
privilege.
</p>
<p>
To use
<code class="literal">
RESET REPLICA
</code>
, the replication SQL
thread and replication I/O (receiver) thread must be stopped, so
on a running replica use
<a class="link" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
<code class="literal">
STOP
REPLICA
</code>
</a>
before issuing
<code class="literal">
RESET
REPLICA
</code>
. To use
<code class="literal">
RESET REPLICA
</code>
on a
Group Replication group member, the member status must be
<code class="literal">
OFFLINE
</code>
, meaning that the plugin is loaded
but the member does not currently belong to any group. A group
member can be taken offline by 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.
</p>
<p>
The optional
<code class="literal">
FOR CHANNEL
<em class="replaceable">
<code>
channel
</code>
</em>
</code>
clause enables you
to name which replication channel the statement applies to.
Providing a
<code class="literal">
FOR CHANNEL
<em class="replaceable">
<code>
channel
</code>
</em>
</code>
clause applies the
<code class="literal">
RESET REPLICA
</code>
statement to a specific
replication channel. Combining a
<code class="literal">
FOR CHANNEL
<em class="replaceable">
<code>
channel
</code>
</em>
</code>
clause with the
<code class="literal">
ALL
</code>
option deletes the specified channel. If
no channel is named and no extra channels exist, the statement
applies to the default channel. Issuing a
<code class="literal">
RESET REPLICA
ALL
</code>
statement without a
<code class="literal">
FOR CHANNEL
<em class="replaceable">
<code>
channel
</code>
</em>
</code>
clause when
multiple replication channels exist deletes
<span class="emphasis">
<em>
all
</em>
</span>
replication channels and recreates only
the default channel. See
<a class="xref" href="replication-channels.html" title="19.2.2 Replication Channels">
Section 19.2.2, “Replication Channels”
</a>
for more information.
</p>
<p>
<code class="literal">
RESET REPLICA
</code>
does not change any replication
connection parameters, which include the source's host name and
port, the replication user account and its password, the
<code class="literal">
PRIVILEGE_CHECKS_USER
</code>
account, the
<code class="literal">
REQUIRE_ROW_FORMAT
</code>
option, the
<code class="literal">
REQUIRE_TABLE_PRIMARY_KEY_CHECK
</code>
option,and
the
<code class="literal">
ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS
</code>
option. If you want to change any of the replication connection
parameters, you can do this 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 after the server
starts. If you want to remove all of the replication connection
parameters, use
<code class="literal">
RESET REPLICA ALL
</code>
.
<code class="literal">
RESET REPLICA ALL
</code>
also clears the
<code class="literal">
IGNORE_SERVER_IDS
</code>
list set by
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE REPLICATION SOURCE TO
</code>
</a>
.
When you have used
<code class="literal">
RESET REPLICA ALL
</code>
, if you
want to use the instance as a replica again, you need to issue 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 after the server start to specify new connection
parameters.
</p>
<p>
You can set the
<code class="literal">
GTID_ONLY
</code>
option 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 to stop a replication channel from persisting file
names and file positions in the replication metadata
repositories. When you issue
<a class="link" href="reset-replica.html" title="15.4.2.3 RESET REPLICA Statement">
<code class="literal">
RESET
REPLICA
</code>
</a>
, the replication metadata repositories are
synchronized.
<code class="literal">
RESET REPLICA ALL
</code>
deletes
rather than updates the repositories, so they are synchronized
implicitly.
</p>
<p>
In the event of an unexpected server exit or deliberate restart
after issuing
<code class="literal">
RESET REPLICA
</code>
but before
issuing
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START REPLICA
</code>
</a>
,
replication connection parameters are preserved in the
crash-safe
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
tables
<code class="literal">
mysql.slave_master_info
</code>
and
<code class="literal">
mysql.slave_relay_log_info
</code>
as part of the
<code class="literal">
RESET REPLICA
</code>
operation. They are also
retained in memory. In the event of an unexpected server exit or
deliberate restart after issuing
<code class="literal">
RESET
REPLICA
</code>
but before issuing
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START
REPLICA
</code>
</a>
, the replication connection parameters are
retrieved from the tables and reapplied to the channel. This
applies for both the connection and applier metadata
repositories.
</p>
<p>
<code class="literal">
RESET REPLICA
</code>
does not change any replication
filter settings (such as
<a class="link" href="replication-options-replica.html#option_mysqld_replicate-ignore-table">
<code class="option">
--replicate-ignore-table
</code>
</a>
) for
channels affected by the statement. However,
<code class="literal">
RESET
REPLICA ALL
</code>
removes the replication filters that were
set on the channels deleted by the statement. When the deleted
channel or channels are recreated, any global replication
filters specified for the replica are copied to them, and no
channel specific replication filters are applied. For more
information see
<a class="xref" href="replication-rules-channel-based-filters.html" title="19.2.5.4 Replication Channel Based Filters">
Section 19.2.5.4, “Replication Channel Based Filters”
</a>
.
</p>
<p>
<code class="literal">
RESET REPLICA
</code>
causes an implicit commit of an
ongoing transaction. See
<a class="xref" href="implicit-commit.html" title="15.3.3 Statements That Cause an Implicit Commit">
Section 15.3.3, “Statements That Cause an Implicit Commit”
</a>
.
</p>
<p>
If the replication SQL thread was in the middle of replicating
temporary tables when it was stopped, and
<code class="literal">
RESET
REPLICA
</code>
is issued, these replicated temporary tables
are deleted on the replica.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
When used on an NDB Cluster replica SQL node,
<code class="literal">
RESET
REPLICA
</code>
clears the
<code class="literal">
mysql.ndb_apply_status
</code>
table. You should
keep in mind when using this statement that
<code class="literal">
ndb_apply_status
</code>
uses the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage engine and so is
shared by all SQL nodes attached to the cluster.
</p>
<p>
You can override this behavior by issuing
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
<code class="literal">
GLOBAL
@@
</code>
<a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_clear_apply_status">
<code class="literal">
ndb_clear_apply_status=OFF
</code>
</a>
prior to executing
<code class="literal">
RESET REPLICA
</code>
, which
keeps the replica from purging the
<code class="literal">
ndb_apply_status
</code>
table in such cases.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/myisampack.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="myisampack">
</a>
6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045306496592">
</a>
<a class="indexterm" name="idm46045306495680">
</a>
<a class="indexterm" name="idm46045306494736">
</a>
<a class="indexterm" name="idm46045306493376">
</a>
<p>
The
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
utility compresses
<code class="literal">
MyISAM
</code>
tables.
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
works by compressing each column in the table separately.
Usually,
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
packs the data file 40%
to 70%.
</p>
<p>
When the table is used later, the server reads into memory the
information needed to decompress columns. This results in much
better performance when accessing individual rows, because you
only have to uncompress exactly one row.
</p>
<p>
MySQL uses
<code class="literal">
mmap()
</code>
when possible to perform
memory mapping on compressed tables. If
<code class="literal">
mmap()
</code>
does not work, MySQL falls back to
normal read/write file operations.
</p>
<p>
Please note the following:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server was invoked with
external locking disabled, it is not a good idea to invoke
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
if the table might be updated
by the server during the packing process. It is safest to
compress tables with the server stopped.
</p>
</li>
<li class="listitem">
<p>
After packing a table, it becomes read only. This is
generally intended (such as when accessing packed tables on
a CD).
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
does not support partitioned
tables.
</p>
</li>
</ul>
</div>
<p>
Invoke
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa85994928"><div class="copy-help left">Press ⌘+C to 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">myisampack <span class="token punctuation">[</span><em class="replaceable">options</em><span class="token punctuation">]</span> <em class="replaceable">file_name</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
</div>
<p>
Each file name argument should be the name of an index
(
<code class="filename">
.MYI
</code>
) file. If you are not in the database
directory, you should specify the path name to the file. It is
permissible to omit the
<code class="filename">
.MYI
</code>
extension.
</p>
<p>
After you compress a table with
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
,
use
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk -rq
</strong>
</span>
</a>
to rebuild its indexes.
<a class="xref" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
Section 6.6.4, “myisamchk — MyISAM Table-Maintenance Utility”
</a>
.
</p>
<p>
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
supports the following options. It
also reads option files and supports the options for processing
them described at
<a class="xref" href="option-file-options.html" title="6.2.2.3 Command-Line Options that Affect Option-File Handling">
Section 6.2.2.3, “Command-Line Options that Affect Option-File Handling”
</a>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="option_myisampack_help">
</a>
<a class="link" href="myisampack.html#option_myisampack_help">
<code class="option">
--help
</code>
</a>
,
<code class="option">
-?
</code>
</p>
<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>
<a class="indexterm" name="idm46045306457312">
</a>
<a class="indexterm" name="idm46045306455824">
</a>
<p>
Display a help message and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisampack_backup">
</a>
<a class="link" href="myisampack.html#option_myisampack_backup">
<code class="option">
--backup
</code>
</a>
,
<code class="option">
-b
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for backup">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--backup
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045306445600">
</a>
<a class="indexterm" name="idm46045306444112">
</a>
<p>
Make a backup of each table's data file using the name
<code class="filename">
<em class="replaceable">
<code>
tbl_name
</code>
</em>
.OLD
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisampack_character-sets-dir">
</a>
<a class="link" href="myisampack.html#option_myisampack_character-sets-dir">
<code class="option">
--character-sets-dir=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
</p>
<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=dir_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Directory name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045306431008">
</a>
<a class="indexterm" name="idm46045306429504">
</a>
<p>
The directory where character sets are installed. See
<a class="xref" href="charset-configuration.html" title="12.15 Character Set Configuration">
Section 12.15, “Character Set Configuration”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisampack_debug">
</a>
<a class="link" href="myisampack.html#option_myisampack_debug">
<code class="option">
--debug[=
<em class="replaceable">
<code>
debug_options
</code>
</em>
]
</code>
</a>
,
<code class="option">
-#
[
<em class="replaceable">
<code>
debug_options
</code>
</em>
]
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for debug">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--debug[=debug_options]
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
d:t:o
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045306413376">
</a>
<a class="indexterm" name="idm46045306411888">
</a>
<p>
Write a debugging log. A typical
<em class="replaceable">
<code>
debug_options
</code>
</em>
string is
<code class="literal">
d:t:o,
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
.
The default is
<code class="literal">
d:t:o
</code>
.
</p>
<p>
This option is available only if MySQL was built using
<a class="link" href="source-configuration-options.html#option_cmake_with_debug">
<code class="option">
WITH_DEBUG
</code>
</a>
. MySQL release
binaries provided by Oracle are
<span class="emphasis">
<em>
not
</em>
</span>
built using this option.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisampack_force">
</a>
<a class="link" href="myisampack.html#option_myisampack_force">
<code class="option">
--force
</code>
</a>
,
<code class="option">
-f
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for force">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--force
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045306397648">
</a>
<a class="indexterm" name="idm46045306396160">
</a>
<p>
Produce a packed table even if it becomes larger than the
original or if the intermediate file from an earlier
invocation of
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
exists.
(
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
creates an intermediate file
named
<code class="filename">
<em class="replaceable">
<code>
tbl_name
</code>
</em>
.TMD
</code>
in the database directory while it compresses the table. If
you kill
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
, the
<code class="filename">
.TMD
</code>
file might not be deleted.)
Normally,
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
exits with an error
if it finds that
<code class="filename">
<em class="replaceable">
<code>
tbl_name
</code>
</em>
.TMD
</code>
exists. With
<a class="link" href="myisampack.html#option_myisampack_force">
<code class="option">
--force
</code>
</a>
,
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
packs the table anyway.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisampack_join">
</a>
<a class="link" href="myisampack.html#option_myisampack_join">
<code class="option">
--join=
<em class="replaceable">
<code>
big_tbl_name
</code>
</em>
</code>
</a>
,
<code class="option">
-j
<em class="replaceable">
<code>
big_tbl_name
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for join">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--join=big_tbl_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045306373232">
</a>
<a class="indexterm" name="idm46045306371744">
</a>
<p>
Join all tables named on the command line into a single
packed table
<em class="replaceable">
<code>
big_tbl_name
</code>
</em>
. All
tables that are to be combined
<span class="emphasis">
<em>
must
</em>
</span>
have identical structure (same column names and types, same
indexes, and so forth).
</p>
<p>
<em class="replaceable">
<code>
big_tbl_name
</code>
</em>
must not exist prior
to the join operation. All source tables named on the
command line to be merged into
<em class="replaceable">
<code>
big_tbl_name
</code>
</em>
must exist. The
source tables are read for the join operation but not
modified.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisampack_silent">
</a>
<a class="link" href="myisampack.html#option_myisampack_silent">
<code class="option">
--silent
</code>
</a>
,
<code class="option">
-s
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for silent">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--silent
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045306358960">
</a>
<a class="indexterm" name="idm46045306357472">
</a>
<p>
Silent mode. Write output only when errors occur.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisampack_test">
</a>
<a class="link" href="myisampack.html#option_myisampack_test">
<code class="option">
--test
</code>
</a>
,
<code class="option">
-t
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for test">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--test
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045306347392">
</a>
<a class="indexterm" name="idm46045306345904">
</a>
<p>
Do not actually pack the table, just test packing it.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisampack_tmpdir">
</a>
<a class="link" href="myisampack.html#option_myisampack_tmpdir">
<code class="option">
--tmpdir=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
,
<code class="option">
-T
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for tmpdir">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--tmpdir=dir_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Directory name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045306333152">
</a>
<a class="indexterm" name="idm46045306331664">
</a>
<p>
Use the named directory as the location where
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
creates temporary files.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisampack_verbose">
</a>
<a class="link" href="myisampack.html#option_myisampack_verbose">
<code class="option">
--verbose
</code>
</a>
,
<code class="option">
-v
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for verbose">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--verbose
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045306320240">
</a>
<a class="indexterm" name="idm46045306318752">
</a>
<p>
Verbose mode. Write information about the progress of the
packing operation and its result.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisampack_version">
</a>
<a class="link" href="myisampack.html#option_myisampack_version">
<code class="option">
--version
</code>
</a>
,
<code class="option">
-V
</code>
</p>
<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>
<a class="indexterm" name="idm46045306308560">
</a>
<a class="indexterm" name="idm46045306307072">
</a>
<p>
Display version information and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_myisampack_wait">
</a>
<a class="link" href="myisampack.html#option_myisampack_wait">
<code class="option">
--wait
</code>
</a>
,
<code class="option">
-w
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for wait">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--wait
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045306297120">
</a>
<a class="indexterm" name="idm46045306295632">
</a>
<p>
Wait and retry if the table is in use. If the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server was invoked with external
locking disabled, it is not a good idea to invoke
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
if the table might be updated
by the server during the packing process.
</p>
</li>
</ul>
</div>
<a class="indexterm" name="idm46045306290784">
</a>
<p>
The following sequence of commands illustrates a typical table
compression session:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa83116259"><div class="copy-help left">Press ⌘+C to 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">ls</span> <span class="token property">-l</span> station<span class="token punctuation">.</span>*
<span class="token property">-rw-rw-r--</span> 1 jones my 994128 Apr 17 19<span class="token punctuation">:</span>00 station<span class="token punctuation">.</span>MYD
<span class="token property">-rw-rw-r--</span> 1 jones my 53248 Apr 17 19<span class="token punctuation">:</span>00 station<span class="token punctuation">.</span>MYI
<span class="token prompt">$> </span><span class="token command">myisamchk</span> <span class="token property">-dvv</span> station
MyISAM file<span class="token punctuation">:</span> station
Isam-version<span class="token punctuation">:</span> 2
Creation time<span class="token punctuation">:</span> 1996-03-13 10<span class="token punctuation">:</span>08<span class="token punctuation">:</span>58
Recover time<span class="token punctuation">:</span> 1997-02-02 3<span class="token punctuation">:</span>06<span class="token punctuation">:</span>43
Data records<span class="token punctuation">:</span> 1192 Deleted blocks<span class="token punctuation">:</span> 0
Datafile parts<span class="token punctuation">:</span> 1192 Deleted data<span class="token punctuation">:</span> 0
Datafile pointer <span class="token punctuation">(</span>bytes<span class="token punctuation">)</span><span class="token punctuation">:</span> 2 Keyfile pointer <span class="token punctuation">(</span>bytes<span class="token punctuation">)</span><span class="token punctuation">:</span> 2
Max datafile length<span class="token punctuation">:</span> 54657023 Max keyfile length<span class="token punctuation">:</span> 33554431
Recordlength<span class="token punctuation">:</span> 834
Record format<span class="token punctuation">:</span> Fixed length
table description<span class="token punctuation">:</span>
Key Start Len Index Type Root Blocksize Rec/key
1 2 4 unique unsigned long 1024 1024 1
2 32 30 multip<span class="token punctuation">.</span> text 10240 1024 1
Field Start Length Type
1 1 1
2 2 4
3 6 4
4 10 1
5 11 20
6 31 1
7 32 30
8 62 35
9 97 35
10 132 35
11 167 4
12 171 16
13 187 35
14 222 4
15 226 16
16 242 20
17 262 20
18 282 20
19 302 30
20 332 4
21 336 4
22 340 1
23 341 8
24 349 8
25 357 8
26 365 2
27 367 2
28 369 4
29 373 4
30 377 1
31 378 2
32 380 8
33 388 4
34 392 4
35 396 4
36 400 4
37 404 1
38 405 4
39 409 4
40 413 4
41 417 4
42 421 4
43 425 4
44 429 20
45 449 30
46 479 1
47 480 1
48 481 79
49 560 79
50 639 79
51 718 79
52 797 8
53 805 1
54 806 1
55 807 20
56 827 4
57 831 4
<span class="token prompt">$> </span><span class="token command">myisampack</span> station<span class="token punctuation">.</span>MYI
Compressing station<span class="token punctuation">.</span>MYI<span class="token punctuation">:</span> <span class="token punctuation">(</span>1192 records<span class="token punctuation">)</span>
- Calculating statistics
normal<span class="token punctuation">:</span> 20 empty-space<span class="token punctuation">:</span> 16 empty-zero<span class="token punctuation">:</span> 12 empty-fill<span class="token punctuation">:</span> 11
pre-space<span class="token punctuation">:</span> 0 end-space<span class="token punctuation">:</span> 12 table-lookups<span class="token punctuation">:</span> 5 zero<span class="token punctuation">:</span> 7
Original trees<span class="token punctuation">:</span> 57 After join<span class="token punctuation">:</span> 17
- Compressing file
87<span class="token punctuation">.</span>14%
Remember to run myisamchk <span class="token property">-rq</span> on compressed tables
<span class="token prompt">$> </span><span class="token command">myisamchk</span> <span class="token property">-rq</span> station
- check record delete-chain
- recovering <span class="token punctuation">(</span>with sort<span class="token punctuation">)</span> MyISAM-table <span class="token atrule">'station'</span>
Data records<span class="token punctuation">:</span> 1192
- Fixing index 1
- Fixing index 2
<span class="token prompt">$> </span><span class="token command">mysqladmin</span> <span class="token property">-uroot</span> flush-tables
<span class="token prompt">$> </span><span class="token command">ls</span> <span class="token property">-l</span> station<span class="token punctuation">.</span>*
<span class="token property">-rw-rw-r--</span> 1 jones my 127874 Apr 17 19<span class="token punctuation">:</span>00 station<span class="token punctuation">.</span>MYD
<span class="token property">-rw-rw-r--</span> 1 jones my 55296 Apr 17 19<span class="token punctuation">:</span>04 station<span class="token punctuation">.</span>MYI
<span class="token prompt">$> </span><span class="token command">myisamchk</span> <span class="token property">-dvv</span> station
MyISAM file<span class="token punctuation">:</span> station
Isam-version<span class="token punctuation">:</span> 2
Creation time<span class="token punctuation">:</span> 1996-03-13 10<span class="token punctuation">:</span>08<span class="token punctuation">:</span>58
Recover time<span class="token punctuation">:</span> 1997-04-17 19<span class="token punctuation">:</span>04<span class="token punctuation">:</span>26
Data records<span class="token punctuation">:</span> 1192 Deleted blocks<span class="token punctuation">:</span> 0
Datafile parts<span class="token punctuation">:</span> 1192 Deleted data<span class="token punctuation">:</span> 0
Datafile pointer <span class="token punctuation">(</span>bytes<span class="token punctuation">)</span><span class="token punctuation">:</span> 3 Keyfile pointer <span class="token punctuation">(</span>bytes<span class="token punctuation">)</span><span class="token punctuation">:</span> 1
Max datafile length<span class="token punctuation">:</span> 16777215 Max keyfile length<span class="token punctuation">:</span> 131071
Recordlength<span class="token punctuation">:</span> 834
Record format<span class="token punctuation">:</span> Compressed
table description<span class="token punctuation">:</span>
Key Start Len Index Type Root Blocksize Rec/key
1 2 4 unique unsigned long 10240 1024 1
2 32 30 multip<span class="token punctuation">.</span> text 54272 1024 1
Field Start Length Type Huff tree Bits
1 1 1 constant 1 0
2 2 4 zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span> 2 9
3 6 4 no zeros<span class="token punctuation">,</span> zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span> 2 9
4 10 1 3 9
5 11 20 table-lookup 4 0
6 31 1 3 9
7 32 30 no endspace<span class="token punctuation">,</span> not_always 5 9
8 62 35 no endspace<span class="token punctuation">,</span> not_always<span class="token punctuation">,</span> no empty 6 9
9 97 35 no empty 7 9
10 132 35 no endspace<span class="token punctuation">,</span> not_always<span class="token punctuation">,</span> no empty 6 9
11 167 4 zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span> 2 9
12 171 16 no endspace<span class="token punctuation">,</span> not_always<span class="token punctuation">,</span> no empty 5 9
13 187 35 no endspace<span class="token punctuation">,</span> not_always<span class="token punctuation">,</span> no empty 6 9
14 222 4 zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span> 2 9
15 226 16 no endspace<span class="token punctuation">,</span> not_always<span class="token punctuation">,</span> no empty 5 9
16 242 20 no endspace<span class="token punctuation">,</span> not_always 8 9
17 262 20 no endspace<span class="token punctuation">,</span> no empty 8 9
18 282 20 no endspace<span class="token punctuation">,</span> no empty 5 9
19 302 30 no endspace<span class="token punctuation">,</span> no empty 6 9
20 332 4 always zero 2 9
21 336 4 always zero 2 9
22 340 1 3 9
23 341 8 table-lookup 9 0
24 349 8 table-lookup 10 0
25 357 8 always zero 2 9
26 365 2 2 9
27 367 2 no zeros<span class="token punctuation">,</span> zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span> 2 9
28 369 4 no zeros<span class="token punctuation">,</span> zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span> 2 9
29 373 4 table-lookup 11 0
30 377 1 3 9
31 378 2 no zeros<span class="token punctuation">,</span> zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span> 2 9
32 380 8 no zeros 2 9
33 388 4 always zero 2 9
34 392 4 table-lookup 12 0
35 396 4 no zeros<span class="token punctuation">,</span> zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span> 13 9
36 400 4 no zeros<span class="token punctuation">,</span> zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span> 2 9
37 404 1 2 9
38 405 4 no zeros 2 9
39 409 4 always zero 2 9
40 413 4 no zeros 2 9
41 417 4 always zero 2 9
42 421 4 no zeros 2 9
43 425 4 always zero 2 9
44 429 20 no empty 3 9
45 449 30 no empty 3 9
46 479 1 14 4
47 480 1 14 4
48 481 79 no endspace<span class="token punctuation">,</span> no empty 15 9
49 560 79 no empty 2 9
50 639 79 no empty 2 9
51 718 79 no endspace 16 9
52 797 8 no empty 2 9
53 805 1 17 1
54 806 1 3 9
55 807 20 no empty 3 9
56 827 4 no zeros<span class="token punctuation">,</span> zerofill<span class="token punctuation">(</span>2<span class="token punctuation">)</span> 2 9
57 831 4 no zeros<span class="token punctuation">,</span> zerofill<span class="token punctuation">(</span>1<span class="token punctuation">)</span> 2 9</code></pre>
</div>
<p>
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
displays the following kinds of
information:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
normal
</code>
</p>
<p>
The number of columns for which no extra packing is used.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
empty-space
</code>
</p>
<p>
The number of columns containing values that are only
spaces. These occupy one bit.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
empty-zero
</code>
</p>
<p>
The number of columns containing values that are only binary
zeros. These occupy one bit.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
empty-fill
</code>
</p>
<p>
The number of integer columns that do not occupy the full
byte range of their type. These are changed to a smaller
type. For example, 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>
column (eight bytes) can be stored as 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">
TINYINT
</code>
</a>
column (one byte) if
all its values are in the range from
<code class="literal">
-128
</code>
to
<code class="literal">
127
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
pre-space
</code>
</p>
<p>
The number of decimal columns that are stored with leading
spaces. In this case, each value contains a count for the
number of leading spaces.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
end-space
</code>
</p>
<p>
The number of columns that have a lot of trailing spaces. In
this case, each value contains a count for the number of
trailing spaces.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
table-lookup
</code>
</p>
<p>
The column had only a small number of different values,
which were converted to an
<a class="link" href="enum.html" title="13.3.5 The ENUM Type">
<code class="literal">
ENUM
</code>
</a>
before Huffman
compression.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
zero
</code>
</p>
<p>
The number of columns for which all values are zero.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Original trees
</code>
</p>
<p>
The initial number of Huffman trees.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
After join
</code>
</p>
<p>
The number of distinct Huffman trees left after joining
trees to save some header space.
</p>
</li>
</ul>
</div>
<p>
After a table has been compressed, the
<code class="literal">
Field
</code>
lines displayed by
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk -dvv
</strong>
</span>
</a>
include
additional information about each column:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
Type
</code>
</p>
<p>
The data type. The value may contain any of the following
descriptors:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
constant
</code>
</p>
<p>
All rows have the same value.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
no endspace
</code>
</p>
<p>
Do not store endspace.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
no endspace, not_always
</code>
</p>
<p>
Do not store endspace and do not do endspace compression
for all values.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
no endspace, no empty
</code>
</p>
<p>
Do not store endspace. Do not store empty values.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
table-lookup
</code>
</p>
<p>
The column was converted to an
<a class="link" href="enum.html" title="13.3.5 The ENUM Type">
<code class="literal">
ENUM
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
zerofill(
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
</p>
<p>
The most significant
<em class="replaceable">
<code>
N
</code>
</em>
bytes
in the value are always 0 and are not stored.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
no zeros
</code>
</p>
<p>
Do not store zeros.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
always zero
</code>
</p>
<p>
Zero values are stored using one bit.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
Huff tree
</code>
</p>
<p>
The number of the Huffman tree associated with the column.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Bits
</code>
</p>
<p>
The number of bits used in the Huffman tree.
</p>
</li>
</ul>
</div>
<p>
After you run
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
, use
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
to re-create any indexes. At this
time, you can also sort the index blocks and create statistics
needed for the MySQL optimizer to work more efficiently:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa25949911"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">myisamchk <span class="token property">-rq</span> <span class="token property">--sort-index</span> <span class="token property">--analyze</span> <em class="replaceable">tbl_name</em><span class="token punctuation">.</span>MYI</code></pre>
</div>
<p>
After you have installed the packed table into the MySQL
database directory, you should execute
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
flush-tables
</strong>
</span>
</a>
to force
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
to
start using the new table.
</p>
<p>
To unpack a packed table, use the
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_unpack">
<code class="option">
--unpack
</code>
</a>
option to
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/alter-table-partition-operations.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="alter-table-partition-operations">
</a>
15.1.9.1 ALTER TABLE Partition Operations
</h4>
</div>
</div>
</div>
<p>
Partitioning-related clauses for
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
can be used with partitioned tables for
repartitioning, to add, drop, discard, import, merge, and split
partitions, and to perform partitioning maintenance.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Simply using a
<em class="replaceable">
<code>
partition_options
</code>
</em>
clause with
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
on a
partitioned table repartitions the table according to the
partitioning scheme defined by the
<em class="replaceable">
<code>
partition_options
</code>
</em>
. This clause
always begins with
<code class="literal">
PARTITION BY
</code>
, and
follows the same syntax and other rules as apply to the
<em class="replaceable">
<code>
partition_options
</code>
</em>
clause for
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
(for more
detailed information, see
<a class="xref" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
Section 15.1.20, “CREATE TABLE Statement”
</a>
),
and can also be used to partition an existing table that is
not already partitioned. For example, consider a
(nonpartitioned) table defined as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa59230589"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>
id <span class="token datatype">INT</span><span class="token punctuation">,</span>
year_col <span class="token datatype">INT</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
This table can be partitioned by
<code class="literal">
HASH
</code>
,
using the
<code class="literal">
id
</code>
column as the partitioning
key, into 8 partitions by means of this statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa5204747"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">HASH</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span>
<span class="token keyword">PARTITIONS</span> <span class="token number">8</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
MySQL supports an
<code class="literal">
ALGORITHM
</code>
option with
<code class="literal">
[SUB]PARTITION BY [LINEAR] KEY
</code>
.
<code class="literal">
ALGORITHM=1
</code>
causes the server to use the
same key-hashing functions as MySQL 5.1 when computing the
placement of rows in partitions;
<code class="literal">
ALGORITHM=2
</code>
means that the server employs
the key-hashing functions implemented and used by default
for new
<code class="literal">
KEY
</code>
partitioned tables in MySQL
5.5 and later. (Partitioned tables created with the
key-hashing functions employed in MySQL 5.5 and later cannot
be used by a MySQL 5.1 server.) Not specifying the option
has the same effect as using
<code class="literal">
ALGORITHM=2
</code>
.
This option is intended for use chiefly when upgrading or
downgrading
<code class="literal">
[LINEAR] KEY
</code>
partitioned
tables between MySQL 5.1 and later MySQL versions, or for
creating tables partitioned by
<code class="literal">
KEY
</code>
or
<code class="literal">
LINEAR KEY
</code>
on a MySQL 5.5 or later server
which can be used on a MySQL 5.1 server.
</p>
<p>
The table that results from using an
<code class="literal">
ALTER TABLE
... PARTITION BY
</code>
statement must follow the same
rules as one created using
<code class="literal">
CREATE TABLE ...
PARTITION BY
</code>
. This includes the rules governing
the relationship between any unique keys (including any
primary key) that the table might have, and the column or
columns used in the partitioning expression, as discussed in
<a class="xref" href="partitioning-limitations-partitioning-keys-unique-keys.html" title="26.6.1 Partitioning Keys, Primary Keys, and Unique Keys">
Section 26.6.1, “Partitioning Keys, Primary Keys, and Unique Keys”
</a>
.
The
<code class="literal">
CREATE TABLE ... PARTITION BY
</code>
rules
for specifying the number of partitions also apply to
<code class="literal">
ALTER TABLE ... PARTITION BY
</code>
.
</p>
<p>
The
<em class="replaceable">
<code>
partition_definition
</code>
</em>
clause
for
<code class="literal">
ALTER TABLE ADD PARTITION
</code>
supports
the same options as the clause of the same name for the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement. (See
<a class="xref" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
Section 15.1.20, “CREATE TABLE Statement”
</a>
, for the syntax and
description.) Suppose that you have the partitioned table
created as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa59440673"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>
id <span class="token datatype">INT</span><span class="token punctuation">,</span>
year_col <span class="token datatype">INT</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token punctuation">(</span>year_col<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">1991</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">1995</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">1999</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
You can add a new partition
<code class="literal">
p3
</code>
to this
table for storing values less than
<code class="literal">
2002
</code>
as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa67205087"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">PARTITION</span> <span class="token punctuation">(</span><span class="token keyword">PARTITION</span> p3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">2002</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<code class="literal">
DROP PARTITION
</code>
can be used to drop one or
more
<code class="literal">
RANGE
</code>
or
<code class="literal">
LIST
</code>
partitions. This statement cannot be used with
<code class="literal">
HASH
</code>
or
<code class="literal">
KEY
</code>
partitions; instead, use
<code class="literal">
COALESCE
PARTITION
</code>
(see later in this section). Any data
that was stored in the dropped partitions named in the
<em class="replaceable">
<code>
partition_names
</code>
</em>
list is
discarded. For example, given the table
<code class="literal">
t1
</code>
defined previously, you can drop the
partitions named
<code class="literal">
p0
</code>
and
<code class="literal">
p1
</code>
as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa84302425"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">PARTITION</span> p0<span class="token punctuation">,</span> p1<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>
<code class="literal">
DROP PARTITION
</code>
does not work with
tables that use the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage engine. See
<a class="xref" href="partitioning-management-range-list.html" title="26.3.1 Management of RANGE and LIST Partitions">
Section 26.3.1, “Management of RANGE and LIST Partitions”
</a>
, and
<a class="xref" href="mysql-cluster-limitations.html" title="25.2.7 Known Limitations of NDB Cluster">
Section 25.2.7, “Known Limitations of NDB Cluster”
</a>
.
</p>
</div>
<p>
<code class="literal">
ADD PARTITION
</code>
and
<code class="literal">
DROP
PARTITION
</code>
do not currently support
<code class="literal">
IF
[NOT] EXISTS
</code>
.
</p>
<p>
The
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
DISCARD
PARTITION ... TABLESPACE
</code>
</a>
and
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
IMPORT
PARTITION ... TABLESPACE
</code>
</a>
options extend the
<a class="link" href="glossary.html#glos_transportable_tablespace" title="transportable tablespace">
Transportable
Tablespace
</a>
feature to individual
<code class="literal">
InnoDB
</code>
table partitions. Each
<code class="literal">
InnoDB
</code>
table partition has its own
tablespace file (
<code class="filename">
.ibd
</code>
file). The
<a class="link" href="glossary.html#glos_transportable_tablespace" title="transportable tablespace">
Transportable
Tablespace
</a>
feature makes it easy to copy the
tablespaces from a running MySQL server instance to another
running instance, or to perform a restore on the same
instance. Both options take a comma-separated list of one or
more partition names. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa38932456"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">DISCARD</span> <span class="token keyword">PARTITION</span> p2<span class="token punctuation">,</span> p3 <span class="token keyword">TABLESPACE</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="sa52806786"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">IMPORT</span> <span class="token keyword">PARTITION</span> p2<span class="token punctuation">,</span> p3 <span class="token keyword">TABLESPACE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
When running
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
DISCARD
PARTITION ... TABLESPACE
</code>
</a>
and
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
IMPORT
PARTITION ... TABLESPACE
</code>
</a>
on subpartitioned tables,
both partition and subpartition names are allowed. When a
partition name is specified, subpartitions of that partition
are included.
</p>
<p>
The
<a class="link" href="glossary.html#glos_transportable_tablespace" title="transportable tablespace">
Transportable
Tablespace
</a>
feature also supports copying or restoring
partitioned
<code class="literal">
InnoDB
</code>
tables. For more
information, see
<a class="xref" href="innodb-table-import.html" title="17.6.1.3 Importing InnoDB Tables">
Section 17.6.1.3, “Importing InnoDB Tables”
</a>
.
</p>
<p>
Renames of partitioned tables are supported. You can rename
individual partitions indirectly using
<code class="literal">
ALTER TABLE
... REORGANIZE PARTITION
</code>
; however, this operation
copies the partition's data.
</p>
<p>
To delete rows from selected partitions, use the
<code class="literal">
TRUNCATE PARTITION
</code>
option. This option
takes a list of one or more comma-separated partition names.
Consider the table
<code class="literal">
t1
</code>
created by this
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa87845934"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>
id <span class="token datatype">INT</span><span class="token punctuation">,</span>
year_col <span class="token datatype">INT</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token punctuation">(</span>year_col<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">1991</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">1995</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">1999</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">2003</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p4 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">2007</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
To delete all rows from partition
<code class="literal">
p0
</code>
, use
the following statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa6022614"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">TRUNCATE</span> <span class="token keyword">PARTITION</span> p0<span class="token punctuation">;</span></code></pre>
</div>
<p>
The statement just shown has the same effect as the
following
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa66951934"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">DELETE</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> year_col <span class="token operator"><</span> <span class="token number">1991</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
When truncating multiple partitions, the partitions do not
have to be contiguous: This can greatly simplify delete
operations on partitioned tables that would otherwise
require very complex
<code class="literal">
WHERE
</code>
conditions if
done with
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statements.
For example, this statement deletes all rows from partitions
<code class="literal">
p1
</code>
and
<code class="literal">
p3
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa71732654"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">TRUNCATE</span> <span class="token keyword">PARTITION</span> p1<span class="token punctuation">,</span> p3<span class="token punctuation">;</span></code></pre>
</div>
<p>
An equivalent
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statement is shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa95004165"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">DELETE</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span>
<span class="token punctuation">(</span>year_col <span class="token operator">>=</span> <span class="token number">1991</span> <span class="token operator">AND</span> year_col <span class="token operator"><</span> <span class="token number">1995</span><span class="token punctuation">)</span>
<span class="token operator">OR</span>
<span class="token punctuation">(</span>year_col <span class="token operator">>=</span> <span class="token number">2003</span> <span class="token operator">AND</span> year_col <span class="token operator"><</span> <span class="token number">2007</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If you use the
<code class="literal">
ALL
</code>
keyword in place of
the list of partition names, the statement acts on all table
partitions.
</p>
<p>
<code class="literal">
TRUNCATE PARTITION
</code>
merely deletes rows;
it does not alter the definition of the table itself, or of
any of its partitions.
</p>
<p>
To verify that the rows were dropped, check the
<code class="literal">
INFORMATION_SCHEMA.PARTITIONS
</code>
table,
using a query such as this one:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa6889229"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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> PARTITION_NAME<span class="token punctuation">,</span> TABLE_ROWS
<span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">PARTITIONS</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></code></pre>
</div>
<p>
<code class="literal">
COALESCE PARTITION
</code>
can be used with a
table that is partitioned by
<code class="literal">
HASH
</code>
or
<code class="literal">
KEY
</code>
to reduce the number of partitions by
<em class="replaceable">
<code>
number
</code>
</em>
. Suppose that you have
created table
<code class="literal">
t2
</code>
as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa45118315"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t2 <span class="token punctuation">(</span>
<span class="token keyword">name</span> <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>
started <span class="token datatype">DATE</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">HASH</span><span class="token punctuation">(</span> <span class="token function">YEAR</span><span class="token punctuation">(</span>started<span class="token punctuation">)</span> <span class="token punctuation">)</span>
<span class="token keyword">PARTITIONS</span> <span class="token number">6</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
To reduce the number of partitions used by
<code class="literal">
t2
</code>
from 6 to 4, use the following
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa37004939"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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> t2 <span class="token keyword">COALESCE</span> <span class="token keyword">PARTITION</span> <span class="token number">2</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The data contained in the last
<em class="replaceable">
<code>
number
</code>
</em>
partitions is merged into
the remaining partitions. In this case, partitions 4 and 5
are merged into the first 4 partitions (the partitions
numbered 0, 1, 2, and 3).
</p>
<p>
To change some but not all the partitions used by a
partitioned table, you can use
<code class="literal">
REORGANIZE
PARTITION
</code>
. This statement can be used in several
ways:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
To merge a set of partitions into a single partition.
This is done by naming several partitions in the
<em class="replaceable">
<code>
partition_names
</code>
</em>
list and
supplying a single definition for
<em class="replaceable">
<code>
partition_definition
</code>
</em>
.
</p>
</li>
<li class="listitem">
<p>
To split an existing partition into several partitions.
Accomplish this by naming a single partition for
<em class="replaceable">
<code>
partition_names
</code>
</em>
and providing
multiple
<em class="replaceable">
<code>
partition_definitions
</code>
</em>
.
</p>
</li>
<li class="listitem">
<p>
To change the ranges for a subset of partitions defined
using
<code class="literal">
VALUES LESS THAN
</code>
or the value
lists for a subset of partitions defined using
<code class="literal">
VALUES IN
</code>
.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
For partitions that have not been explicitly named, MySQL
automatically provides the default names
<code class="literal">
p0
</code>
,
<code class="literal">
p1
</code>
,
<code class="literal">
p2
</code>
, and so on. The same is true with
regard to subpartitions.
</p>
</div>
<p>
For more detailed information about and examples of
<code class="literal">
ALTER TABLE ... REORGANIZE PARTITION
</code>
statements, see
<a class="xref" href="partitioning-management-range-list.html" title="26.3.1 Management of RANGE and LIST Partitions">
Section 26.3.1, “Management of RANGE and LIST Partitions”
</a>
.
</p>
</li>
<li class="listitem">
<p>
To exchange a table partition or subpartition with a table,
use the
<code class="literal">
ALTER TABLE ... EXCHANGE
PARTITION
</code>
statement—that is, to move any
existing rows in the partition or subpartition to the
nonpartitioned table, and any existing rows in the
nonpartitioned table to the table partition or subpartition.
</p>
<p>
Once one or more columns have been added to a partitioned
table using
<code class="literal">
ALGORITHM=INSTANT
</code>
, it is no
longer possible to exchange partitions with that table.
</p>
<p>
For usage information and examples, see
<a class="xref" href="partitioning-management-exchange.html" title="26.3.3 Exchanging Partitions and Subpartitions with Tables">
Section 26.3.3, “Exchanging Partitions and Subpartitions with Tables”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Several options provide partition maintenance and repair
functionality analogous to that implemented for
nonpartitioned tables by statements such as
<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>
(which are also
supported for partitioned tables; for more information, see
<a class="xref" href="table-maintenance-statements.html" title="15.7.3 Table Maintenance Statements">
Section 15.7.3, “Table Maintenance Statements”
</a>
). These
include
<code class="literal">
ANALYZE PARTITION
</code>
,
<code class="literal">
CHECK
PARTITION
</code>
,
<code class="literal">
OPTIMIZE PARTITION
</code>
,
<code class="literal">
REBUILD PARTITION
</code>
, and
<code class="literal">
REPAIR
PARTITION
</code>
. Each of these options takes a
<em class="replaceable">
<code>
partition_names
</code>
</em>
clause consisting
of one or more names of partitions, separated by commas. The
partitions must already exist in the target table. You can
also use the
<code class="literal">
ALL
</code>
keyword in place of
<em class="replaceable">
<code>
partition_names
</code>
</em>
, in which case
the statement acts on all table partitions. For more
information and examples, see
<a class="xref" href="partitioning-maintenance.html" title="26.3.4 Maintenance of Partitions">
Section 26.3.4, “Maintenance of Partitions”
</a>
.
</p>
<p>
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
does not currently
support per-partition optimization;
<code class="literal">
ALTER TABLE ...
OPTIMIZE PARTITION
</code>
causes the entire table to
rebuilt and analyzed, and an appropriate warning to be
issued. (Bug #11751825, Bug #42822) To work around this
problem, use
<code class="literal">
ALTER TABLE ... REBUILD
PARTITION
</code>
and
<code class="literal">
ALTER TABLE ... ANALYZE
PARTITION
</code>
instead.
</p>
<p>
The
<code class="literal">
ANALYZE PARTITION
</code>
,
<code class="literal">
CHECK
PARTITION
</code>
,
<code class="literal">
OPTIMIZE PARTITION
</code>
,
and
<code class="literal">
REPAIR PARTITION
</code>
options are not
supported for tables which are not partitioned.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
REMOVE PARTITIONING
</code>
enables you to remove
a table's partitioning without otherwise affecting the
table or its data. This option can be combined with other
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
options such as
those used to add, drop, or rename columns or indexes.
</p>
</li>
<li class="listitem">
<p>
Using the
<code class="literal">
ENGINE
</code>
option with
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
changes the
storage engine used by the table without affecting the
partitioning. The target storage engine must provide its own
partitioning handler. Only the
<code class="literal">
InnoDB
</code>
and
<code class="literal">
NDB
</code>
storage engines have native
partitioning handlers.
</p>
</li>
</ul>
</div>
<p>
It is possible for an
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statement to contain a
<code class="literal">
PARTITION BY
</code>
or
<code class="literal">
REMOVE PARTITIONING
</code>
clause in an addition to
other alter specifications, but the
<code class="literal">
PARTITION
BY
</code>
or
<code class="literal">
REMOVE PARTITIONING
</code>
clause
must be specified last after any other specifications.
</p>
<p>
The
<code class="literal">
ADD PARTITION
</code>
,
<code class="literal">
DROP
PARTITION
</code>
,
<code class="literal">
COALESCE PARTITION
</code>
,
<code class="literal">
REORGANIZE PARTITION
</code>
,
<code class="literal">
ANALYZE
PARTITION
</code>
,
<code class="literal">
CHECK PARTITION
</code>
, and
<code class="literal">
REPAIR PARTITION
</code>
options cannot be combined
with other alter specifications in a single
<code class="literal">
ALTER
TABLE
</code>
, since the options just listed act on individual
partitions. For more information, see
<a class="xref" href="alter-table-partition-operations.html" title="15.1.9.1 ALTER TABLE Partition Operations">
Section 15.1.9.1, “ALTER TABLE Partition Operations”
</a>
.
</p>
<p>
Only a single instance of any one of the following options can
be used in a given
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statement:
<code class="literal">
PARTITION BY
</code>
,
<code class="literal">
ADD
PARTITION
</code>
,
<code class="literal">
DROP PARTITION
</code>
,
<code class="literal">
TRUNCATE PARTITION
</code>
,
<code class="literal">
EXCHANGE
PARTITION
</code>
,
<code class="literal">
REORGANIZE PARTITION
</code>
, or
<code class="literal">
COALESCE PARTITION
</code>
,
<code class="literal">
ANALYZE
PARTITION
</code>
,
<code class="literal">
CHECK PARTITION
</code>
,
<code class="literal">
OPTIMIZE PARTITION
</code>
,
<code class="literal">
REBUILD
PARTITION
</code>
,
<code class="literal">
REMOVE PARTITIONING
</code>
.
</p>
<p>
For example, the following two statements are invalid:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa95450996"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">ANALYZE</span> <span class="token keyword">PARTITION</span> p1<span class="token punctuation">,</span> <span class="token keyword">ANALYZE</span> <span class="token keyword">PARTITION</span> p2<span class="token punctuation">;</span>
<span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">ANALYZE</span> <span class="token keyword">PARTITION</span> p1<span class="token punctuation">,</span> <span class="token keyword">CHECK</span> <span class="token keyword">PARTITION</span> p2<span class="token punctuation">;</span></code></pre>
</div>
<p>
In the first case, you can analyze partitions
<code class="literal">
p1
</code>
and
<code class="literal">
p2
</code>
of table
<code class="literal">
t1
</code>
concurrently using a single statement with
a single
<code class="literal">
ANALYZE PARTITION
</code>
option that lists
both of the partitions to be analyzed, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa31259787"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">ANALYZE</span> <span class="token keyword">PARTITION</span> p1<span class="token punctuation">,</span> p2<span class="token punctuation">;</span></code></pre>
</div>
<p>
In the second case, it is not possible to perform
<code class="literal">
ANALYZE
</code>
and
<code class="literal">
CHECK
</code>
operations on different partitions of the same table
concurrently. Instead, you must issue two separate statements,
like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa13883955"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">ANALYZE</span> <span class="token keyword">PARTITION</span> p1<span class="token punctuation">;</span>
<span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">CHECK</span> <span class="token keyword">PARTITION</span> p2<span class="token punctuation">;</span></code></pre>
</div>
<p>
<code class="literal">
REBUILD
</code>
operations are currently unsupported
for subpartitions. The
<code class="literal">
REBUILD
</code>
keyword is
expressly disallowed with subpartitions, and causes
<code class="literal">
ALTER TABLE
</code>
to fail with an error if so used.
</p>
<p>
<code class="literal">
CHECK PARTITION
</code>
and
<code class="literal">
REPAIR
PARTITION
</code>
operations fail when the partition to be
checked or repaired contains any duplicate key errors.
</p>
<p>
For more information about these statements, see
<a class="xref" href="partitioning-maintenance.html" title="26.3.4 Maintenance of Partitions">
Section 26.3.4, “Maintenance of Partitions”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/debugging-client.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="debugging-client">
</a>
7.9.2 Debugging a MySQL Client
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045253581440">
</a>
<a class="indexterm" name="idm46045253579984">
</a>
<p>
To be able to debug a MySQL client with the integrated debug
package, you should configure MySQL with
<a class="link" href="source-configuration-options.html#option_cmake_with_debug">
<code class="option">
-DWITH_DEBUG=1
</code>
</a>
. See
<a class="xref" href="source-configuration-options.html" title="2.8.7 MySQL Source-Configuration Options">
Section 2.8.7, “MySQL Source-Configuration Options”
</a>
.
</p>
<a class="indexterm" name="idm46045253576256">
</a>
<a class="indexterm" name="idm46045253575216">
</a>
<p>
Before running a client, you should set the
<code class="literal">
MYSQL_DEBUG
</code>
environment variable:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa89696192"><div class="copy-help left">Press ⌘+C to 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_DEBUG</span><span class="token attr-value"><span class="token punctuation">=</span>d:t:O,/tmp/client.trace</span>
<span class="token prompt">$> </span><span class="token command">export</span> MYSQL_DEBUG</code></pre>
</div>
<p>
This causes clients to generate a trace file in
<code class="filename">
/tmp/client.trace
</code>
.
</p>
<p>
If you have problems with your own client code, you should attempt
to connect to the server and run your query using a client that is
known to work. Do this by running
<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
debugging mode (assuming that you have compiled MySQL with
debugging on):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa71140295"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span> <span class="token constant">--debug</span><span class="token attr-value"><span class="token punctuation">=</span>d:t:O,/tmp/client.trace</span></code></pre>
</div>
<p>
This provides useful information in case you mail a bug report.
See
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
.
</p>
<p>
If your client crashes at some 'legal' looking code, you should
check that your
<code class="filename">
mysql.h
</code>
include file matches
your MySQL library file. A very common mistake is to use an old
<code class="filename">
mysql.h
</code>
file from an old MySQL installation
with new MySQL library.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-server.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-server">
</a>
6.3.3 mysql.server — MySQL Server Startup Script
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045321380048">
</a>
<p>
MySQL distributions on Unix and Unix-like system include a
script named
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
, which starts the
MySQL server using
<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>
. It can be
used on systems such as Linux and Solaris that use System
V-style run directories to start and stop system services. It is
also used by the macOS Startup Item for MySQL.
</p>
<p>
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
is the script name as used
within the MySQL source tree. The installed name might be
different (for example,
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
or
<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 the following discussion, adjust
the name
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
as appropriate for your
system.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
For some Linux platforms, MySQL installation from RPM or
Debian packages includes systemd support for managing MySQL
server startup and shutdown. On these platforms,
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
and
<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>
are not installed because they
are unnecessary. For more information, 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>
.
</p>
</div>
<p>
To start or stop the server manually using the
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
script, invoke it from the
command line with
<code class="literal">
start
</code>
or
<code class="literal">
stop
</code>
arguments:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa10726051"><div class="copy-help left">Press ⌘+C to 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 punctuation">.</span>server start
mysql<span class="token punctuation">.</span>server stop</code></pre>
</div>
<p>
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
changes location to the MySQL
installation directory, then invokes
<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>
. To run the server as some
specific user, add an appropriate
<code class="literal">
user
</code>
option
to the
<code class="literal">
[mysqld]
</code>
group of the global
<code class="filename">
/etc/my.cnf
</code>
option file, as shown later in
this section. (It is possible that you must edit
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
if you've installed a binary
distribution of MySQL in a nonstandard location. Modify it to
change location into the proper directory before it runs
<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>
. If you do this, your modified
version of
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
may be overwritten if
you upgrade MySQL in the future; make a copy of your edited
version that you can reinstall.)
</p>
<p>
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server stop
</strong>
</span>
</a>
stops the server by sending
a signal to it. You can also stop the server manually by
executing
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin shutdown
</strong>
</span>
</a>
.
</p>
<p>
To start and stop MySQL automatically on your server, you must
add start and stop commands to the appropriate places in your
<code class="filename">
/etc/rc*
</code>
files:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If you use the Linux server RPM package
(
<code class="literal">
MySQL-server-
<em class="replaceable">
<code>
VERSION
</code>
</em>
.rpm
</code>
),
or a native Linux package installation, the
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
script may be installed in
the
<code class="filename">
/etc/init.d
</code>
directory with the name
<code class="filename">
mysqld
</code>
or
<code class="filename">
mysql
</code>
.
See
<a class="xref" href="linux-installation-rpm.html" title="2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle">
Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle”
</a>
, for more
information on the Linux RPM packages.
</p>
</li>
<li class="listitem">
<p>
If you install MySQL from a source distribution or using a
binary distribution format that does not install
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
automatically, you can
install the script manually. It can be found in the
<code class="filename">
support-files
</code>
directory under the MySQL
installation directory or in a MySQL source tree. Copy the
script to the
<code class="filename">
/etc/init.d
</code>
directory
with the name
<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 make it
executable:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa82236114"><div class="copy-help left">Press ⌘+C to 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">cp mysql<span class="token punctuation">.</span>server /etc/init<span class="token punctuation">.</span>d/mysql
chmod +x /etc/init<span class="token punctuation">.</span>d/mysql</code></pre>
</div>
<p>
After installing the script, the commands needed to activate
it to run at system startup depend on your operating system.
On Linux, you can use
<span class="command">
<strong>
chkconfig
</strong>
</span>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa151143"><div class="copy-help left">Press ⌘+C to 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">chkconfig <span class="token property">--add</span> mysql</code></pre>
</div>
<p>
On some Linux systems, the following command also seems to
be necessary to fully enable 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>
script:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa68790989"><div class="copy-help left">Press ⌘+C to 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">chkconfig <span class="token property">--level</span> 345 mysql on</code></pre>
</div>
</li>
<li class="listitem">
<p>
On FreeBSD, startup scripts generally should go in
<code class="filename">
/usr/local/etc/rc.d/
</code>
. Install the
<code class="filename">
mysql.server
</code>
script as
<code class="filename">
/usr/local/etc/rc.d/mysql.server.sh
</code>
to
enable automatic startup. The
<code class="literal">
rc(8)
</code>
manual page states that scripts in this directory are
executed only if their base name matches the
<code class="literal">
*.sh
</code>
shell file name pattern. Any other
files or directories present within the directory are
silently ignored.
</p>
</li>
<li class="listitem">
<p>
As an alternative to the preceding setup, some operating
systems also use
<code class="filename">
/etc/rc.local
</code>
or
<code class="filename">
/etc/init.d/boot.local
</code>
to start
additional services on startup. To start up MySQL using this
method, append a command like the one following to the
appropriate startup file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa94339744"><div class="copy-help left">Press ⌘+C to 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">/bin/sh <span class="token property">-c</span> <span class="token atrule">'cd /usr/local/mysql; ./bin/mysqld_safe --user=mysql &'</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
For other systems, consult your operating system
documentation to see how to install startup scripts.
</p>
</li>
</ul>
</div>
<p>
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
reads options from the
<code class="literal">
[mysql.server]
</code>
and
<code class="literal">
[mysqld]
</code>
sections of option files. For
backward compatibility, it also reads
<code class="literal">
[mysql_server]
</code>
sections, but to be current
you should rename such sections to
<code class="literal">
[mysql.server]
</code>
.
</p>
<a class="indexterm" name="idm46045321316912">
</a>
<p>
You can add options for
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
in a
global
<code class="filename">
/etc/my.cnf
</code>
file. A typical
<code class="filename">
my.cnf
</code>
file might look like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa91772350"><div class="copy-help left">Press ⌘+C to 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">datadir</span><span class="token attr-value"><span class="token punctuation">=</span>/usr/local/mysql/var</span>
<span class="token constant">socket</span><span class="token attr-value"><span class="token punctuation">=</span>/var/tmp/mysql.sock</span>
<span class="token constant">port</span><span class="token attr-value"><span class="token punctuation">=</span>3306</span>
<span class="token constant">user</span><span class="token attr-value"><span class="token punctuation">=</span>mysql</span>
<span class="token selector">[mysql.server]</span>
<span class="token constant">basedir</span><span class="token attr-value"><span class="token punctuation">=</span>/usr/local/mysql</span></code></pre>
</div>
<p>
The
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
script supports the options
shown in the following table. If specified, they
<span class="emphasis">
<em>
must
</em>
</span>
be placed in an option file, not on
the command line.
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
supports only
<code class="literal">
start
</code>
and
<code class="literal">
stop
</code>
as
command-line arguments.
</p>
<div class="table">
<a name="idm46045321306320">
</a>
<p class="title">
<b>
Table 6.8 mysql.server Option-File Options
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="Option-file options available for mysql.server.">
<colgroup>
<col align="left" style="width: 20%"/>
<col align="left" style="width: 70%"/>
<col align="left" style="width: 10%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Option Name
</th>
<th scope="col">
Description
</th>
<th scope="col">
Type
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
<a class="link" href="mysql-server.html#option_mysql_server_basedir">
<code class="literal">
basedir
</code>
</a>
</th>
<td>
Path to MySQL installation directory
</td>
<td>
Directory name
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mysql-server.html#option_mysql_server_datadir">
<code class="literal">
datadir
</code>
</a>
</th>
<td>
Path to MySQL data directory
</td>
<td>
Directory name
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mysql-server.html#option_mysql_server_pid-file">
<code class="literal">
pid-file
</code>
</a>
</th>
<td>
File in which server should write its process ID
</td>
<td>
File name
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mysql-server.html#option_mysql_server_service-startup-timeout">
<code class="literal">
service-startup-timeout
</code>
</a>
</th>
<td>
How long to wait for server startup
</td>
<td>
Integer
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="option_mysql_server_basedir">
</a>
<a class="link" href="mysql-server.html#option_mysql_server_basedir">
<code class="option">
basedir=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
</p>
<a class="indexterm" name="idm46045321277424">
</a>
<a class="indexterm" name="idm46045321275936">
</a>
<p>
The path to the MySQL installation directory.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_server_datadir">
</a>
<a class="link" href="mysql-server.html#option_mysql_server_datadir">
<code class="option">
datadir=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
</p>
<a class="indexterm" name="idm46045321271568">
</a>
<a class="indexterm" name="idm46045321270080">
</a>
<p>
The path to the MySQL data directory.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_server_pid-file">
</a>
<a class="link" href="mysql-server.html#option_mysql_server_pid-file">
<code class="option">
pid-file=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
</p>
<a class="indexterm" name="idm46045321265648">
</a>
<a class="indexterm" name="idm46045321264160">
</a>
<p>
The path name of the file in which the server should write
its process ID. The server creates the file in the data
directory unless an absolute path name is given to specify a
different directory.
</p>
<p>
If this option is not given,
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
uses a default value of
<code class="filename">
<em class="replaceable">
<code>
host_name
</code>
</em>
.pid
</code>
.
The PID file value passed to
<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>
overrides any value specified in the
<code class="literal">
[mysqld_safe]
</code>
option file group. Because
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
reads the
<code class="literal">
[mysqld]
</code>
option file group but not the
<code class="literal">
[mysqld_safe]
</code>
group, you can ensure that
<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>
gets the same value when
invoked from
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
as when invoked
manually by putting the same
<code class="literal">
pid-file
</code>
setting in both the
<code class="literal">
[mysqld_safe]
</code>
and
<code class="literal">
[mysqld]
</code>
groups.
</p>
</li>
<li class="listitem">
<p>
<a name="option_mysql_server_service-startup-timeout">
</a>
<a class="link" href="mysql-server.html#option_mysql_server_service-startup-timeout">
<code class="option">
service-startup-timeout=
<em class="replaceable">
<code>
seconds
</code>
</em>
</code>
</a>
</p>
<a class="indexterm" name="idm46045321247200">
</a>
<a class="indexterm" name="idm46045321245696">
</a>
<p>
How long in seconds to wait for confirmation of server
startup. If the server does not start within this time,
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
exits with an error. The
default value is 900. A value of 0 means not to wait at all
for startup. Negative values mean to wait forever (no
timeout).
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/create-table-foreign-keys.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="create-table-foreign-keys">
</a>
15.1.20.5 FOREIGN KEY Constraints
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045185188544">
</a>
<a class="indexterm" name="idm46045185187472">
</a>
<p>
MySQL supports foreign keys, which permit cross-referencing
related data across tables, and foreign key constraints, which
help keep the related data consistent.
</p>
<p>
A foreign key relationship involves a parent table that holds
the initial column values, and a child table with column values
that reference the parent column values. A foreign key
constraint is defined on the child table.
</p>
<p>
The essential syntax for a defining a foreign key constraint in
a
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
or
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statement includes
the following:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa5127113"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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 keyword">CONSTRAINT</span> <span class="token punctuation">[</span><em class="replaceable">symbol</em><span class="token punctuation">]</span><span class="token punctuation">]</span> <span class="token keyword">FOREIGN</span> <span class="token keyword">KEY</span>
<span class="token punctuation">[</span><em class="replaceable">index_name</em><span class="token punctuation">]</span> <span class="token punctuation">(</span><em class="replaceable">col_name</em><span class="token punctuation">,</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">)</span>
<span class="token keyword">REFERENCES</span> <em class="replaceable">tbl_name</em> <span class="token punctuation">(</span><em class="replaceable">col_name</em><span class="token punctuation">,</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">)</span>
<span class="token punctuation">[</span><span class="token keyword">ON</span> <span class="token keyword">DELETE</span> <em class="replaceable">reference_option</em><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">ON</span> <span class="token keyword">UPDATE</span> <em class="replaceable">reference_option</em><span class="token punctuation">]</span>
<em class="replaceable">reference_option</em>:
<span class="token keyword">RESTRICT</span> <span class="token operator">|</span> <span class="token keyword">CASCADE</span> <span class="token operator">|</span> <span class="token keyword">SET</span> <span class="token boolean">NULL</span> <span class="token operator">|</span> <span class="token keyword">NO</span> <span class="token keyword">ACTION</span> <span class="token operator">|</span> <span class="token keyword">SET</span> <span class="token keyword">DEFAULT</span></code></pre>
</div>
<p>
Foreign key constraint usage is described under the following
topics in this section:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="create-table-foreign-keys.html#foreign-key-identifiers" title="Identifiers">
Identifiers
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="create-table-foreign-keys.html#foreign-key-restrictions" title="Conditions and Restrictions">
Conditions and Restrictions
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="create-table-foreign-keys.html#foreign-key-referential-actions" title="Referential Actions">
Referential Actions
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="create-table-foreign-keys.html#foreign-key-examples" title="Foreign Key Constraint Examples">
Foreign Key Constraint Examples
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="create-table-foreign-keys.html#foreign-key-adding" title="Adding Foreign Key Constraints">
Adding Foreign Key Constraints
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="create-table-foreign-keys.html#foreign-key-dropping" title="Dropping Foreign Key Constraints">
Dropping Foreign Key Constraints
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="create-table-foreign-keys.html#foreign-key-checks" title="Foreign Key Checks">
Foreign Key Checks
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="create-table-foreign-keys.html#foreign-key-locking" title="Locking">
Locking
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="create-table-foreign-keys.html#foreign-key-metadata" title="Foreign Key Definitions and Metadata">
Foreign Key Definitions and Metadata
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="create-table-foreign-keys.html#foreign-key-errors" title="Foreign Key Errors">
Foreign Key Errors
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="foreign-key-identifiers">
</a>
Identifiers
</h5>
</div>
</div>
</div>
<p>
Foreign key constraint naming is governed by the following
rules:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The
<code class="literal">
CONSTRAINT
</code>
<em class="replaceable">
<code>
symbol
</code>
</em>
value is used, if
defined.
</p>
</li>
<li class="listitem">
<p>
If the
<code class="literal">
CONSTRAINT
</code>
<em class="replaceable">
<code>
symbol
</code>
</em>
clause is not defined,
or a symbol is not included following the
<code class="literal">
CONSTRAINT
</code>
keyword, a constraint name
name is generated automatically.
</p>
<p>
If the
<code class="literal">
CONSTRAINT
</code>
<em class="replaceable">
<code>
symbol
</code>
</em>
clause is not defined,
or a symbol is not included following the
<code class="literal">
CONSTRAINT
</code>
keyword, both
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
and
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage engines ignore
<code class="literal">
FOREIGN_KEY
<em class="replaceable">
<code>
index_name
</code>
</em>
</code>
.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
CONSTRAINT
<em class="replaceable">
<code>
symbol
</code>
</em>
</code>
value, if
defined, must be unique in the database. A duplicate
<em class="replaceable">
<code>
symbol
</code>
</em>
results in an error
similar to:
<span class="errortext">
ERROR 1005 (HY000): Can't create
table 'test.fk1' (errno: 121)
</span>
.
</p>
</li>
<li class="listitem">
<p>
NDB Cluster stores foreign key names using the same
lettercase with which they are created.
</p>
</li>
</ul>
</div>
<p>
Table and column identifiers in a
<code class="literal">
FOREIGN KEY ...
REFERENCES
</code>
clause can be quoted within backticks
(
<code class="literal">
`
</code>
). Alternatively, double quotation marks
(
<code class="literal">
"
</code>
) can be used if the
<a class="link" href="sql-mode.html#sqlmode_ansi_quotes">
<code class="literal">
ANSI_QUOTES
</code>
</a>
SQL mode is
enabled. The
<a class="link" href="server-system-variables.html#sysvar_lower_case_table_names">
<code class="literal">
lower_case_table_names
</code>
</a>
system
variable setting is also taken into account.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="foreign-key-restrictions">
</a>
Conditions and Restrictions
</h5>
</div>
</div>
</div>
<p>
Foreign key constraints are subject to the following
conditions and restrictions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Parent and child tables must use the same storage engine,
and they cannot be defined as temporary tables.
</p>
</li>
<li class="listitem">
<p>
Creating a foreign key constraint requires the
<a class="link" href="privileges-provided.html#priv_references">
<code class="literal">
REFERENCES
</code>
</a>
privilege on the
parent table.
</p>
</li>
<li class="listitem">
<p>
Corresponding columns in the foreign key and the
referenced key must have similar data types.
<span class="emphasis">
<em>
The
size and sign of fixed precision types such as
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
INTEGER
</code>
</a>
and
<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>
must be the
same
</em>
</span>
. The length of string types need not be
the same. For nonbinary (character) string columns, the
character set and collation must be the same.
</p>
</li>
<li class="listitem">
<p>
MySQL supports foreign key references between one column
and another within a table. (A column cannot have a
foreign key reference to itself.) In these cases, a
<span class="quote">
“
<span class="quote">
child table record
</span>
”
</span>
refers to a dependent
record within the same table.
</p>
</li>
<li class="listitem">
<p>
MySQL requires indexes on foreign keys and referenced keys
so that foreign key checks can be fast and not require a
table scan. In the referencing table, there must be an
index where the foreign key columns are listed as the
<span class="emphasis">
<em>
first
</em>
</span>
columns in the same order. Such
an index is created on the referencing table automatically
if it does not exist. This index might be silently dropped
later if you create another index that can be used to
enforce the foreign key constraint.
<em class="replaceable">
<code>
index_name
</code>
</em>
, if given, is used
as described previously.
</p>
</li>
<li class="listitem">
<p>
Previously,
<code class="literal">
InnoDB
</code>
allowed a foreign
key to reference any index column or group of columns,
even a non-unique index or partial index, an extension of
standard SQL. This is still allowed for backwards
compatibility, but is now deprecated; in addition, it must
be enabled by setting
<a class="link" href="server-system-variables.html#sysvar_restrict_fk_on_non_standard_key">
<code class="literal">
restrict_fk_on_non_standard_key
</code>
</a>
.
If this is done, there must still be an index in the
referenced table where the referenced columns are the
<span class="emphasis">
<em>
first
</em>
</span>
columns in the same order.
Hidden columns that
<code class="literal">
InnoDB
</code>
adds to an
index are also considered in such cases (see
<a class="xref" href="innodb-index-types.html" title="17.6.2.1 Clustered and Secondary Indexes">
Section 17.6.2.1, “Clustered and Secondary Indexes”
</a>
). You should expect
support for use of nonstandard keys to be removed in a
future version of MySQL, and migrate away from their use.
</p>
<p>
<code class="literal">
NDB
</code>
always requires an explicit unique
key (or primary key) on any column referenced as a foreign
key.
</p>
</li>
<li class="listitem">
<p>
Index prefixes on foreign key columns are not supported.
Consequently,
<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 cannot be
included in a foreign key because indexes on those columns
must always include a prefix length.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
does not currently
support foreign keys for tables with user-defined
partitioning. This includes both parent and child tables.
</p>
<p>
This restriction does not apply for
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables that are
partitioned by
<code class="literal">
KEY
</code>
or
<code class="literal">
LINEAR
KEY
</code>
(the only user partitioning types supported
by the
<code class="literal">
NDB
</code>
storage engine); these may
have foreign key references or be the targets of such
references.
</p>
</li>
<li class="listitem">
<p>
A table in a foreign key relationship cannot be altered to
use another storage engine. To change the storage engine,
you must drop any foreign key constraints first.
</p>
</li>
<li class="listitem">
<p>
A foreign key constraint cannot reference a virtual
generated column.
</p>
</li>
</ul>
</div>
<p>
For information about how the MySQL implementation of foreign
key constraints differs from the SQL standard, see
<a class="xref" href="ansi-diff-foreign-keys.html" title="1.7.2.3 FOREIGN KEY Constraint Differences">
Section 1.7.2.3, “FOREIGN KEY Constraint Differences”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="foreign-key-referential-actions">
</a>
Referential Actions
</h5>
</div>
</div>
</div>
<p>
When an
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
or
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
operation affects a key
value in the parent table that has matching rows in the child
table, the result depends on the
<span class="emphasis">
<em>
referential
action
</em>
</span>
specified by
<code class="literal">
ON UPDATE
</code>
and
<code class="literal">
ON DELETE
</code>
subclauses of the
<code class="literal">
FOREIGN KEY
</code>
clause. Referential actions
include:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
CASCADE
</code>
: Delete or update the row from
the parent table and automatically delete or update the
matching rows in the child table. Both
<code class="literal">
ON DELETE
CASCADE
</code>
and
<code class="literal">
ON UPDATE CASCADE
</code>
are supported. Between two tables, do not define several
<code class="literal">
ON UPDATE CASCADE
</code>
clauses that act on
the same column in the parent table or in the child table.
</p>
<p>
If a
<code class="literal">
FOREIGN KEY
</code>
clause is defined on
both tables in a foreign key relationship, making both
tables a parent and child, an
<code class="literal">
ON UPDATE
CASCADE
</code>
or
<code class="literal">
ON DELETE CASCADE
</code>
subclause defined for one
<code class="literal">
FOREIGN KEY
</code>
clause must be defined for the other in order for
cascading operations to succeed. If an
<code class="literal">
ON UPDATE
CASCADE
</code>
or
<code class="literal">
ON DELETE CASCADE
</code>
subclause is only defined for one
<code class="literal">
FOREIGN
KEY
</code>
clause, cascading operations fail with an
error.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Cascaded foreign key actions do not activate triggers.
</p>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
SET NULL
</code>
: Delete or update the row from
the parent table and set the foreign key column or columns
in the child table to
<code class="literal">
NULL
</code>
. Both
<code class="literal">
ON DELETE SET NULL
</code>
and
<code class="literal">
ON
UPDATE SET NULL
</code>
clauses are supported.
</p>
<p>
If you specify a
<code class="literal">
SET NULL
</code>
action,
<span class="emphasis">
<em>
make sure that you have not declared the columns
in the child table as
<code class="literal">
NOT
NULL
</code>
</em>
</span>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
RESTRICT
</code>
: Rejects the delete or update
operation for the parent table. Specifying
<code class="literal">
RESTRICT
</code>
(or
<code class="literal">
NO
ACTION
</code>
) is the same as omitting the
<code class="literal">
ON
DELETE
</code>
or
<code class="literal">
ON UPDATE
</code>
clause.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NO ACTION
</code>
: A keyword from standard SQL.
For
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
, this is
equivalent to
<code class="literal">
RESTRICT
</code>
; the delete or
update operation for the parent table is immediately
rejected if there is a related foreign key value in the
referenced table.
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
supports deferred checks, and
<code class="literal">
NO ACTION
</code>
specifies a deferred check; when this is used, constraint
checks are not performed until commit time. Note that for
<code class="literal">
NDB
</code>
tables, this causes all foreign key
checks made for both parent and child tables to be
deferred.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SET DEFAULT
</code>
: This action is recognized
by the MySQL parser, but both
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
and
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
reject table definitions
containing
<code class="literal">
ON DELETE SET DEFAULT
</code>
or
<code class="literal">
ON UPDATE SET DEFAULT
</code>
clauses.
</p>
</li>
</ul>
</div>
<p>
For storage engines that support foreign keys, MySQL rejects
any
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
or
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
operation that attempts
to create a foreign key value in a child table if there is no
matching candidate key value in the parent table.
</p>
<p>
For an
<code class="literal">
ON DELETE
</code>
or
<code class="literal">
ON
UPDATE
</code>
that is not specified, the default action is
always
<code class="literal">
NO ACTION
</code>
.
</p>
<p>
As the default, an
<code class="literal">
ON DELETE NO ACTION
</code>
or
<code class="literal">
ON UPDATE NO ACTION
</code>
clause that is
specified explicitly does not appear in
<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>
output or in
tables dumped with
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
.
<code class="literal">
RESTRICT
</code>
, which is an equivalent
non-default keyword, appears in
<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>
output and in tables dumped with
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
.
</p>
<p>
For
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables,
<code class="literal">
ON
UPDATE CASCADE
</code>
is not supported where the reference
is to the parent table's primary key.
</p>
<p>
For
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables,
<code class="literal">
ON
DELETE CASCADE
</code>
is not supported where the child
table contains one or more columns of any of the
<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>
types. (Bug #89511, Bug
#27484882)
</p>
<p>
<code class="literal">
InnoDB
</code>
performs cascading operations using
a depth-first search algorithm on the records of the index
that corresponds to the foreign key constraint.
</p>
<p>
A foreign key constraint on a stored generated column cannot
use
<code class="literal">
CASCADE
</code>
,
<code class="literal">
SET NULL
</code>
,
or
<code class="literal">
SET DEFAULT
</code>
as
<code class="literal">
ON
UPDATE
</code>
referential actions, nor can it use
<code class="literal">
SET NULL
</code>
or
<code class="literal">
SET DEFAULT
</code>
as
<code class="literal">
ON DELETE
</code>
referential actions.
</p>
<p>
A foreign key constraint on the base column of a stored
generated column cannot use
<code class="literal">
CASCADE
</code>
,
<code class="literal">
SET NULL
</code>
, or
<code class="literal">
SET DEFAULT
</code>
as
<code class="literal">
ON UPDATE
</code>
or
<code class="literal">
ON
DELETE
</code>
referential actions.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="foreign-key-examples">
</a>
Foreign Key Constraint Examples
</h5>
</div>
</div>
</div>
<p>
This simple example relates
<code class="literal">
parent
</code>
and
<code class="literal">
child
</code>
tables through a single-column
foreign key:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa97247049"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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> parent <span class="token punctuation">(</span>
id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span>id<span class="token punctuation">)</span>
<span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>INNODB<span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> child <span class="token punctuation">(</span>
id <span class="token datatype">INT</span><span class="token punctuation">,</span>
parent_id <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token keyword">INDEX</span> par_ind <span class="token punctuation">(</span>parent_id<span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">FOREIGN</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span>parent_id<span class="token punctuation">)</span>
<span class="token keyword">REFERENCES</span> parent<span class="token punctuation">(</span>id<span class="token punctuation">)</span>
<span class="token keyword">ON</span> <span class="token keyword">DELETE</span> <span class="token keyword">CASCADE</span>
<span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>INNODB<span class="token punctuation">;</span></code></pre>
</div>
<p>
This is a more complex example in which a
<code class="literal">
product_order
</code>
table has foreign keys for
two other tables. One foreign key references a two-column
index in the
<code class="literal">
product
</code>
table. The other
references a single-column index in the
<code class="literal">
customer
</code>
table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa68877522"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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> product <span class="token punctuation">(</span>
category <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span> id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
price <span class="token datatype">DECIMAL</span><span class="token punctuation">,</span>
<span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">(</span>category<span class="token punctuation">,</span> id<span class="token punctuation">)</span>
<span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>INNODB<span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> customer <span class="token punctuation">(</span>
id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span>id<span class="token punctuation">)</span>
<span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>INNODB<span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> product_order <span class="token punctuation">(</span>
<span class="token keyword">no</span> <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 punctuation">,</span>
product_category <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
product_id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
customer_id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">(</span><span class="token keyword">no</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">INDEX</span> <span class="token punctuation">(</span>product_category<span class="token punctuation">,</span> product_id<span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">INDEX</span> <span class="token punctuation">(</span>customer_id<span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">FOREIGN</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span>product_category<span class="token punctuation">,</span> product_id<span class="token punctuation">)</span>
<span class="token keyword">REFERENCES</span> product<span class="token punctuation">(</span>category<span class="token punctuation">,</span> id<span class="token punctuation">)</span>
<span class="token keyword">ON</span> <span class="token keyword">UPDATE</span> <span class="token keyword">CASCADE</span> <span class="token keyword">ON</span> <span class="token keyword">DELETE</span> <span class="token keyword">RESTRICT</span><span class="token punctuation">,</span>
<span class="token keyword">FOREIGN</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span>customer_id<span class="token punctuation">)</span>
<span class="token keyword">REFERENCES</span> customer<span class="token punctuation">(</span>id<span class="token punctuation">)</span>
<span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>INNODB<span class="token punctuation">;</span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="foreign-key-adding">
</a>
Adding Foreign Key Constraints
</h5>
</div>
</div>
</div>
<p>
You can add a foreign key constraint to an existing table
using the following
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa31848981"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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 punctuation">[</span><span class="token keyword">CONSTRAINT</span> <span class="token punctuation">[</span><em class="replaceable">symbol</em><span class="token punctuation">]</span><span class="token punctuation">]</span> <span class="token keyword">FOREIGN</span> <span class="token keyword">KEY</span>
<span class="token punctuation">[</span><em class="replaceable">index_name</em><span class="token punctuation">]</span> <span class="token punctuation">(</span><em class="replaceable">col_name</em><span class="token punctuation">,</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">)</span>
<span class="token keyword">REFERENCES</span> <em class="replaceable">tbl_name</em> <span class="token punctuation">(</span><em class="replaceable">col_name</em><span class="token punctuation">,</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">)</span>
<span class="token punctuation">[</span><span class="token keyword">ON</span> <span class="token keyword">DELETE</span> <em class="replaceable">reference_option</em><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">ON</span> <span class="token keyword">UPDATE</span> <em class="replaceable">reference_option</em><span class="token punctuation">]</span></code></pre>
</div>
<p>
The foreign key can be self referential (referring to the same
table). When you add a foreign key constraint to a table using
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
,
<span class="emphasis">
<em>
remember
to first create an index on the column(s) referenced by the
foreign key.
</em>
</span>
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="foreign-key-dropping">
</a>
Dropping Foreign Key Constraints
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045185015248">
</a>
<a class="indexterm" name="idm46045185014208">
</a>
<a class="indexterm" name="idm46045185012720">
</a>
<p>
You can drop a foreign key constraint using the following
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa4135751"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">FOREIGN</span> <span class="token keyword">KEY</span> <em class="replaceable">fk_symbol</em><span class="token punctuation">;</span></code></pre>
</div>
<p>
If the
<code class="literal">
FOREIGN KEY
</code>
clause defined a
<code class="literal">
CONSTRAINT
</code>
name when you created the
constraint, you can refer to that name to drop the foreign key
constraint. Otherwise, a constraint name was generated
internally, and you must use that value. To determine the
foreign key constraint name, use
<a class="link" href="show-create-table.html" title="15.7.7.11 SHOW CREATE TABLE Statement">
<code class="literal">
SHOW
CREATE TABLE
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18063647"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> child\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> child
Create Table<span class="token punctuation">:</span> CREATE TABLE `child` (
`id` int DEFAULT NULL,
`parent_id` int DEFAULT NULL,
KEY `par_ind` (`parent_id`),
CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`)
REFERENCES `parent` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
</span>
<span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> child <span class="token keyword">DROP</span> <span class="token keyword">FOREIGN</span> <span class="token keyword">KEY</span> <span class="token punctuation">`</span>child_ibfk_1<span class="token punctuation">`</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Adding and dropping a foreign key 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 is
supported for
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE ...
ALGORITHM=INPLACE
</code>
</a>
. It is not supported for
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE ...
ALGORITHM=COPY
</code>
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="foreign-key-checks">
</a>
Foreign Key Checks
</h5>
</div>
</div>
</div>
<p>
In MySQL, InnoDB and NDB tables support checking of foreign
key constraints. Foreign key checking is controlled by the
<a class="link" href="server-system-variables.html#sysvar_foreign_key_checks">
<code class="literal">
foreign_key_checks
</code>
</a>
variable,
which is enabled by default. Typically, you leave this
variable enabled during normal operation to enforce
referential integrity. The
<a class="link" href="server-system-variables.html#sysvar_foreign_key_checks">
<code class="literal">
foreign_key_checks
</code>
</a>
variable
has the same effect on
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables
as it does for
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
tables.
</p>
<p>
The
<a class="link" href="server-system-variables.html#sysvar_foreign_key_checks">
<code class="literal">
foreign_key_checks
</code>
</a>
variable is dynamic and supports both global and session
scopes. For information about using system variables, see
<a class="xref" href="using-system-variables.html" title="7.1.9 Using System Variables">
Section 7.1.9, “Using System Variables”
</a>
.
</p>
<p>
Disabling foreign key checking is useful when:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Dropping a table that is referenced by a foreign key
constraint. A referenced table can only be dropped after
<a class="link" href="server-system-variables.html#sysvar_foreign_key_checks">
<code class="literal">
foreign_key_checks
</code>
</a>
is
disabled. When you drop a table, constraints defined on
the table are also dropped.
</p>
</li>
<li class="listitem">
<p>
Reloading tables in different order than required by their
foreign key relationships. For example,
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
produces correct definitions
of tables in the dump file, including foreign key
constraints for child tables. To make it easier to reload
dump files for tables with foreign key relationships,
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
automatically includes a
statement in the dump output that disables
<a class="link" href="server-system-variables.html#sysvar_foreign_key_checks">
<code class="literal">
foreign_key_checks
</code>
</a>
. This
enables you to import the tables in any order in case the
dump file contains tables that are not correctly ordered
for foreign keys. Disabling
<a class="link" href="server-system-variables.html#sysvar_foreign_key_checks">
<code class="literal">
foreign_key_checks
</code>
</a>
also
speeds up the import operation by avoiding foreign key
checks.
</p>
</li>
<li class="listitem">
<p>
Executing
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
operations, to avoid foreign key checking.
</p>
</li>
<li class="listitem">
<p>
Performing an
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
operation on a table that has a foreign key relationship.
</p>
</li>
</ul>
</div>
<p>
When
<a class="link" href="server-system-variables.html#sysvar_foreign_key_checks">
<code class="literal">
foreign_key_checks
</code>
</a>
is
disabled, foreign key constraints are ignored, with the
following exceptions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Recreating a table that was previously dropped returns an
error if the table definition does not conform to the
foreign key constraints that reference the table. The
table must have the correct column names and types. It
must also have indexes on the referenced keys. If these
requirements are not satisfied, MySQL returns Error 1005
that refers to errno: 150 in the error message, which
means that a foreign key constraint was not correctly
formed.
</p>
</li>
<li class="listitem">
<p>
Altering a table returns an error (errno: 150) if a
foreign key definition is incorrectly formed for the
altered table.
</p>
</li>
<li class="listitem">
<p>
Dropping an index required by a foreign key constraint.
The foreign key constraint must be removed before dropping
the index.
</p>
</li>
<li class="listitem">
<p>
Creating a foreign key constraint where a column
references a nonmatching column type.
</p>
</li>
</ul>
</div>
<p>
Disabling
<a class="link" href="server-system-variables.html#sysvar_foreign_key_checks">
<code class="literal">
foreign_key_checks
</code>
</a>
has these additional implications:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
It is permitted to drop a database that contains tables
with foreign keys that are referenced by tables outside
the database.
</p>
</li>
<li class="listitem">
<p>
It is permitted to drop a table with foreign keys
referenced by other tables.
</p>
</li>
<li class="listitem">
<p>
Enabling
<a class="link" href="server-system-variables.html#sysvar_foreign_key_checks">
<code class="literal">
foreign_key_checks
</code>
</a>
does
not trigger a scan of table data, which means that rows
added to a table while
<a class="link" href="server-system-variables.html#sysvar_foreign_key_checks">
<code class="literal">
foreign_key_checks
</code>
</a>
is
disabled are not checked for consistency when
<a class="link" href="server-system-variables.html#sysvar_foreign_key_checks">
<code class="literal">
foreign_key_checks
</code>
</a>
is
re-enabled.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="foreign-key-locking">
</a>
Locking
</h5>
</div>
</div>
</div>
<p>
MySQL extends metadata locks, as necessary, to tables that are
related by a foreign key constraint. Extending metadata locks
prevents conflicting DML and DDL operations from executing
concurrently on related tables. This feature also enables
updates to foreign key metadata when a parent table is
modified. In earlier MySQL releases, foreign key metadata,
which is owned by the child table, could not be updated
safely.
</p>
<p>
If a table is locked explicitly with
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK
TABLES
</code>
</a>
, any tables related by a foreign key
constraint are opened and locked implicitly. For foreign key
checks, a shared read-only lock
(
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
READ
</code>
</a>
) is taken on related tables. For cascading
updates, a shared-nothing write lock
(
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
WRITE
</code>
</a>
) is taken on related tables that are involved
in the operation.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="foreign-key-metadata">
</a>
Foreign Key Definitions and Metadata
</h5>
</div>
</div>
</div>
<p>
To view a foreign key definition, use
<a class="link" href="show-create-table.html" title="15.7.7.11 SHOW CREATE TABLE Statement">
<code class="literal">
SHOW CREATE TABLE
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa49912100"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> child\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> child
Create Table<span class="token punctuation">:</span> CREATE TABLE `child` (
`id` int DEFAULT NULL,
`parent_id` int DEFAULT NULL,
KEY `par_ind` (`parent_id`),
CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`)
REFERENCES `parent` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci</span></code></pre>
</div>
<p>
You can obtain information about foreign keys from the
Information Schema
<a class="link" href="information-schema-key-column-usage-table.html" title="28.3.16 The INFORMATION_SCHEMA KEY_COLUMN_USAGE Table">
<code class="literal">
KEY_COLUMN_USAGE
</code>
</a>
table. An
example of a query against this table is shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa1566367"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> TABLE_SCHEMA<span class="token punctuation">,</span> <span class="token keyword">TABLE_NAME</span><span class="token punctuation">,</span> <span class="token keyword">COLUMN_NAME</span><span class="token punctuation">,</span> <span class="token keyword">CONSTRAINT_NAME</span>
<span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>KEY_COLUMN_USAGE
<span class="token keyword">WHERE</span> REFERENCED_TABLE_SCHEMA <span class="token operator">IS</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> TABLE_SCHEMA <span class="token punctuation">|</span> TABLE_NAME <span class="token punctuation">|</span> COLUMN_NAME <span class="token punctuation">|</span> CONSTRAINT_NAME <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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 <span class="token punctuation">|</span> child <span class="token punctuation">|</span> parent_id <span class="token punctuation">|</span> child_ibfk_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></code></pre>
</div>
<p>
You can obtain information specific to
<code class="literal">
InnoDB
</code>
foreign keys from the
<a class="link" href="information-schema-innodb-foreign-table.html" title="28.4.12 The INFORMATION_SCHEMA INNODB_FOREIGN Table">
<code class="literal">
INNODB_FOREIGN
</code>
</a>
and
<a class="link" href="information-schema-innodb-foreign-cols-table.html" title="28.4.13 The INFORMATION_SCHEMA INNODB_FOREIGN_COLS Table">
<code class="literal">
INNODB_FOREIGN_COLS
</code>
</a>
tables.
Example queries are show here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15190380"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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_FOREIGN \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> test/child_ibfk_1
FOR_NAME<span class="token punctuation">:</span> test/child
REF_NAME<span class="token punctuation">:</span> test/parent
N_COLS<span class="token punctuation">:</span> 1
TYPE<span class="token punctuation">:</span> 1
</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_FOREIGN_COLS \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> test/child_ibfk_1
FOR_COL_NAME<span class="token punctuation">:</span> parent_id
REF_COL_NAME<span class="token punctuation">:</span> id
POS<span class="token punctuation">:</span> 0</span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="foreign-key-errors">
</a>
Foreign Key Errors
</h5>
</div>
</div>
</div>
<p>
In the event of a foreign key error involving
<code class="literal">
InnoDB
</code>
tables (usually Error 150 in the
MySQL Server), information about the latest foreign key error
can be obtained by checking
<a class="link" href="show-engine.html" title="15.7.7.16 SHOW ENGINE Statement">
<code class="literal">
SHOW ENGINE
INNODB STATUS
</code>
</a>
output.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa55493185"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">ENGINE</span> INNODB <span class="token keyword">STATUS</span>\G
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token comment" spellcheck="true">------------------------</span>
LATEST <span class="token keyword">FOREIGN</span> <span class="token keyword">KEY</span> <span class="token keyword">ERROR</span>
<span class="token comment" spellcheck="true">------------------------</span>
<span class="token number">2018</span><span class="token operator">-</span><span class="token number">04</span><span class="token operator">-</span><span class="token number">12</span> <span class="token number">14</span>:<span class="token number">57</span>:<span class="token number">24</span> <span class="token number">0x7f97a9c91700</span> <span class="token keyword">Transaction</span>:
<span class="token keyword">TRANSACTION</span> <span class="token number">7717</span><span class="token punctuation">,</span> <span class="token keyword">ACTIVE</span> <span class="token number">0</span> sec inserting
mysql <span class="token keyword">tables</span> <span class="token keyword">in</span> <span class="token keyword">use</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token keyword">locked</span> <span class="token number">1</span>
<span class="token number">4</span> <span class="token keyword">lock</span> struct<span class="token punctuation">(</span>s<span class="token punctuation">)</span><span class="token punctuation">,</span> heap size <span class="token number">1136</span><span class="token punctuation">,</span> <span class="token number">3</span> <span class="token keyword">row</span> <span class="token keyword">lock</span><span class="token punctuation">(</span>s<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">undo</span> log entries <span class="token number">3</span>
MySQL thread id <span class="token number">8</span><span class="token punctuation">,</span> OS thread handle <span class="token number">140289365317376</span><span class="token punctuation">,</span> <span class="token keyword">query</span> id <span class="token number">14</span> localhost root <span class="token keyword">update</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> child <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token number">6</span><span class="token punctuation">)</span>
<span class="token keyword">Foreign</span> <span class="token keyword">key</span> <span class="token keyword">constraint</span> fails <span class="token keyword">for</span> <span class="token keyword">table</span> <span class="token punctuation">`</span>test<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>child<span class="token punctuation">`</span>:
<span class="token punctuation">,</span>
<span class="token keyword">CONSTRAINT</span> <span class="token punctuation">`</span>child_ibfk_1<span class="token punctuation">`</span> <span class="token keyword">FOREIGN</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>parent_id<span class="token punctuation">`</span><span class="token punctuation">)</span> <span class="token keyword">REFERENCES</span> <span class="token punctuation">`</span>parent<span class="token punctuation">`</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span><span class="token punctuation">)</span> <span class="token keyword">ON</span> <span class="token keyword">DELETE</span>
<span class="token keyword">CASCADE</span> <span class="token keyword">ON</span> <span class="token keyword">UPDATE</span> <span class="token keyword">CASCADE</span>
Trying <span class="token keyword">to</span> <span class="token keyword">add</span> <span class="token keyword">in</span> child <span class="token keyword">table</span><span class="token punctuation">,</span> <span class="token keyword">in</span> <span class="token keyword">index</span> par_ind tuple:
<span class="token keyword">DATA</span> TUPLE: <span class="token number">2</span> <span class="token keyword">fields</span><span class="token punctuation">;</span>
<span class="token number">0</span>: len <span class="token number">4</span><span class="token punctuation">;</span> hex <span class="token number">80000003</span><span class="token punctuation">;</span> <span class="token keyword">asc</span> <span class="token punctuation">;</span><span class="token punctuation">;</span>
<span class="token number">1</span>: len <span class="token number">4</span><span class="token punctuation">;</span> hex <span class="token number">80000003</span><span class="token punctuation">;</span> <span class="token keyword">asc</span> <span class="token punctuation">;</span><span class="token punctuation">;</span>
But <span class="token keyword">in</span> parent <span class="token keyword">table</span> <span class="token punctuation">`</span>test<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>parent<span class="token punctuation">`</span><span class="token punctuation">,</span> <span class="token keyword">in</span> <span class="token keyword">index</span> <span class="token keyword">PRIMARY</span><span class="token punctuation">,</span>
the closest <span class="token operator">match</span> we can find <span class="token operator">is</span> record:
PHYSICAL RECORD: n_fields <span class="token number">3</span><span class="token punctuation">;</span> <span class="token keyword">compact</span> <span class="token keyword">format</span><span class="token punctuation">;</span> info bits <span class="token number">0</span>
<span class="token number">0</span>: len <span class="token number">4</span><span class="token punctuation">;</span> hex <span class="token number">80000004</span><span class="token punctuation">;</span> <span class="token keyword">asc</span> <span class="token punctuation">;</span><span class="token punctuation">;</span>
<span class="token number">1</span>: len <span class="token number">6</span><span class="token punctuation">;</span> hex <span class="token number">000000001e19</span><span class="token punctuation">;</span> <span class="token keyword">asc</span> <span class="token punctuation">;</span><span class="token punctuation">;</span>
<span class="token number">2</span>: len <span class="token number">7</span><span class="token punctuation">;</span> hex <span class="token number">81000001110137</span><span class="token punctuation">;</span> <span class="token keyword">asc</span> <span class="token number">7</span><span class="token punctuation">;</span><span class="token punctuation">;</span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
</div>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
If a user has table-level privileges for all parent tables,
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_no_referenced_row_2" target="_top">
<code class="literal">
ER_NO_REFERENCED_ROW_2
</code>
</a>
and
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_row_is_referenced_2" target="_top">
<code class="literal">
ER_ROW_IS_REFERENCED_2
</code>
</a>
error
messages for foreign key operations expose information about
parent tables. If a user does not have table-level
privileges for all parent tables, more generic error
messages are displayed instead
(
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_no_referenced_row" target="_top">
<code class="literal">
ER_NO_REFERENCED_ROW
</code>
</a>
and
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_row_is_referenced" target="_top">
<code class="literal">
ER_ROW_IS_REFERENCED
</code>
</a>
).
</p>
<p>
An exception is that, for stored programs defined to execute
with
<code class="literal">
DEFINER
</code>
privileges, the user against
which privileges are assessed is the user in the program
<code class="literal">
DEFINER
</code>
clause, not the invoking user. If
that user has table-level parent table privileges, parent
table information is still displayed. In this case, it is
the responsibility of the stored program creator to hide the
information by including appropriate condition handlers.
</p>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/blob.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="blob">
</a>
13.3.4 The BLOB and TEXT Types
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045212592944">
</a>
<a class="indexterm" name="idm46045212591872">
</a>
<a class="indexterm" name="idm46045212590800">
</a>
<a class="indexterm" name="idm46045212589312">
</a>
<a class="indexterm" name="idm46045212587824">
</a>
<a class="indexterm" name="idm46045212586752">
</a>
<p>
A
<code class="literal">
BLOB
</code>
is a binary large object that can hold
a variable amount of data. The four
<code class="literal">
BLOB
</code>
types are
<code class="literal">
TINYBLOB
</code>
,
<code class="literal">
BLOB
</code>
,
<code class="literal">
MEDIUMBLOB
</code>
, and
<code class="literal">
LONGBLOB
</code>
.
These differ only in the maximum length of the values they can
hold. The four
<code class="literal">
TEXT
</code>
types are
<code class="literal">
TINYTEXT
</code>
,
<code class="literal">
TEXT
</code>
,
<code class="literal">
MEDIUMTEXT
</code>
, and
<code class="literal">
LONGTEXT
</code>
.
These correspond to the four
<code class="literal">
BLOB
</code>
types and
have the same maximum lengths and storage requirements. See
<a class="xref" href="storage-requirements.html" title="13.7 Data Type Storage Requirements">
Section 13.7, “Data Type Storage Requirements”
</a>
.
</p>
<p>
<code class="literal">
BLOB
</code>
values are treated as binary strings
(byte strings). They have the
<code class="literal">
binary
</code>
character set and collation, and comparison and sorting are
based on the numeric values of the bytes in column values.
<code class="literal">
TEXT
</code>
values are treated as nonbinary strings
(character strings). They have a character set other than
<code class="literal">
binary
</code>
, and values are sorted and compared
based on the collation of the character set.
</p>
<p>
If strict SQL mode is not enabled and you assign a value to a
<code class="literal">
BLOB
</code>
or
<code class="literal">
TEXT
</code>
column that
exceeds the column's maximum length, the value is truncated to
fit and a warning is generated. For truncation of nonspace
characters, you can cause an error to occur (rather than a
warning) and suppress insertion of the value by using strict 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>
<p>
Truncation of excess trailing spaces from values to be inserted
into
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
columns always
generates a warning, regardless of the SQL mode.
</p>
<p>
For
<code class="literal">
TEXT
</code>
and
<code class="literal">
BLOB
</code>
columns,
there is no padding on insert and no bytes are stripped on
select.
</p>
<p>
If a
<code class="literal">
TEXT
</code>
column is indexed, index entry
comparisons are space-padded at the end. This means that, if the
index requires unique values, duplicate-key errors occur for
values that differ only in the number of trailing spaces. For
example, if a table contains
<code class="literal">
'a'
</code>
, an attempt
to store
<code class="literal">
'a '
</code>
causes a duplicate-key
error. This is not true for
<code class="literal">
BLOB
</code>
columns.
</p>
<p>
In most respects, you can regard a
<code class="literal">
BLOB
</code>
column as a
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
column that
can be as large as you like. Similarly, you can regard a
<code class="literal">
TEXT
</code>
column as a
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
column.
<code class="literal">
BLOB
</code>
and
<code class="literal">
TEXT
</code>
differ from
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
and
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
in the following ways:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For indexes on
<code class="literal">
BLOB
</code>
and
<code class="literal">
TEXT
</code>
columns, you must specify an index
prefix length. For
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR
</code>
</a>
and
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
, a prefix length is
optional. See
<a class="xref" href="column-indexes.html" title="10.3.5 Column Indexes">
Section 10.3.5, “Column Indexes”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045212546448">
</a>
<a class="indexterm" name="idm46045212544960">
</a>
<a class="indexterm" name="idm46045212543472">
</a>
<code class="literal">
BLOB
</code>
and
<code class="literal">
TEXT
</code>
columns
cannot have
<code class="literal">
DEFAULT
</code>
values.
</p>
</li>
</ul>
</div>
<p>
If you use the
<code class="literal">
BINARY
</code>
attribute with a
<code class="literal">
TEXT
</code>
data type, the column is assigned the
binary (
<code class="literal">
_bin
</code>
) collation of the column
character set.
</p>
<p>
<code class="literal">
LONG
</code>
and
<code class="literal">
LONG VARCHAR
</code>
map
to the
<code class="literal">
MEDIUMTEXT
</code>
data type. This is a
compatibility feature.
</p>
<p>
MySQL Connector/ODBC defines
<code class="literal">
BLOB
</code>
values as
<code class="literal">
LONGVARBINARY
</code>
and
<code class="literal">
TEXT
</code>
values as
<code class="literal">
LONGVARCHAR
</code>
.
</p>
<p>
Because
<code class="literal">
BLOB
</code>
and
<code class="literal">
TEXT
</code>
values can be extremely long, you might encounter some
constraints in using them:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Only the first
<a class="link" href="server-system-variables.html#sysvar_max_sort_length">
<code class="literal">
max_sort_length
</code>
</a>
bytes of
the column are used when sorting. The default value of
<a class="link" href="server-system-variables.html#sysvar_max_sort_length">
<code class="literal">
max_sort_length
</code>
</a>
is 1024.
You can make more bytes significant in sorting or grouping
by increasing the value of
<a class="link" href="server-system-variables.html#sysvar_max_sort_length">
<code class="literal">
max_sort_length
</code>
</a>
at server
startup or runtime. Any client can change the value of its
session
<a class="link" href="server-system-variables.html#sysvar_max_sort_length">
<code class="literal">
max_sort_length
</code>
</a>
variable:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa22958973"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> max_sort_length <span class="token operator">=</span> <span class="token number">2000</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> id<span class="token punctuation">,</span> <span class="token keyword">comment</span> <span class="token keyword">FROM</span> t
<span class="token prompt"> -></span> <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> <span class="token keyword">comment</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Instances of
<code class="literal">
BLOB
</code>
or
<code class="literal">
TEXT
</code>
columns in the result of a query
that is processed using a temporary table causes the server
to use a table on disk rather than in memory because the
<code class="literal">
MEMORY
</code>
storage engine does not support
those data types (see
<a class="xref" href="internal-temporary-tables.html" title="10.4.4 Internal Temporary Table Use in MySQL">
Section 10.4.4, “Internal Temporary Table Use in MySQL”
</a>
). Use of disk
incurs a performance penalty, so include
<code class="literal">
BLOB
</code>
or
<code class="literal">
TEXT
</code>
columns
in the query result only if they are really needed. For
example, avoid using
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT *
</code>
</a>
,
which selects all columns.
</p>
</li>
<li class="listitem">
<p>
The maximum size of a
<code class="literal">
BLOB
</code>
or
<code class="literal">
TEXT
</code>
object is determined by its type,
but the largest value you actually can transmit between the
client and server is determined by the amount of available
memory and the size of the communications buffers. You can
change the message buffer size by changing the value of the
<a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
<code class="literal">
max_allowed_packet
</code>
</a>
variable, but you must do so for both the server and your
client program. For example, both
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
and
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
enable you to change the
client-side
<a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
<code class="literal">
max_allowed_packet
</code>
</a>
value.
See
<a class="xref" href="server-configuration.html" title="7.1.1 Configuring the Server">
Section 7.1.1, “Configuring the Server”
</a>
,
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
, and
<a class="xref" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
Section 6.5.4, “mysqldump — A Database Backup Program”
</a>
.
You may also want to compare the packet sizes and the size
of the data objects you are storing with the storage
requirements, see
<a class="xref" href="storage-requirements.html" title="13.7 Data Type Storage Requirements">
Section 13.7, “Data Type Storage Requirements”
</a>
</p>
</li>
</ul>
</div>
<p>
Each
<code class="literal">
BLOB
</code>
or
<code class="literal">
TEXT
</code>
value is
represented internally by a separately allocated object. This is
in contrast to all other data types, for which storage is
allocated once per column when the table is opened.
</p>
<p>
In some cases, it may be desirable to store binary data such as
media files in
<code class="literal">
BLOB
</code>
or
<code class="literal">
TEXT
</code>
columns. You may find MySQL's string
handling functions useful for working with such data. See
<a class="xref" href="string-functions.html" title="14.8 String Functions and Operators">
Section 14.8, “String Functions and Operators”
</a>
. For security and other
reasons, it is usually preferable to do so using application
code rather than giving application users the
<a class="link" href="privileges-provided.html#priv_file">
<code class="literal">
FILE
</code>
</a>
privilege. You can discuss
specifics for various languages and platforms in the MySQL
Forums (
<a class="ulink" href="http://forums.mysql.com/" target="_blank">
http://forums.mysql.com/
</a>
).
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, binary strings
display using hexadecimal notation, depending on the value of
the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
. For more
information about that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/merge-storage-engine.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="merge-storage-engine">
</a>
18.7 The MERGE Storage Engine
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<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>
</div>
<a class="indexterm" name="idm46045147492704">
</a>
<a class="indexterm" name="idm46045147491664">
</a>
<a class="indexterm" name="idm46045147490176">
</a>
<a class="indexterm" name="idm46045147488688">
</a>
<a class="indexterm" name="idm46045147487200">
</a>
<p>
The
<code class="literal">
MERGE
</code>
storage engine, also known as the
<code class="literal">
MRG_MyISAM
</code>
engine, is a collection of identical
<code class="literal">
MyISAM
</code>
tables that can be used as one.
<span class="quote">
“
<span class="quote">
Identical
</span>
”
</span>
means that all tables have identical column
data types and index information. You cannot merge
<code class="literal">
MyISAM
</code>
tables in which the columns are listed in
a different order, do not have exactly the same data types in
corresponding columns, or have the indexes in different order.
However, any or all of the
<code class="literal">
MyISAM
</code>
tables can be
compressed with
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
. See
<a class="xref" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
Section 6.6.6, “myisampack — Generate Compressed, Read-Only MyISAM Tables”
</a>
. Differences between tables such as
these do not matter:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Names of corresponding columns and indexes can differ.
</p>
</li>
<li class="listitem">
<p>
Comments for tables, columns, and indexes can differ.
</p>
</li>
<li class="listitem">
<p>
Table options such as
<code class="literal">
AVG_ROW_LENGTH
</code>
,
<code class="literal">
MAX_ROWS
</code>
, or
<code class="literal">
PACK_KEYS
</code>
can
differ.
</p>
</li>
</ul>
</div>
<p>
An alternative to a
<code class="literal">
MERGE
</code>
table is a partitioned
table, which stores partitions of a single table in separate files
and enables some operations to be performed more efficiently. For
more information, see
<a class="xref" href="partitioning.html" title="Chapter 26 Partitioning">
Chapter 26,
<i>
Partitioning
</i>
</a>
.
</p>
<p>
When you create a
<code class="literal">
MERGE
</code>
table, MySQL creates a
<code class="filename">
.MRG
</code>
file on disk that contains the names of
the underlying
<code class="literal">
MyISAM
</code>
tables that should be used
as one. The table format of the
<code class="literal">
MERGE
</code>
table is
stored in the MySQL data dictionary. The underlying tables do not
have to be in the same database as the
<code class="literal">
MERGE
</code>
table.
</p>
<p>
You can use
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
,
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
,
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
, and
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
on
<code class="literal">
MERGE
</code>
tables. You must have
<a class="link" href="privileges-provided.html#priv_select">
<code class="literal">
SELECT
</code>
</a>
,
<a class="link" href="privileges-provided.html#priv_delete">
<code class="literal">
DELETE
</code>
</a>
, and
<a class="link" href="privileges-provided.html#priv_update">
<code class="literal">
UPDATE
</code>
</a>
privileges on the
<code class="literal">
MyISAM
</code>
tables that you map to a
<code class="literal">
MERGE
</code>
table.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The use of
<code class="literal">
MERGE
</code>
tables entails the following
security issue: If a user has access to
<code class="literal">
MyISAM
</code>
table
<em class="replaceable">
<code>
t
</code>
</em>
, that user can create a
<code class="literal">
MERGE
</code>
table
<em class="replaceable">
<code>
m
</code>
</em>
that
accesses
<em class="replaceable">
<code>
t
</code>
</em>
. However, if the user's
privileges on
<em class="replaceable">
<code>
t
</code>
</em>
are subsequently
revoked, the user can continue to access
<em class="replaceable">
<code>
t
</code>
</em>
by doing so through
<em class="replaceable">
<code>
m
</code>
</em>
.
</p>
</div>
<p>
Use of
<a class="link" href="drop-table.html" title="15.1.32 DROP TABLE Statement">
<code class="literal">
DROP TABLE
</code>
</a>
with a
<code class="literal">
MERGE
</code>
table drops only the
<code class="literal">
MERGE
</code>
specification. The underlying tables are
not affected.
</p>
<p>
To create a
<code class="literal">
MERGE
</code>
table, you must specify a
<code class="literal">
UNION=(
<em class="replaceable">
<code>
list-of-tables
</code>
</em>
)
</code>
option that indicates which
<code class="literal">
MyISAM
</code>
tables to use.
You can optionally specify an
<code class="literal">
INSERT_METHOD
</code>
option to control how inserts into the
<code class="literal">
MERGE
</code>
table take place. Use a value of
<code class="literal">
FIRST
</code>
or
<code class="literal">
LAST
</code>
to cause inserts to be made in the first or
last underlying table, respectively. If you specify no
<code class="literal">
INSERT_METHOD
</code>
option or if you specify it with a
value of
<code class="literal">
NO
</code>
, inserts into the
<code class="literal">
MERGE
</code>
table are not permitted and attempts to do
so result in an error.
</p>
<p>
The following example shows how to create a
<code class="literal">
MERGE
</code>
table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa6833634"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">AUTO_INCREMENT</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> message <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>MyISAM<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t2 <span class="token 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">AUTO_INCREMENT</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> message <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>MyISAM<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t1 <span class="token punctuation">(</span>message<span class="token punctuation">)</span> <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token string">'Testing'</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token string">'table'</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token string">'t1'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t2 <span class="token punctuation">(</span>message<span class="token punctuation">)</span> <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token string">'Testing'</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token string">'table'</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token string">'t2'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> total <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">AUTO_INCREMENT</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> message <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">INDEX</span><span class="token punctuation">(</span>a<span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token keyword">ENGINE</span><span class="token operator">=</span><span class="token keyword">MERGE</span> <span class="token keyword">UNION</span><span class="token operator">=</span><span class="token punctuation">(</span>t1<span class="token punctuation">,</span>t2<span class="token punctuation">)</span> <span class="token keyword">INSERT_METHOD</span><span class="token operator">=</span><span class="token keyword">LAST</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Column
<code class="literal">
a
</code>
is indexed as a
<code class="literal">
PRIMARY
KEY
</code>
in the underlying
<code class="literal">
MyISAM
</code>
tables,
but not in the
<code class="literal">
MERGE
</code>
table. There it is indexed
but not as a
<code class="literal">
PRIMARY KEY
</code>
because a
<code class="literal">
MERGE
</code>
table cannot enforce uniqueness over the
set of underlying tables. (Similarly, a column with a
<code class="literal">
UNIQUE
</code>
index in the underlying tables should be
indexed in the
<code class="literal">
MERGE
</code>
table but not as a
<code class="literal">
UNIQUE
</code>
index.)
</p>
<p>
After creating the
<code class="literal">
MERGE
</code>
table, you can use it to
issue queries that operate on the group of tables as a whole:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa35503054"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> total<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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> message <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> Testing <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> table <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> t1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> Testing <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> table <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> t2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 remap a
<code class="literal">
MERGE
</code>
table to a different collection
of
<code class="literal">
MyISAM
</code>
tables, you can use one of the
following methods:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
DROP
</code>
the
<code class="literal">
MERGE
</code>
table and
re-create it.
</p>
</li>
<li class="listitem">
<p>
Use
<code class="literal">
ALTER TABLE
<em class="replaceable">
<code>
tbl_name
</code>
</em>
UNION=(...)
</code>
to change the list of underlying tables.
</p>
<p>
It is also possible to use
<code class="literal">
ALTER TABLE ...
UNION=()
</code>
(that is, with an empty
<a class="link" href="union.html" title="15.2.18 UNION Clause">
<code class="literal">
UNION
</code>
</a>
clause) to remove all of
the underlying tables. However, in this case, the table is
effectively empty and inserts fail because there is no
underlying table to take new rows. Such a table might be useful
as a template for creating new
<code class="literal">
MERGE
</code>
tables
with
<a class="link" href="create-table-like.html" title="15.1.20.3 CREATE TABLE ... LIKE Statement">
<code class="literal">
CREATE
TABLE ... LIKE
</code>
</a>
.
</p>
</li>
</ul>
</div>
<p>
The underlying table definitions and indexes must conform closely to
the definition of the
<code class="literal">
MERGE
</code>
table. Conformance is
checked when a table that is part of a
<code class="literal">
MERGE
</code>
table is opened, not when the
<code class="literal">
MERGE
</code>
table is
created. If any table fails the conformance checks, the operation
that triggered the opening of the table fails. This means that
changes to the definitions of tables within a
<code class="literal">
MERGE
</code>
may cause a failure when the
<code class="literal">
MERGE
</code>
table is accessed. The conformance checks
applied to each table are:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The underlying table and the
<code class="literal">
MERGE
</code>
table must
have the same number of columns.
</p>
</li>
<li class="listitem">
<p>
The column order in the underlying table and the
<code class="literal">
MERGE
</code>
table must match.
</p>
</li>
<li class="listitem">
<p>
Additionally, the specification for each corresponding column in
the parent
<code class="literal">
MERGE
</code>
table and the underlying
tables are compared and must satisfy these checks:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The column type in the underlying table and the
<code class="literal">
MERGE
</code>
table must be equal.
</p>
</li>
<li class="listitem">
<p>
The column length in the underlying table and the
<code class="literal">
MERGE
</code>
table must be equal.
</p>
</li>
<li class="listitem">
<p>
The column of the underlying table and the
<code class="literal">
MERGE
</code>
table can be
<code class="literal">
NULL
</code>
.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
The underlying table must have at least as many indexes as the
<code class="literal">
MERGE
</code>
table. The underlying table may have
more indexes than the
<code class="literal">
MERGE
</code>
table, but cannot
have fewer.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
A known issue exists where indexes on the same columns must be
in identical order, in both the
<code class="literal">
MERGE
</code>
table
and the underlying
<code class="literal">
MyISAM
</code>
table. See Bug
#33653.
</p>
</div>
<p>
Each index must satisfy these checks:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The index type of the underlying table and the
<code class="literal">
MERGE
</code>
table must be the same.
</p>
</li>
<li class="listitem">
<p>
The number of index parts (that is, multiple columns within
a compound index) in the index definition for the underlying
table and the
<code class="literal">
MERGE
</code>
table must be the
same.
</p>
</li>
<li class="listitem">
<p>
For each index part:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: square; ">
<li class="listitem">
<p>
Index part lengths must be equal.
</p>
</li>
<li class="listitem">
<p>
Index part types must be equal.
</p>
</li>
<li class="listitem">
<p>
Index part languages must be equal.
</p>
</li>
<li class="listitem">
<p>
Check whether index parts can be
<code class="literal">
NULL
</code>
.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
If a
<code class="literal">
MERGE
</code>
table cannot be opened or used because
of a problem with an underlying table,
<a class="link" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
<code class="literal">
CHECK
TABLE
</code>
</a>
displays information about which table caused the
problem.
</p>
<h3>
<a name="idm46045147371600">
</a>
Additional Resources
</h3>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A forum dedicated to the
<code class="literal">
MERGE
</code>
storage engine
is available at
<a class="ulink" href="https://forums.mysql.com/list.php?93" target="_blank">
https://forums.mysql.com/list.php?93
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-migration.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="innodb-migration">
</a>
17.6.1.4 Moving or Copying InnoDB Tables
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045166455952">
</a>
<p>
This section describes techniques for moving or copying some or all
<code class="literal">
InnoDB
</code>
tables to a different server or instance.
For example, you might move an entire MySQL instance to a larger,
faster server; you might clone an entire MySQL instance to a new
replica server; you might copy individual tables to another instance
to develop and test an application, or to a data warehouse server to
produce reports.
</p>
<p>
On Windows,
<code class="literal">
InnoDB
</code>
always stores database and
table names internally in lowercase. To move databases in a binary
format from Unix to Windows or from Windows to Unix, create all
databases and tables using lowercase names. A convenient way to
accomplish this is to add the following line to the
<code class="literal">
[mysqld]
</code>
section of your
<code class="filename">
my.cnf
</code>
or
<code class="filename">
my.ini
</code>
file
before creating any databases or tables:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa14488972"><div class="copy-help left">Press ⌘+C to 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">lower_case_table_names</span><span class="token attr-value"><span class="token punctuation">=</span>1</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
It is prohibited to start the server with a
<a class="link" href="server-system-variables.html#sysvar_lower_case_table_names">
<code class="literal">
lower_case_table_names
</code>
</a>
setting
that is different from the setting used when the server was
initialized.
</p>
</div>
<p>
Techniques for moving or copying
<code class="literal">
InnoDB
</code>
tables
include:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="innodb-migration.html#copy-tables-import" title="Importing Tables">
Importing Tables
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-migration.html#copy-tables-meb" title="MySQL Enterprise Backup">
MySQL Enterprise Backup
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-migration.html#copy-tables-cold-backup" title="Copying Data Files (Cold Backup Method)">
Copying Data Files (Cold Backup Method)
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-migration.html#copy-tables-logical-backup" title="Restoring from a Logical Backup">
Restoring from a Logical Backup
</a>
</p>
</li>
</ul>
</div>
<h5>
<a name="copy-tables-import">
</a>
Importing Tables
</h5>
<p>
A table that resides in a file-per-table tablespace can be imported
from another MySQL server instance or from a backup using the
<span class="emphasis">
<em>
Transportable Tablespace
</em>
</span>
feature. See
<a class="xref" href="innodb-table-import.html" title="17.6.1.3 Importing InnoDB Tables">
Section 17.6.1.3, “Importing InnoDB Tables”
</a>
.
</p>
<h5>
<a name="copy-tables-meb">
</a>
MySQL Enterprise Backup
</h5>
<p>
The MySQL Enterprise Backup product lets you back up a running MySQL database with
minimal disruption to operations while producing a consistent
snapshot of the database. When MySQL Enterprise Backup is copying tables, reads and
writes can continue. In addition, MySQL Enterprise Backup can create compressed backup
files, and back up subsets of tables. In conjunction with the MySQL
binary log, you can perform point-in-time recovery. MySQL Enterprise Backup is
included as part of the MySQL Enterprise subscription.
</p>
<p>
For more details about MySQL Enterprise Backup, see
<a class="xref" href="mysql-enterprise-backup.html" title="32.1 MySQL Enterprise Backup Overview">
Section 32.1, “MySQL Enterprise Backup Overview”
</a>
.
</p>
<h5>
<a name="copy-tables-cold-backup">
</a>
Copying Data Files (Cold Backup Method)
</h5>
<p>
You can move an
<code class="literal">
InnoDB
</code>
database simply by copying
all the relevant files listed under "Cold Backups" in
<a class="xref" href="innodb-backup.html" title="17.18.1 InnoDB Backup">
Section 17.18.1, “InnoDB Backup”
</a>
.
</p>
<p>
<code class="literal">
InnoDB
</code>
data and log files are binary-compatible
on all platforms having the same floating-point number format. If
the floating-point formats differ but you have not used
<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>
data types in your tables,
then the procedure is the same: simply copy the relevant files.
</p>
<p>
When you move or copy file-per-table
<code class="filename">
.ibd
</code>
files, the database directory name must be the same on the source
and destination systems. The table definition stored in the
<code class="literal">
InnoDB
</code>
shared tablespace includes the database
name. The transaction IDs and log sequence numbers stored in the
tablespace files also differ between databases.
</p>
<p>
To move an
<code class="filename">
.ibd
</code>
file and the associated table
from one database to another, use a
<a class="link" href="rename-table.html" title="15.1.36 RENAME TABLE Statement">
<code class="literal">
RENAME
TABLE
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa34828986"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">RENAME</span> <span class="token keyword">TABLE</span> <em class="replaceable">db1<span class="token punctuation">.</span>tbl_name</em> <span class="token keyword">TO</span> <em class="replaceable">db2<span class="token punctuation">.</span>tbl_name</em><span class="token punctuation">;</span></code></pre>
</div>
<a class="indexterm" name="idm46045166421328">
</a>
<a class="indexterm" name="idm46045166420256">
</a>
<p>
If you have a
<span class="quote">
“
<span class="quote">
clean
</span>
”
</span>
backup of an
<code class="filename">
.ibd
</code>
file, you can restore it to the MySQL
installation from which it originated as follows:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
The table must not have been dropped or truncated since you
copied the
<code class="filename">
.ibd
</code>
file, because doing so
changes the table ID stored inside the tablespace.
</p>
</li>
<li class="listitem">
<p>
Issue this
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statement
to delete the current
<code class="filename">
.ibd
</code>
file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa59903192"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">DISCARD</span> <span class="token keyword">TABLESPACE</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Copy the backup
<code class="filename">
.ibd
</code>
file to the proper
database directory.
</p>
</li>
<li class="listitem">
<p>
Issue this
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statement
to tell
<code class="literal">
InnoDB
</code>
to use the new
<code class="filename">
.ibd
</code>
file for the table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa47521922"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">IMPORT</span> <span class="token keyword">TABLESPACE</span><span class="token punctuation">;</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
... IMPORT TABLESPACE
</code>
</a>
feature does not enforce
foreign key constraints on imported data.
</p>
</div>
</li>
</ol>
</div>
<p>
In this context, a
<span class="quote">
“
<span class="quote">
clean
</span>
”
</span>
<code class="filename">
.ibd
</code>
file backup is one for which the following requirements are
satisfied:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
There are no uncommitted modifications by transactions in the
<code class="filename">
.ibd
</code>
file.
</p>
</li>
<li class="listitem">
<p>
There are no unmerged insert buffer entries in the
<code class="filename">
.ibd
</code>
file.
</p>
</li>
<li class="listitem">
<p>
Purge has removed all delete-marked index records from the
<code class="filename">
.ibd
</code>
file.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
has flushed all modified pages of the
<code class="filename">
.ibd
</code>
file from the buffer pool to the file.
</p>
</li>
</ul>
</div>
<p>
You can make a clean backup
<code class="filename">
.ibd
</code>
file using the
following method:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Stop all activity from the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server and
commit all transactions.
</p>
</li>
<li class="listitem">
<p>
Wait until
<a class="link" href="show-engine.html" title="15.7.7.16 SHOW ENGINE Statement">
<code class="literal">
SHOW
ENGINE INNODB STATUS
</code>
</a>
shows that there are no active
transactions in the database, and the main thread status of
<code class="literal">
InnoDB
</code>
is
<code class="literal">
Waiting for server
activity
</code>
. Then you can make a copy of the
<code class="filename">
.ibd
</code>
file.
</p>
</li>
</ol>
</div>
<p>
Another method for making a clean copy of an
<code class="filename">
.ibd
</code>
file is to use the MySQL Enterprise Backup product:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Use MySQL Enterprise Backup to back up the
<code class="literal">
InnoDB
</code>
installation.
</p>
</li>
<li class="listitem">
<p>
Start a second
<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 backup
and let it clean up the
<code class="filename">
.ibd
</code>
files in the
backup.
</p>
</li>
</ol>
</div>
<h5>
<a name="copy-tables-logical-backup">
</a>
Restoring from a Logical Backup
</h5>
<p>
You can use a utility such as
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
to
perform a logical backup, which produces a set of SQL statements
that can be executed to reproduce the original database object
definitions and table data for transfer to another SQL server. Using
this method, it does not matter whether the formats differ or if
your tables contain floating-point data.
</p>
<p>
To improve the performance of this method, disable
<a class="link" href="server-system-variables.html#sysvar_autocommit">
<code class="literal">
autocommit
</code>
</a>
when importing data.
Perform a commit only after importing an entire table or segment of
a table.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-replication-failover.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-replication-failover">
</a>
25.7.8 Implementing Failover with NDB Cluster Replication
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045086002880">
</a>
<a class="indexterm" name="idm46045086001392">
</a>
<p>
In the event that the primary Cluster replication process fails,
it is possible to switch over to the secondary replication
channel. The following procedure describes the steps required to
accomplish this.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
<a class="indexterm" name="idm46045085997984">
</a>
<a class="indexterm" name="idm46045085996880">
</a>
Obtain the time of the most recent global checkpoint (GCP).
That is, you need to determine the most recent epoch from the
<code class="literal">
ndb_apply_status
</code>
table on the replica
cluster, which can be found using the following query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa76617850"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql">mysql<em class="replaceable">R'</em><span class="token operator">></span> <span class="token keyword">SELECT</span> <span class="token variable">@latest</span><span class="token operator">:=</span><span class="token function">MAX</span><span class="token punctuation">(</span>epoch<span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> mysql<span class="token punctuation">.</span>ndb_apply_status<span class="token punctuation">;</span></code></pre>
</div>
<p>
In a circular replication topology, with a source and a
replica running on each host, when you are using
<a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_log_apply_status">
<code class="literal">
ndb_log_apply_status=1
</code>
</a>
, NDB
Cluster epochs are written in the replicas' binary logs.
This means that the
<code class="literal">
ndb_apply_status
</code>
table
contains information for the replica on this host as well as
for any other host which acts as a replica of the replication
source server running on this host.
</p>
<p>
In this case, you need to determine the latest epoch on this
replica to the exclusion of any epochs from any other replicas
in this replica's binary log that were not listed in the
<code class="literal">
IGNORE_SERVER_IDS
</code>
options of the
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE REPLICATION SOURCE TO
</code>
</a>
statement used to set up this replica. The reason for
excluding such epochs is that rows in the
<code class="literal">
mysql.ndb_apply_status
</code>
table whose server
IDs have a match in the
<code class="literal">
IGNORE_SERVER_IDS
</code>
list from 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 used to prepare this replicas's
source are also considered to be from local servers, in
addition to those having the replica's own server ID. You
can retrieve this list as
<code class="literal">
Replicate_Ignore_Server_Ids
</code>
from the output
of
<a class="link" href="show-replica-status.html" title="15.7.7.35 SHOW REPLICA STATUS Statement">
<code class="literal">
SHOW REPLICA STATUS
</code>
</a>
. We
assume that you have obtained this list and are substituting
it for
<em class="replaceable">
<code>
ignore_server_ids
</code>
</em>
in the
query shown here, which like the previous version of the
query, selects the greatest epoch into a variable named
<code class="literal">
@latest
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa87911278"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql">mysql<em class="replaceable">R'</em><span class="token operator">></span> <span class="token keyword">SELECT</span> <span class="token variable">@latest</span><span class="token operator">:=</span><span class="token function">MAX</span><span class="token punctuation">(</span>epoch<span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> mysql<span class="token punctuation">.</span>ndb_apply_status
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> server_id <span class="token operator">NOT</span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token keyword"><em class="replaceable">ignore_server_ids</em></span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
In some cases, it may be simpler or more efficient (or both)
to use a list of the server IDs to be included and
<code class="literal">
server_id IN
<em class="replaceable">
<code>
server_id_list
</code>
</em>
</code>
in the
<code class="literal">
WHERE
</code>
condition of the preceding query.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045085973120">
</a>
Using the information obtained from the query shown in Step 1,
obtain the corresponding records from the
<code class="literal">
ndb_binlog_index
</code>
table on the source
cluster.
</p>
<p>
You can use the following query to obtain the needed records
from the
<code class="literal">
ndb_binlog_index
</code>
table on the
source:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa97054576"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql<em class="replaceable">S'</em>></span> <span class="token keyword">SELECT</span>
<span class="token prompt"> -></span> <span class="token variable">@file</span><span class="token operator">:=</span><span class="token function">SUBSTRING_INDEX</span><span class="token punctuation">(</span>next_file<span class="token punctuation">,</span> <span class="token string">'/'</span><span class="token punctuation">,</span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token variable">@pos</span><span class="token operator">:=</span>next_position
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> mysql<span class="token punctuation">.</span>ndb_binlog_index
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> epoch <span class="token operator">=</span> <span class="token variable">@latest</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
These are the records saved on the source since the failure of
the primary replication channel. We have employed a user
variable
<code class="literal">
@latest
</code>
here to represent the
value obtained in Step 1. Of course, it is not possible for
one
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
instance to access user
variables set on another server instance directly. These
values must be
<span class="quote">
“
<span class="quote">
plugged in
</span>
”
</span>
to the second query
manually or by an application.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
You must ensure that the replica
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
is started with
<a class="link" href="replication-options-replica.html#sysvar_replica_skip_errors">
<code class="option">
--replica-skip-errors=ddl_exist_errors
</code>
</a>
before executing
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START
REPLICA
</code>
</a>
. Otherwise, replication may stop with
duplicate DDL errors.
</p>
</div>
</li>
<li class="listitem">
<p>
Now it is possible to synchronize the secondary channel by
running the following query on the secondary replica server:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa29860787"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql">mysql<em class="replaceable">R<span class="token string">'</span></em><span class="token string">> CHANGE REPLICATION SOURCE TO
-> SOURCE_LOG_FILE='</span><span class="token variable">@file</span>'<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token keyword">SOURCE_LOG_POS</span><span class="token operator">=</span><span class="token variable">@pos</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Again we have employed user variables (in this case
<code class="literal">
@file
</code>
and
<code class="literal">
@pos
</code>
) to
represent the values obtained in Step 2 and applied in Step 3;
in practice these values must be inserted manually or using an
application that can access both of the servers involved.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<code class="literal">
@file
</code>
is a string value such as
<code class="literal">
'/var/log/mysql/replication-source-bin.00001'
</code>
,
and so must be quoted when used in SQL or application code.
However, the value represented by
<code class="literal">
@pos
</code>
must
<span class="emphasis">
<em>
not
</em>
</span>
be quoted. Although MySQL
normally attempts to convert strings to numbers, this case
is an exception.
</p>
</div>
</li>
<li class="listitem">
<p>
You can now initiate replication on the secondary channel by
issuing the appropriate command on the secondary replica
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa35445594"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql">mysql<em class="replaceable">R'</em><span class="token operator">></span> <span class="token keyword">START</span> <span class="token keyword">REPLICA</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ol>
</div>
<p>
Once the secondary replication channel is active, you can
investigate the failure of the primary and effect repairs. The
precise actions required to do this depend upon the reasons for
which the primary channel failed.
</p>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
The secondary replication channel is to be started only if and
when the primary replication channel has failed. Running
multiple replication channels simultaneously can result in
unwanted duplicate records being created on the replicas.
</p>
</div>
<p>
If the failure is limited to a single server, it should in theory
be possible to replicate from
<em class="replaceable">
<code>
S
</code>
</em>
to
<em class="replaceable">
<code>
R'
</code>
</em>
, or from
<em class="replaceable">
<code>
S'
</code>
</em>
to
<em class="replaceable">
<code>
R
</code>
</em>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-system-variables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="performance-schema-system-variables">
</a>
29.15 Performance Schema System Variables
</h2>
</div>
</div>
</div>
<p>
The Performance Schema implements several system variables that
provide configuration information:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa37783118"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">'perf%'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 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>
<span class="token output"><span class="token punctuation">|</span> performance_schema <span class="token punctuation">|</span> ON <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_accounts_size <span class="token punctuation">|</span> <span class="token punctuation">-</span>1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_digests_size <span class="token punctuation">|</span> 10000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_error_size <span class="token punctuation">|</span> 5377 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_events_stages_history_long_size <span class="token punctuation">|</span> 10000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_events_stages_history_size <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_events_statements_history_long_size <span class="token punctuation">|</span> 10000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_events_statements_history_size <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_events_transactions_history_long_size <span class="token punctuation">|</span> 10000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_events_transactions_history_size <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_events_waits_history_long_size <span class="token punctuation">|</span> 10000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_events_waits_history_size <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_hosts_size <span class="token punctuation">|</span> <span class="token punctuation">-</span>1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_cond_classes <span class="token punctuation">|</span> 150 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_cond_instances <span class="token punctuation">|</span> <span class="token punctuation">-</span>1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_digest_length <span class="token punctuation">|</span> 1024 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_digest_sample_age <span class="token punctuation">|</span> 60 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_file_classes <span class="token punctuation">|</span> 80 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_file_handles <span class="token punctuation">|</span> 32768 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_file_instances <span class="token punctuation">|</span> <span class="token punctuation">-</span>1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_index_stat <span class="token punctuation">|</span> <span class="token punctuation">-</span>1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_memory_classes <span class="token punctuation">|</span> 470 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_metadata_locks <span class="token punctuation">|</span> <span class="token punctuation">-</span>1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_meter_classes <span class="token punctuation">|</span> 30 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_metric_classes <span class="token punctuation">|</span> 600 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_mutex_classes <span class="token punctuation">|</span> 350 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_mutex_instances <span class="token punctuation">|</span> <span class="token punctuation">-</span>1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_prepared_statements_instances <span class="token punctuation">|</span> <span class="token punctuation">-</span>1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_program_instances <span class="token punctuation">|</span> <span class="token punctuation">-</span>1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_rwlock_classes <span class="token punctuation">|</span> 100 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_rwlock_instances <span class="token punctuation">|</span> <span class="token punctuation">-</span>1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_socket_classes <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_socket_instances <span class="token punctuation">|</span> <span class="token punctuation">-</span>1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_sql_text_length <span class="token punctuation">|</span> 1024 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_stage_classes <span class="token punctuation">|</span> 175 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_statement_classes <span class="token punctuation">|</span> 220 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_statement_stack <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_table_handles <span class="token punctuation">|</span> <span class="token punctuation">-</span>1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_table_instances <span class="token punctuation">|</span> <span class="token punctuation">-</span>1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_table_lock_stat <span class="token punctuation">|</span> <span class="token punctuation">-</span>1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_thread_classes <span class="token punctuation">|</span> 100 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_max_thread_instances <span class="token punctuation">|</span> <span class="token punctuation">-</span>1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_session_connect_attrs_size <span class="token punctuation">|</span> 512 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_setup_actors_size <span class="token punctuation">|</span> <span class="token punctuation">-</span>1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_setup_objects_size <span class="token punctuation">|</span> <span class="token punctuation">-</span>1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_show_processlist <span class="token punctuation">|</span> OFF <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> performance_schema_users_size <span class="token punctuation">|</span> <span class="token punctuation">-</span>1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
Performance Schema system variables can be set at server startup
on the command line or in option files, and many can be set at
runtime. See
<a class="xref" href="performance-schema-option-variable-reference.html" title="29.13 Performance Schema Option and Variable Reference">
Section 29.13, “Performance Schema Option and Variable Reference”
</a>
.
</p>
<p>
The Performance Schema automatically sizes the values of several
of its parameters at server startup if they are not set
explicitly. For more information, see
<a class="xref" href="performance-schema-startup-configuration.html" title="29.3 Performance Schema Startup Configuration">
Section 29.3, “Performance Schema Startup Configuration”
</a>
.
</p>
<p>
Performance Schema system variables have the following meanings:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="sysvar_performance_schema">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema">
<code class="literal">
performance_schema
</code>
</a>
</p>
<a class="indexterm" name="idm46045066140320">
</a>
<a class="indexterm" name="idm46045066139280">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema[={OFF|ON}]
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema">
performance_schema
</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>
Boolean
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
ON
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The value of this variable is
<code class="literal">
ON
</code>
or
<code class="literal">
OFF
</code>
to indicate whether the Performance
Schema is enabled. By default, the value is
<code class="literal">
ON
</code>
. At server startup, you can specify this
variable with no value or a value of
<code class="literal">
ON
</code>
or
1 to enable it, or with a value of
<code class="literal">
OFF
</code>
or 0
to disable it.
</p>
<p>
Even when the Performance Schema is disabled, it continues to
populate the
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
global_variables
</code>
</a>
,
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
session_variables
</code>
</a>
,
<a class="link" href="performance-schema-status-variable-tables.html" title="29.12.15 Performance Schema Status Variable Tables">
<code class="literal">
global_status
</code>
</a>
, and
<a class="link" href="performance-schema-status-variable-tables.html" title="29.12.15 Performance Schema Status Variable Tables">
<code class="literal">
session_status
</code>
</a>
tables. This
occurs as necessary to permit the results for the
<a class="link" href="show-variables.html" title="15.7.7.41 SHOW VARIABLES Statement">
<code class="literal">
SHOW VARIABLES
</code>
</a>
and
<a class="link" href="show-status.html" title="15.7.7.37 SHOW STATUS Statement">
<code class="literal">
SHOW STATUS
</code>
</a>
statements to be
drawn from those tables. The Performance Schema also populates
some of the replication tables when disabled.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_accounts_size">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_accounts_size">
<code class="literal">
performance_schema_accounts_size
</code>
</a>
</p>
<a class="indexterm" name="idm46045066102720">
</a>
<a class="indexterm" name="idm46045066101616">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_accounts_size">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-accounts-size=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_accounts_size">
performance_schema_accounts_size
</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">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The number of rows in the
<a class="link" href="performance-schema-accounts-table.html" title="29.12.8.1 The accounts Table">
<code class="literal">
accounts
</code>
</a>
table. If this variable
is 0, the Performance Schema does not maintain connection
statistics in the
<a class="link" href="performance-schema-accounts-table.html" title="29.12.8.1 The accounts Table">
<code class="literal">
accounts
</code>
</a>
table
or status variable information in the
<a class="link" href="performance-schema-status-variable-summary-tables.html" title="29.12.20.12 Status Variable Summary Tables">
<code class="literal">
status_by_account
</code>
</a>
table.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_digests_size">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_digests_size">
<code class="literal">
performance_schema_digests_size
</code>
</a>
</p>
<a class="indexterm" name="idm46045066067744">
</a>
<a class="indexterm" name="idm46045066066640">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_digests_size">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-digests-size=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_digests_size">
performance_schema_digests_size
</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">
-1
</code>
(signifies autosizing; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of rows in the
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_digest
</code>
</a>
table. If this maximum is exceeded such that a digest cannot
be instrumented, the Performance Schema increments the
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_digest_lost">
<code class="literal">
Performance_schema_digest_lost
</code>
</a>
status variable.
</p>
<p>
For more information about statement digesting, see
<a class="xref" href="performance-schema-statement-digests.html" title="29.10 Performance Schema Statement Digests and Sampling">
Section 29.10, “Performance Schema Statement Digests and Sampling”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_error_size">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_error_size">
<code class="literal">
performance_schema_error_size
</code>
</a>
</p>
<a class="indexterm" name="idm46045066032832">
</a>
<a class="indexterm" name="idm46045066031728">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_error_size">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-error-size=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_error_size">
performance_schema_error_size
</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">
number of server error codes
</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">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The number of instrumented server error codes. The default
value is the actual number of server error codes. Although the
value can be set anywhere from 0 to its maximum, the intended
use is to set it to either its default (to instrument all
errors) or 0 (to instrument no errors).
</p>
<p>
Error information is aggregated in summary tables; see
<a class="xref" href="performance-schema-error-summary-tables.html" title="29.12.20.11 Error Summary Tables">
Section 29.12.20.11, “Error Summary Tables”
</a>
. If
an error occurs that is not instrumented, information for the
occurrence is aggregated to the
<code class="literal">
NULL
</code>
row in
each summary table; that is, to the row with
<code class="literal">
ERROR_NUMBER=0
</code>
,
<code class="literal">
ERROR_NAME=NULL
</code>
, and
<code class="literal">
SQLSTATE=NULL
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_events_stages_history_long_size">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_events_stages_history_long_size">
<code class="literal">
performance_schema_events_stages_history_long_size
</code>
</a>
</p>
<a class="indexterm" name="idm46045065997536">
</a>
<a class="indexterm" name="idm46045065996496">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_events_stages_history_long_size">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-events-stages-history-long-size=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_events_stages_history_long_size">
performance_schema_events_stages_history_long_size
</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">
-1
</code>
(signifies autosizing; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The number of rows in the
<a class="link" href="performance-schema-events-stages-history-long-table.html" title="29.12.5.3 The events_stages_history_long Table">
<code class="literal">
events_stages_history_long
</code>
</a>
table.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_events_stages_history_size">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_events_stages_history_size">
<code class="literal">
performance_schema_events_stages_history_size
</code>
</a>
</p>
<a class="indexterm" name="idm46045065965088">
</a>
<a class="indexterm" name="idm46045065963968">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_events_stages_history_size">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-events-stages-history-size=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_events_stages_history_size">
performance_schema_events_stages_history_size
</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">
-1
</code>
(signifies autosizing; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1024
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The number of rows per thread in the
<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>
table.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_events_statements_history_long_size">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_events_statements_history_long_size">
<code class="literal">
performance_schema_events_statements_history_long_size
</code>
</a>
</p>
<a class="indexterm" name="idm46045065932448">
</a>
<a class="indexterm" name="idm46045065931408">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_events_statements_history_long_size">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-events-statements-history-long-size=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_events_statements_history_long_size">
performance_schema_events_statements_history_long_size
</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">
-1
</code>
(signifies autosizing; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The number of rows in the
<a class="link" href="performance-schema-events-statements-history-long-table.html" title="29.12.6.3 The events_statements_history_long Table">
<code class="literal">
events_statements_history_long
</code>
</a>
table.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_events_statements_history_size">
</a>
<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>
</p>
<a class="indexterm" name="idm46045065899888">
</a>
<a class="indexterm" name="idm46045065898848">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_events_statements_history_size">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-events-statements-history-size=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_events_statements_history_size">
performance_schema_events_statements_history_size
</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">
-1
</code>
(signifies autosizing; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1024
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The number of rows per thread in 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.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_events_transactions_history_long_size">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_events_transactions_history_long_size">
<code class="literal">
performance_schema_events_transactions_history_long_size
</code>
</a>
</p>
<a class="indexterm" name="idm46045065867408">
</a>
<a class="indexterm" name="idm46045065866272">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_events_transactions_history_long_size">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-events-transactions-history-long-size=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_events_transactions_history_long_size">
performance_schema_events_transactions_history_long_size
</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">
-1
</code>
(signifies autosizing; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The number of rows in the
<a class="link" href="performance-schema-events-transactions-history-long-table.html" title="29.12.7.3 The events_transactions_history_long Table">
<code class="literal">
events_transactions_history_long
</code>
</a>
table.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_events_transactions_history_size">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_events_transactions_history_size">
<code class="literal">
performance_schema_events_transactions_history_size
</code>
</a>
</p>
<a class="indexterm" name="idm46045065834624">
</a>
<a class="indexterm" name="idm46045065833584">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_events_transactions_history_size">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-events-transactions-history-size=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_events_transactions_history_size">
performance_schema_events_transactions_history_size
</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">
-1
</code>
(signifies autosizing; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1024
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The number of rows per thread in the
<a class="link" href="performance-schema-events-transactions-history-table.html" title="29.12.7.2 The events_transactions_history Table">
<code class="literal">
events_transactions_history
</code>
</a>
table.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_events_waits_history_long_size">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_events_waits_history_long_size">
<code class="literal">
performance_schema_events_waits_history_long_size
</code>
</a>
</p>
<a class="indexterm" name="idm46045065802064">
</a>
<a class="indexterm" name="idm46045065801024">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_events_waits_history_long_size">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-events-waits-history-long-size=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_events_waits_history_long_size">
performance_schema_events_waits_history_long_size
</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">
-1
</code>
(signifies autosizing; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The number of rows in the
<a class="link" href="performance-schema-events-waits-history-long-table.html" title="29.12.4.3 The events_waits_history_long Table">
<code class="literal">
events_waits_history_long
</code>
</a>
table.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_events_waits_history_size">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_events_waits_history_size">
<code class="literal">
performance_schema_events_waits_history_size
</code>
</a>
</p>
<a class="indexterm" name="idm46045065769616">
</a>
<a class="indexterm" name="idm46045065768496">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_events_waits_history_size">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-events-waits-history-size=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_events_waits_history_size">
performance_schema_events_waits_history_size
</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">
-1
</code>
(signifies autosizing; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1024
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The number of rows per thread in the
<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>
table.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_hosts_size">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_hosts_size">
<code class="literal">
performance_schema_hosts_size
</code>
</a>
</p>
<a class="indexterm" name="idm46045065737264">
</a>
<a class="indexterm" name="idm46045065736160">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_hosts_size">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-hosts-size=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_hosts_size">
performance_schema_hosts_size
</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">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The number of rows in the
<a class="link" href="performance-schema-hosts-table.html" title="29.12.8.2 The hosts Table">
<code class="literal">
hosts
</code>
</a>
table. If this variable is 0, the Performance Schema does not
maintain connection statistics in the
<a class="link" href="performance-schema-hosts-table.html" title="29.12.8.2 The hosts Table">
<code class="literal">
hosts
</code>
</a>
table or status variable
information in the
<a class="link" href="performance-schema-status-variable-summary-tables.html" title="29.12.20.12 Status Variable Summary Tables">
<code class="literal">
status_by_host
</code>
</a>
table.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_cond_classes">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_cond_classes">
<code class="literal">
performance_schema_max_cond_classes
</code>
</a>
</p>
<a class="indexterm" name="idm46045065702176">
</a>
<a class="indexterm" name="idm46045065701136">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_cond_classes">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-cond-classes=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_cond_classes">
performance_schema_max_cond_classes
</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">
150
</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">
1024
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of condition instruments. For information
about how to set and use this variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_cond_instances">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_cond_instances">
<code class="literal">
performance_schema_max_cond_instances
</code>
</a>
</p>
<a class="indexterm" name="idm46045065670592">
</a>
<a class="indexterm" name="idm46045065669552">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_cond_instances">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-cond-instances=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_cond_instances">
performance_schema_max_cond_instances
</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">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of instrumented condition objects. For
information about how to set and use this variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_digest_length">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_digest_length">
<code class="literal">
performance_schema_max_digest_length
</code>
</a>
</p>
<a class="indexterm" name="idm46045065638752">
</a>
<a class="indexterm" name="idm46045065637712">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_digest_length">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-digest-length=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_digest_length">
performance_schema_max_digest_length
</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">
1024
</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">
1048576
</code>
</td>
</tr>
<tr>
<th>
Unit
</th>
<td>
bytes
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of bytes of memory reserved per statement
for computation of normalized statement digest values in the
Performance Schema. This variable is related to
<a class="link" href="server-system-variables.html#sysvar_max_digest_length">
<code class="literal">
max_digest_length
</code>
</a>
; see the
description of that variable in
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
.
</p>
<p>
For more information about statement digesting, including
considerations regarding memory use, see
<a class="xref" href="performance-schema-statement-digests.html" title="29.10 Performance Schema Statement Digests and Sampling">
Section 29.10, “Performance Schema Statement Digests and Sampling”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_digest_sample_age">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_digest_sample_age">
<code class="literal">
performance_schema_max_digest_sample_age
</code>
</a>
</p>
<a class="indexterm" name="idm46045065602720">
</a>
<a class="indexterm" name="idm46045065601600">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_digest_sample_age">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-digest-sample-age=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_digest_sample_age">
performance_schema_max_digest_sample_age
</a>
</code>
</td>
</tr>
<tr>
<th>
Scope
</th>
<td>
Global
</td>
</tr>
<tr>
<th>
Dynamic
</th>
<td>
Yes
</td>
</tr>
<tr>
<th>
<a class="link" href="optimizer-hints.html#optimizer-hints-set-var" title="Variable-Setting Hint Syntax">
<code class="literal">
SET_VAR
</code>
</a>
Hint Applies
</th>
<td>
No
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
60
</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">
1048576
</code>
</td>
</tr>
<tr>
<th>
Unit
</th>
<td>
seconds
</td>
</tr>
</tbody>
</table>
</div>
<p>
This variable affects statement sampling for the
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_digest
</code>
</a>
table. When a new table row is inserted, the statement that
produced the row digest value is stored as the current sample
statement associated with the digest. Thereafter, when the
server sees other statements with the same digest value, it
determines whether to use the new statement to replace the
current sample statement (that is, whether to resample).
Resampling policy is based on the comparative wait times of
the current sample statement and new statement and,
optionally, the age of the current sample statement:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Resampling based on wait times: If the new statement wait
time has a wait time greater than that of the current
sample statement, it becomes the current sample statement.
</p>
</li>
<li class="listitem">
<p>
Resampling based on age: If the
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_digest_sample_age">
<code class="literal">
performance_schema_max_digest_sample_age
</code>
</a>
system variable has a value greater than zero and the
current sample statement is more than that many seconds
old, the current statement is considered
<span class="quote">
“
<span class="quote">
too
old
</span>
”
</span>
and the new statement replaces it. This occurs
even if the new statement wait time is less than that of
the current sample statement.
</p>
</li>
</ul>
</div>
<p>
For information about statement sampling, see
<a class="xref" href="performance-schema-statement-digests.html" title="29.10 Performance Schema Statement Digests and Sampling">
Section 29.10, “Performance Schema Statement Digests and Sampling”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_file_classes">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_file_classes">
<code class="literal">
performance_schema_max_file_classes
</code>
</a>
</p>
<a class="indexterm" name="idm46045065562480">
</a>
<a class="indexterm" name="idm46045065561440">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_file_classes">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-file-classes=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_file_classes">
performance_schema_max_file_classes
</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">
80
</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">
1024
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of file instruments. For information about
how to set and use this variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_file_handles">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_file_handles">
<code class="literal">
performance_schema_max_file_handles
</code>
</a>
</p>
<a class="indexterm" name="idm46045065531088">
</a>
<a class="indexterm" name="idm46045065530048">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_file_handles">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-file-handles=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_file_handles">
performance_schema_max_file_handles
</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">
32768
</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">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of opened file objects. For information
about how to set and use this variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
<p>
The value of
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_file_handles">
<code class="literal">
performance_schema_max_file_handles
</code>
</a>
should be greater than the value of
<a class="link" href="server-system-variables.html#sysvar_open_files_limit">
<code class="literal">
open_files_limit
</code>
</a>
:
<a class="link" href="server-system-variables.html#sysvar_open_files_limit">
<code class="literal">
open_files_limit
</code>
</a>
affects the
maximum number of open file handles the server can support and
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_file_handles">
<code class="literal">
performance_schema_max_file_handles
</code>
</a>
affects how many of these file handles can be instrumented.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_file_instances">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_file_instances">
<code class="literal">
performance_schema_max_file_instances
</code>
</a>
</p>
<a class="indexterm" name="idm46045065493952">
</a>
<a class="indexterm" name="idm46045065492912">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_file_instances">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-file-instances=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_file_instances">
performance_schema_max_file_instances
</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">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of instrumented file objects. For
information about how to set and use this variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_index_stat">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_index_stat">
<code class="literal">
performance_schema_max_index_stat
</code>
</a>
</p>
<a class="indexterm" name="idm46045065462112">
</a>
<a class="indexterm" name="idm46045065461072">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_index_stat">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-index-stat=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_index_stat">
performance_schema_max_index_stat
</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">
-1
</code>
(signifies autosizing; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of indexes for which the Performance Schema
maintains statistics. If this maximum is exceeded such that
index statistics are lost, the Performance Schema increments
the
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_index_stat_lost">
<code class="literal">
Performance_schema_index_stat_lost
</code>
</a>
status variable. The default value is autosized using the
value of
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_table_instances">
<code class="literal">
performance_schema_max_table_instances
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_memory_classes">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_memory_classes">
<code class="literal">
performance_schema_max_memory_classes
</code>
</a>
</p>
<a class="indexterm" name="idm46045065428192">
</a>
<a class="indexterm" name="idm46045065427152">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_memory_classes">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-memory-classes=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_memory_classes">
performance_schema_max_memory_classes
</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">
470
</code>
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
450
</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">
1024
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of memory instruments. For information
about how to set and use this variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_metadata_locks">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_metadata_locks">
<code class="literal">
performance_schema_max_metadata_locks
</code>
</a>
</p>
<a class="indexterm" name="idm46045065394272">
</a>
<a class="indexterm" name="idm46045065393232">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_metadata_locks">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-metadata-locks=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_metadata_locks">
performance_schema_max_metadata_locks
</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">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
10485760
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of metadata lock instruments. This value
controls the size of the
<a class="link" href="performance-schema-metadata-locks-table.html" title="29.12.13.3 The metadata_locks Table">
<code class="literal">
metadata_locks
</code>
</a>
table. If this
maximum is exceeded such that a metadata lock cannot be
instrumented, the Performance Schema increments the
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_metadata_lock_lost">
<code class="literal">
Performance_schema_metadata_lock_lost
</code>
</a>
status variable.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_meter_classes">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_meter_classes">
<code class="literal">
performance_schema_max_meter_classes
</code>
</a>
</p>
<a class="indexterm" name="idm46045065360368">
</a>
<a class="indexterm" name="idm46045065359280">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_meter_classes">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-meter-classes=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_meter_classes">
performance_schema_max_meter_classes
</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">
30
</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">
64
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Maximum number of meter instruments which can be created
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_metric_classes">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_metric_classes">
<code class="literal">
performance_schema_max_metric_classes
</code>
</a>
</p>
<a class="indexterm" name="idm46045065329760">
</a>
<a class="indexterm" name="idm46045065328672">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_metric_classes">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-metric-classes=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_metric_classes">
performance_schema_max_metric_classes
</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">
600
</code>
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
30
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
11000
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Maximum number of metric instruments which can be created.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_mutex_classes">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_mutex_classes">
<code class="literal">
performance_schema_max_mutex_classes
</code>
</a>
</p>
<a class="indexterm" name="idm46045065299120">
</a>
<a class="indexterm" name="idm46045065298080">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_mutex_classes">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-mutex-classes=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_mutex_classes">
performance_schema_max_mutex_classes
</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">
350
</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">
1024
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of mutex instruments. For information about
how to set and use this variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_mutex_instances">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_mutex_instances">
<code class="literal">
performance_schema_max_mutex_instances
</code>
</a>
</p>
<a class="indexterm" name="idm46045065267664">
</a>
<a class="indexterm" name="idm46045065266624">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_mutex_instances">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-mutex-instances=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_mutex_instances">
performance_schema_max_mutex_instances
</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">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
104857600
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of instrumented mutex objects. For
information about how to set and use this variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_prepared_statements_instances">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_prepared_statements_instances">
<code class="literal">
performance_schema_max_prepared_statements_instances
</code>
</a>
</p>
<a class="indexterm" name="idm46045065235664">
</a>
<a class="indexterm" name="idm46045065234624">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_prepared_statements_instances">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-prepared-statements-instances=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_prepared_statements_instances">
performance_schema_max_prepared_statements_instances
</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">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
4194304
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of rows in the
<a class="link" href="performance-schema-prepared-statements-instances-table.html" title="29.12.6.4 The prepared_statements_instances Table">
<code class="literal">
prepared_statements_instances
</code>
</a>
table. If this maximum is exceeded such that a prepared
statement cannot be instrumented, the Performance Schema
increments the
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_prepared_statements_lost">
<code class="literal">
Performance_schema_prepared_statements_lost
</code>
</a>
status variable. For information about how to set and use this
variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
<p>
The default value of this variable is autosized based on the
value of 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>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_rwlock_classes">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_rwlock_classes">
<code class="literal">
performance_schema_max_rwlock_classes
</code>
</a>
</p>
<a class="indexterm" name="idm46045065199072">
</a>
<a class="indexterm" name="idm46045065198032">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_rwlock_classes">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-rwlock-classes=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_rwlock_classes">
performance_schema_max_rwlock_classes
</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">
100
</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">
1024
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of rwlock instruments. For information
about how to set and use this variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_program_instances">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_program_instances">
<code class="literal">
performance_schema_max_program_instances
</code>
</a>
</p>
<a class="indexterm" name="idm46045065167648">
</a>
<a class="indexterm" name="idm46045065166528">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_program_instances">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-program-instances=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_program_instances">
performance_schema_max_program_instances
</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">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of stored programs for which the
Performance Schema maintains statistics. If this maximum is
exceeded, the Performance Schema increments the
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_program_lost">
<code class="literal">
Performance_schema_program_lost
</code>
</a>
status variable. For information about how to set and use this
variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_rwlock_instances">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_rwlock_instances">
<code class="literal">
performance_schema_max_rwlock_instances
</code>
</a>
</p>
<a class="indexterm" name="idm46045065134256">
</a>
<a class="indexterm" name="idm46045065133216">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_rwlock_instances">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-rwlock-instances=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_rwlock_instances">
performance_schema_max_rwlock_instances
</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">
-1
</code>
(signifies autosizing; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autosizing; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
104857600
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of instrumented rwlock objects. For
information about how to set and use this variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_socket_classes">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_socket_classes">
<code class="literal">
performance_schema_max_socket_classes
</code>
</a>
</p>
<a class="indexterm" name="idm46045065102352">
</a>
<a class="indexterm" name="idm46045065101312">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_socket_classes">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-socket-classes=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_socket_classes">
performance_schema_max_socket_classes
</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">
10
</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">
1024
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of socket instruments. For information
about how to set and use this variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_socket_instances">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_socket_instances">
<code class="literal">
performance_schema_max_socket_instances
</code>
</a>
</p>
<a class="indexterm" name="idm46045065070944">
</a>
<a class="indexterm" name="idm46045065069904">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_socket_instances">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-socket-instances=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_socket_instances">
performance_schema_max_socket_instances
</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">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of instrumented socket objects. For
information about how to set and use this variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_sql_text_length">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_sql_text_length">
<code class="literal">
performance_schema_max_sql_text_length
</code>
</a>
</p>
<a class="indexterm" name="idm46045065039104">
</a>
<a class="indexterm" name="idm46045065038064">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_sql_text_length">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-sql-text-length=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_sql_text_length">
performance_schema_max_sql_text_length
</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">
1024
</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">
1048576
</code>
</td>
</tr>
<tr>
<th>
Unit
</th>
<td>
bytes
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of bytes used to store SQL statements. The
value applies to storage required for these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The
<code class="literal">
SQL_TEXT
</code>
column of the
<a class="link" href="performance-schema-events-statements-current-table.html" title="29.12.6.1 The events_statements_current Table">
<code class="literal">
events_statements_current
</code>
</a>
,
<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>
,
and
<a class="link" href="performance-schema-events-statements-history-long-table.html" title="29.12.6.3 The events_statements_history_long Table">
<code class="literal">
events_statements_history_long
</code>
</a>
statement event tables.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
QUERY_SAMPLE_TEXT
</code>
column of the
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_digest
</code>
</a>
summary table.
</p>
</li>
</ul>
</div>
<p>
Any bytes in excess of
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_sql_text_length">
<code class="literal">
performance_schema_max_sql_text_length
</code>
</a>
are discarded and do not appear in the column. Statements
differing only after that many initial bytes are
indistinguishable in the column.
</p>
<p>
Decreasing the
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_sql_text_length">
<code class="literal">
performance_schema_max_sql_text_length
</code>
</a>
value reduces memory use but causes more statements to become
indistinguishable if they differ only at the end. Increasing
the value increases memory use but permits longer statements
to be distinguished.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_stage_classes">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_stage_classes">
<code class="literal">
performance_schema_max_stage_classes
</code>
</a>
</p>
<a class="indexterm" name="idm46045064992688">
</a>
<a class="indexterm" name="idm46045064991648">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_stage_classes">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-stage-classes=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_stage_classes">
performance_schema_max_stage_classes
</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">
175
</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">
1024
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of stage instruments. For information about
how to set and use this variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_statement_classes">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_statement_classes">
<code class="literal">
performance_schema_max_statement_classes
</code>
</a>
</p>
<a class="indexterm" name="idm46045064961280">
</a>
<a class="indexterm" name="idm46045064960160">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_statement_classes">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-statement-classes=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_statement_classes">
performance_schema_max_statement_classes
</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>
Minimum Value
</th>
<td>
<code class="literal">
0
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
256
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of statement instruments. For information
about how to set and use this variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
<p>
The default value is calculated at server build time based on
the number of commands in the client/server protocol and the
number of SQL statement types supported by the server.
</p>
<p>
This variable should not be changed, unless to set it to 0 to
disable all statement instrumentation and save all memory
associated with it. Setting the variable to nonzero values
other than the default has no benefit; in particular, values
larger than the default cause more memory to be allocated then
is needed.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_statement_stack">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_statement_stack">
<code class="literal">
performance_schema_max_statement_stack
</code>
</a>
</p>
<a class="indexterm" name="idm46045064930720">
</a>
<a class="indexterm" name="idm46045064929680">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_statement_stack">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-statement-stack=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_statement_stack">
performance_schema_max_statement_stack
</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">
10
</code>
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
1
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
256
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum depth of nested stored program calls for which the
Performance Schema maintains statistics. When this maximum is
exceeded, the Performance Schema increments the
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_nested_statement_lost">
<code class="literal">
Performance_schema_nested_statement_lost
</code>
</a>
status variable for each stored program statement executed.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_table_handles">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_table_handles">
<code class="literal">
performance_schema_max_table_handles
</code>
</a>
</p>
<a class="indexterm" name="idm46045064898576">
</a>
<a class="indexterm" name="idm46045064897536">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_table_handles">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-table-handles=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_table_handles">
performance_schema_max_table_handles
</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">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of opened table objects. This value
controls the size of the
<a class="link" href="performance-schema-table-handles-table.html" title="29.12.13.4 The table_handles Table">
<code class="literal">
table_handles
</code>
</a>
table. If this
maximum is exceeded such that a table handle cannot be
instrumented, the Performance Schema increments the
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_table_handles_lost">
<code class="literal">
Performance_schema_table_handles_lost
</code>
</a>
status variable. For information about how to set and use this
variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_table_instances">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_table_instances">
<code class="literal">
performance_schema_max_table_instances
</code>
</a>
</p>
<a class="indexterm" name="idm46045064863888">
</a>
<a class="indexterm" name="idm46045064862848">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_table_instances">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-table-instances=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_table_instances">
performance_schema_max_table_instances
</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">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of instrumented table objects. For
information about how to set and use this variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_table_lock_stat">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_table_lock_stat">
<code class="literal">
performance_schema_max_table_lock_stat
</code>
</a>
</p>
<a class="indexterm" name="idm46045064832048">
</a>
<a class="indexterm" name="idm46045064831008">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_table_lock_stat">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-table-lock-stat=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_table_lock_stat">
performance_schema_max_table_lock_stat
</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">
-1
</code>
(signifies autosizing; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of tables for which the Performance Schema
maintains lock statistics. If this maximum is exceeded such
that table lock statistics are lost, the Performance Schema
increments the
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_table_lock_stat_lost">
<code class="literal">
Performance_schema_table_lock_stat_lost
</code>
</a>
status variable.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_thread_classes">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_thread_classes">
<code class="literal">
performance_schema_max_thread_classes
</code>
</a>
</p>
<a class="indexterm" name="idm46045064799408">
</a>
<a class="indexterm" name="idm46045064798368">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_thread_classes">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-thread-classes=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_thread_classes">
performance_schema_max_thread_classes
</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">
100
</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">
1024
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of thread instruments. For information
about how to set and use this variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_max_thread_instances">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_thread_instances">
<code class="literal">
performance_schema_max_thread_instances
</code>
</a>
</p>
<a class="indexterm" name="idm46045064767936">
</a>
<a class="indexterm" name="idm46045064766896">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_max_thread_instances">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-max-thread-instances=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_thread_instances">
performance_schema_max_thread_instances
</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">
-1
</code>
(signifies autosizing; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The maximum number of instrumented thread objects. The value
controls the size of the
<a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
<code class="literal">
threads
</code>
</a>
table. If this maximum is exceeded such that a thread cannot
be instrumented, the Performance Schema increments the
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_thread_instances_lost">
<code class="literal">
Performance_schema_thread_instances_lost
</code>
</a>
status variable. For information about how to set and use this
variable, see
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
.
</p>
<p>
The
<a class="link" href="server-system-variables.html#sysvar_max_connections">
<code class="literal">
max_connections
</code>
</a>
system
variable affects how many threads can run in the server.
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_thread_instances">
<code class="literal">
performance_schema_max_thread_instances
</code>
</a>
affects how many of these running threads can be instrumented.
</p>
<p>
The
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
variables_by_thread
</code>
</a>
and
<a class="link" href="performance-schema-status-variable-tables.html" title="29.12.15 Performance Schema Status Variable Tables">
<code class="literal">
status_by_thread
</code>
</a>
tables contain
system and status variable information only about foreground
threads. If not all threads are instrumented by the
Performance Schema, this table misses some rows. In this case,
the
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_thread_instances_lost">
<code class="literal">
Performance_schema_thread_instances_lost
</code>
</a>
status variable is greater than zero.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_session_connect_attrs_size">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_session_connect_attrs_size">
<code class="literal">
performance_schema_session_connect_attrs_size
</code>
</a>
</p>
<a class="indexterm" name="idm46045064725600">
</a>
<a class="indexterm" name="idm46045064724480">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_session_connect_attrs_size">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-session-connect-attrs-size=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_session_connect_attrs_size">
performance_schema_session_connect_attrs_size
</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">
-1
</code>
(signifies autosizing; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autosizing; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
<tr>
<th>
Unit
</th>
<td>
bytes
</td>
</tr>
</tbody>
</table>
</div>
<p>
The amount of preallocated memory per thread reserved to hold
connection attribute key-value pairs. If the aggregate size of
connection attribute data sent by a client is larger than this
amount, the Performance Schema truncates the attribute data,
increments the
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_session_connect_attrs_lost">
<code class="literal">
Performance_schema_session_connect_attrs_lost
</code>
</a>
status variable, and writes a message to the error log
indicating that truncation occurred if the
<a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
<code class="literal">
log_error_verbosity
</code>
</a>
system
variable is greater than 1. A
<code class="literal">
_truncated
</code>
attribute is also added to the session attributes with a value
indicating how many bytes were lost, if the attribute buffer
has sufficient space. This enables the Performance Schema to
expose per-connection truncation information in the connection
attribute tables. This information can be examined without
having to check the error log.
</p>
<p>
The default value of
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_session_connect_attrs_size">
<code class="literal">
performance_schema_session_connect_attrs_size
</code>
</a>
is autosized at server startup. This value may be small, so if
truncation occurs
(
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_session_connect_attrs_lost">
<code class="literal">
Performance_schema_session_connect_attrs_lost
</code>
</a>
becomes nonzero), you may wish to set
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_session_connect_attrs_size">
<code class="literal">
performance_schema_session_connect_attrs_size
</code>
</a>
explicitly to a larger value.
</p>
<p>
Although the maximum permitted
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_session_connect_attrs_size">
<code class="literal">
performance_schema_session_connect_attrs_size
</code>
</a>
value is 1MB, the effective maximum is 64KB because the server
imposes a limit of 64KB on the aggregate size of connection
attribute data it accepts. If a client attempts to send more
than 64KB of attribute data, the server rejects the
connection. For more information, see
<a class="xref" href="performance-schema-connection-attribute-tables.html" title="29.12.9 Performance Schema Connection Attribute Tables">
Section 29.12.9, “Performance Schema Connection Attribute Tables”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_setup_actors_size">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_setup_actors_size">
<code class="literal">
performance_schema_setup_actors_size
</code>
</a>
</p>
<a class="indexterm" name="idm46045064680832">
</a>
<a class="indexterm" name="idm46045064679792">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_setup_actors_size">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-setup-actors-size=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_setup_actors_size">
performance_schema_setup_actors_size
</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">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autosizing; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The number of rows in the
<a class="link" href="performance-schema-setup-actors-table.html" title="29.12.2.1 The setup_actors Table">
<code class="literal">
setup_actors
</code>
</a>
table.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_setup_objects_size">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_setup_objects_size">
<code class="literal">
performance_schema_setup_objects_size
</code>
</a>
</p>
<a class="indexterm" name="idm46045064648528">
</a>
<a class="indexterm" name="idm46045064647488">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_setup_objects_size">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-setup-objects-size=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_setup_objects_size">
performance_schema_setup_objects_size
</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">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The number of rows in the
<a class="link" href="performance-schema-setup-objects-table.html" title="29.12.2.4 The setup_objects Table">
<code class="literal">
setup_objects
</code>
</a>
table.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_show_processlist">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_show_processlist">
<code class="literal">
performance_schema_show_processlist
</code>
</a>
</p>
<a class="indexterm" name="idm46045064616160">
</a>
<a class="indexterm" name="idm46045064615120">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_show_processlist">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-show-processlist[={OFF|ON}]
</code>
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_show_processlist">
performance_schema_show_processlist
</a>
</code>
</td>
</tr>
<tr>
<th>
Scope
</th>
<td>
Global
</td>
</tr>
<tr>
<th>
Dynamic
</th>
<td>
Yes
</td>
</tr>
<tr>
<th>
<a class="link" href="optimizer-hints.html#optimizer-hints-set-var" title="Variable-Setting Hint Syntax">
<code class="literal">
SET_VAR
</code>
</a>
Hint Applies
</th>
<td>
No
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Boolean
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
OFF
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW PROCESSLIST
</code>
</a>
statement
provides process information by collecting thread data from
all active threads. The
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_show_processlist">
<code class="literal">
performance_schema_show_processlist
</code>
</a>
variable determines which
<code class="literal">
SHOW PROCESSLIST
</code>
implementation to use:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The default implementation iterates across active threads
from within the thread manager while holding a global
mutex. This has negative performance consequences,
particularly on busy systems.
</p>
</li>
<li class="listitem">
<p>
The alternative
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW
PROCESSLIST
</code>
</a>
implementation is based on the
Performance Schema
<a class="link" href="performance-schema-processlist-table.html" title="29.12.22.7 The processlist Table">
<code class="literal">
processlist
</code>
</a>
table. This
implementation queries active thread data from the
Performance Schema rather than the thread manager and does
not require a mutex.
</p>
</li>
</ul>
</div>
<p>
To enable the alternative implementation, enable the
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_show_processlist">
<code class="literal">
performance_schema_show_processlist
</code>
</a>
system variable. To ensure that the default and alternative
implementations yield the same information, certain
configuration requirements must be met; see
<a class="xref" href="performance-schema-processlist-table.html" title="29.12.22.7 The processlist Table">
Section 29.12.22.7, “The processlist Table”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sysvar_performance_schema_users_size">
</a>
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_users_size">
<code class="literal">
performance_schema_users_size
</code>
</a>
</p>
<a class="indexterm" name="idm46045064577392">
</a>
<a class="indexterm" name="idm46045064576288">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for performance_schema_users_size">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--performance-schema-users-size=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_users_size">
performance_schema_users_size
</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">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
-1
</code>
(signifies autoscaling; do not assign this literal value)
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1048576
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The number of rows in the
<a class="link" href="performance-schema-users-table.html" title="29.12.8.3 The users Table">
<code class="literal">
users
</code>
</a>
table. If this variable is 0, the Performance Schema does not
maintain connection statistics in the
<a class="link" href="performance-schema-users-table.html" title="29.12.8.3 The users Table">
<code class="literal">
users
</code>
</a>
table or status variable
information in the
<a class="link" href="performance-schema-status-variable-summary-tables.html" title="29.12.20.12 Status Variable Summary Tables">
<code class="literal">
status_by_user
</code>
</a>
table.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-administrable-role-authorizations-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-administrable-role-authorizations-table">
</a>
28.3.2 The INFORMATION_SCHEMA ADMINISTRABLE_ROLE_AUTHORIZATIONS Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045080389968">
</a>
<p>
The
<a class="link" href="information-schema-administrable-role-authorizations-table.html" title="28.3.2 The INFORMATION_SCHEMA ADMINISTRABLE_ROLE_AUTHORIZATIONS Table">
<code class="literal">
ADMINISTRABLE_ROLE_AUTHORIZATIONS
</code>
</a>
table provides information about which roles applicable for the
current user or role can be granted to other users or roles.
</p>
<p>
The
<a class="link" href="information-schema-administrable-role-authorizations-table.html" title="28.3.2 The INFORMATION_SCHEMA ADMINISTRABLE_ROLE_AUTHORIZATIONS Table">
<code class="literal">
ADMINISTRABLE_ROLE_AUTHORIZATIONS
</code>
</a>
table has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
USER
</code>
</p>
<p>
The user name part of the current user account.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
HOST
</code>
</p>
<p>
The host name part of the current user account.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
GRANTEE
</code>
</p>
<p>
The user name part of the account to which the role is
granted.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
GRANTEE_HOST
</code>
</p>
<p>
The host name part of the account to which the role is
granted.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ROLE_NAME
</code>
</p>
<p>
The user name part of the granted role.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ROLE_HOST
</code>
</p>
<p>
The host name part of the granted role.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
IS_GRANTABLE
</code>
</p>
<p>
<code class="literal">
YES
</code>
or
<code class="literal">
NO
</code>
, depending on
whether the role is grantable to other accounts.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
IS_DEFAULT
</code>
</p>
<p>
<code class="literal">
YES
</code>
or
<code class="literal">
NO
</code>
, depending on
whether the role is a default role.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
IS_MANDATORY
</code>
</p>
<p>
<code class="literal">
YES
</code>
or
<code class="literal">
NO
</code>
, depending on
whether the role is mandatory.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/creating-spatial-indexes.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="creating-spatial-indexes">
</a>
13.4.10 Creating Spatial Indexes
</h3>
</div>
</div>
</div>
<p>
For
<code class="literal">
InnoDB
</code>
and
<code class="literal">
MyISAM
</code>
tables, MySQL can create spatial indexes using syntax similar to
that for creating regular indexes, but using the
<code class="literal">
SPATIAL
</code>
keyword. Columns in spatial indexes
must be declared
<code class="literal">
NOT NULL
</code>
. The following
examples demonstrate how to create spatial indexes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
With
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa53434364"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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 keyword">SRID</span> <span class="token number">4326</span><span class="token punctuation">,</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 punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
With
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20028546"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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 keyword">SRID</span> <span class="token number">4326</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></code></pre>
</div>
</li>
<li class="listitem">
<p>
With
<a class="link" href="create-index.html" title="15.1.15 CREATE INDEX Statement">
<code class="literal">
CREATE INDEX
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa66166939"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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 keyword">SRID</span> <span class="token number">4326</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">SPATIAL</span> <span class="token keyword">INDEX</span> g <span class="token keyword">ON</span> geom <span class="token punctuation">(</span>g<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
<code class="literal">
SPATIAL INDEX
</code>
creates an R-tree index. For
storage engines that support nonspatial indexing of spatial
columns, the engine creates a B-tree index. A B-tree index on
spatial values is useful for exact-value lookups, but not for
range scans.
</p>
<p>
The optimizer can use spatial indexes defined on columns that
are SRID-restricted. For more information, see
<a class="xref" href="spatial-type-overview.html" title="13.4.1 Spatial Data Types">
Section 13.4.1, “Spatial Data Types”
</a>
, and
<a class="xref" href="spatial-index-optimization.html" title="10.3.3 SPATIAL Index Optimization">
Section 10.3.3, “SPATIAL Index Optimization”
</a>
.
</p>
<p>
For more information on indexing spatial columns, see
<a class="xref" href="create-index.html" title="15.1.15 CREATE INDEX Statement">
Section 15.1.15, “CREATE INDEX Statement”
</a>
.
</p>
<p>
To drop spatial indexes, use
<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="drop-index.html" title="15.1.27 DROP INDEX Statement">
<code class="literal">
DROP INDEX
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
With
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa8054621"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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> geom <span class="token keyword">DROP</span> <span class="token keyword">INDEX</span> g<span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
With
<a class="link" href="drop-index.html" title="15.1.27 DROP INDEX Statement">
<code class="literal">
DROP INDEX
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa33833694"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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> g <span class="token keyword">ON</span> geom<span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
Example: Suppose that a table
<code class="literal">
geom
</code>
contains
more than 32,000 geometries, which are stored in the column
<code class="literal">
g
</code>
of type
<code class="literal">
GEOMETRY
</code>
. The
table also has an
<code class="literal">
AUTO_INCREMENT
</code>
column
<code class="literal">
fid
</code>
for storing object ID values.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa56841133"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">DESCRIBE</span> geom<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Field <span class="token punctuation">|</span> Type <span class="token punctuation">|</span> Null <span class="token punctuation">|</span> Key <span class="token punctuation">|</span> Default <span class="token punctuation">|</span> Extra <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> fid <span class="token punctuation">|</span> int(11) <span class="token punctuation">|</span> <span class="token punctuation">|</span> PRI <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> auto_increment <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> g <span class="token punctuation">|</span> geometry <span class="token punctuation">|</span> <span class="token punctuation">|</span> <span 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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">2 rows in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">COUNT</span><span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> geom<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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> 32376 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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>
To add a spatial index on the column
<code class="literal">
g
</code>
, use
this statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa19208646"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> 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 output">Query OK, 32376 rows affected (4.05 sec)</span>
<span class="token output">Records: 32376 Duplicates: 0 Warnings: 0</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-waits-global-by-latency.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-waits-global-by-latency">
</a>
30.4.3.52 The waits_global_by_latency and x$waits_global_by_latency Views
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045061697200">
</a>
<a class="indexterm" name="idm46045061695744">
</a>
<a class="indexterm" name="idm46045061694240">
</a>
<a class="indexterm" name="idm46045061692736">
</a>
<p>
These views summarize wait events, grouped by event. By
default, rows are sorted by descending total latency. Idle
events are ignored.
</p>
<p>
The
<a class="link" href="sys-waits-global-by-latency.html" title="30.4.3.52 The waits_global_by_latency and x$waits_global_by_latency Views">
<code class="literal">
waits_global_by_latency
</code>
</a>
and
<a class="link" href="sys-waits-global-by-latency.html" title="30.4.3.52 The waits_global_by_latency and x$waits_global_by_latency Views">
<code class="literal">
x$waits_global_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">
events
</code>
</p>
<p>
The event name.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total
</code>
</p>
<p>
The total number of occurrences of the event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total_latency
</code>
</p>
<p>
The total wait time of timed occurrences of the event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
avg_latency
</code>
</p>
<p>
The average wait time per timed occurrence of the event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
max_latency
</code>
</p>
<p>
The maximum single wait time of timed occurrences of the
event.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-online-upgrade-combining-versions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="group-replication-online-upgrade-combining-versions">
</a>
20.8.1 Combining Different Member Versions in a Group
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="group-replication-compatibility-upgrade.html">
20.8.1.1 Member Versions During Upgrades
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-compatibility-communication.html">
20.8.1.2 Group Replication Communication Protocol Version
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045131656752">
</a>
<p>
Group Replication is versioned according to the MySQL Server
version that the Group Replication plugin was bundled with. For
example, if a member is running MySQL 8.4.3 then that
is the version of the Group Replication plugin. To check the
version of MySQL Server on a group member issue:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa59606167"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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> MEMBER_HOST<span class="token punctuation">,</span>MEMBER_PORT<span class="token punctuation">,</span>MEMBER_VERSION <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>replication_group_members<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> member_host <span class="token punctuation">|</span> member_port <span class="token punctuation">|</span> member_version <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> example.com <span class="token punctuation">|</span> 3306 <span class="token punctuation">|</span> 8.4.3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
For guidance on understanding the MySQL Server version and
selecting a version, see
<a class="xref" href="which-version.html" title="2.1.2 Which MySQL Version and Distribution to Install">
Section 2.1.2, “Which MySQL Version and Distribution to Install”
</a>
.
</p>
<p>
For optimal compatibility and performance, all members of a group
should run the same version of MySQL Server and therefore of Group
Replication. However, while you are in the process of upgrading an
online group, in order to maximize availability, you might need to
have members with different MySQL Server versions running at the
same time. Depending on the changes made between the versions of
MySQL, you could encounter incompatibilities in this situation.
For example, if a feature has been deprecated between major
versions, then combining the versions in a group might cause
members that rely on the deprecated feature to fail. Conversely,
writing to a member running a newer MySQL version while there are
read/write members in the group running an older MySQL version
might cause issues on members that lack functions introduced in
the newer release.
</p>
<p>
To prevent such issues, Group Replication includes compatibility
policies that enable you to combine members running different
versions of MySQL in the same group safely. A member applies these
policies to decide whether to join the group normally, or join in
read-only mode, or not join the group, depending on which choice
results in the safe operation of the joining member and of the
existing members of the group. In an upgrade scenario, each server
must leave the group, be upgraded, and rejoin the group with its
new server version. At this point the member applies the policies
for its new server version, which might have changed from the
policies it applied when it originally joined the group.
</p>
<p>
As the administrator, you can instruct any server to attempt to
join any group by configuring the server appropriately and issuing
a
<a class="link" href="start-group-replication.html" title="15.4.3.1 START GROUP_REPLICATION Statement">
<code class="literal">
START GROUP_REPLICATION
</code>
</a>
statement. A decision to join or not join the group, or to join
the group in read-only mode, is made and implemented by the
joining member itself after you attempt to add it to the group.
The joining member receives information on the MySQL Server
versions of the current group members, assesses its own
compatibility with those members, and applies the policies used in
its own MySQL Server version (
<span class="emphasis">
<em>
not
</em>
</span>
the
policies used by the existing members) to decide whether it is
compatible.
</p>
<p>
The compatibility policies that a joining member applies when
attempting to join a group are as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A member joins a group normally if it is running the same
MySQL Server version as the lowest version that the existing
group members are running.
</p>
</li>
<li class="listitem">
<p>
A member joins a group but remains in read-only mode if it is
running a higher MySQL Server version than the lowest version
that the existing group members are running. This behavior
only makes a difference when the group is running in
multi-primary mode, because in a group that is running in
single-primary mode, newly added members default to being
read-only in any case.
</p>
</li>
</ul>
</div>
<p>
Members take into account the entire major.minor.release version
of the software when checking compatibility.
</p>
<p>
In a multi-primary mode group with members that use different
MySQL Server versions, Group Replication automatically manages
members' read/write and read-only status. If a member leaves
the group, the members running the version that is now the lowest
are automatically set to read/write mode. When you change a group
that was running in single-primary mode to run in multi-primary
mode using
<a class="link" href="group-replication-functions-for-mode.html#function_group-replication-switch-to-multi-primary-mode">
<code class="literal">
group_replication_switch_to_multi_primary_mode()
</code>
</a>
,
Group Replication automatically sets each member to the correct
mode. Members are automatically placed in read-only mode if they
are running a higher MySQL server version than the lowest version
present in the group, and members running the lowest version are
placed in read/write mode.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-user-summary.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-user-summary">
</a>
30.4.3.41 The user_summary and x$user_summary Views
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045061979328">
</a>
<a class="indexterm" name="idm46045061977872">
</a>
<a class="indexterm" name="idm46045061976384">
</a>
<a class="indexterm" name="idm46045061974896">
</a>
<p>
These views summarize statement activity, file I/O, and
connections, grouped by user. By default, rows are sorted by
descending total latency.
</p>
<p>
The
<a class="link" href="sys-user-summary.html" title="30.4.3.41 The user_summary and x$user_summary Views">
<code class="literal">
user_summary
</code>
</a>
and
<a class="link" href="sys-user-summary.html" title="30.4.3.41 The user_summary and x$user_summary Views">
<code class="literal">
x$user_summary
</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">
statements
</code>
</p>
<p>
The total number of statements for the user.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
statement_latency
</code>
</p>
<p>
The total wait time of timed statements for the user.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
statement_avg_latency
</code>
</p>
<p>
The average wait time per timed statement for the user.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
table_scans
</code>
</p>
<p>
The total number of table scans for the user.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
file_ios
</code>
</p>
<p>
The total number of file I/O events for the user.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
file_io_latency
</code>
</p>
<p>
The total wait time of timed file I/O events for the user.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
current_connections
</code>
</p>
<p>
The current number of connections for the user.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total_connections
</code>
</p>
<p>
The total number of connections for the user.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
unique_hosts
</code>
</p>
<p>
The number of distinct hosts from which connections for
the user have originated.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
current_memory
</code>
</p>
<p>
The current amount of allocated memory for the user.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total_memory_allocated
</code>
</p>
<p>
The total amount of allocated memory for the user.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-programs-ndb-restore.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-programs-ndb-restore">
</a>
25.5.23 ndb_restore — Restore an NDB Cluster Backup
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045099817888">
</a>
<a class="indexterm" name="idm46045099816528">
</a>
<a class="indexterm" name="idm46045099815168">
</a>
<a class="indexterm" name="idm46045099813808">
</a>
<a class="indexterm" name="idm46045099812448">
</a>
<p>
The NDB Cluster restoration program is implemented as a separate
command-line utility
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
, which can
normally be found in the MySQL
<code class="filename">
bin
</code>
directory. This program reads the files created as a result of
the backup and inserts the stored information into the database.
</p>
<p>
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
must be executed once for each of
the backup files that were created by the
<a class="link" href="mysql-cluster-backup-using-management-client.html" title="25.6.8.2 Using The NDB Cluster Management Client to Create a Backup">
<code class="literal">
START BACKUP
</code>
</a>
command used to
create the backup (see
<a class="xref" href="mysql-cluster-backup-using-management-client.html" title="25.6.8.2 Using The NDB Cluster Management Client to Create a Backup">
Section 25.6.8.2, “Using The NDB Cluster Management Client to Create a Backup”
</a>
).
This is equal to the number of data nodes in the cluster at the
time that the backup was created.
</p>
<a class="indexterm" name="idm46045099804832">
</a>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Before using
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
, it is recommended
that the cluster be running in single user mode, unless you
are restoring multiple data nodes in parallel. See
<a class="xref" href="mysql-cluster-single-user-mode.html" title="25.6.6 NDB Cluster Single User Mode">
Section 25.6.6, “NDB Cluster Single User Mode”
</a>
, for more
information.
</p>
</div>
<p>
Options that can be used with
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
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_restore_allow-pk-changes">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_allow-pk-changes">
<code class="option">
--allow-pk-changes
</code>
</a>
</p>
<a class="indexterm" name="idm46045099795456">
</a>
<a class="indexterm" name="idm46045099793968">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for allow-pk-changes">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--allow-pk-changes[=0|1]
</code>
</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">
0
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
When this option is set to
<code class="literal">
1
</code>
,
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
allows the primary keys in a
table definition to differ from that of the same table in
the backup. This may be desirable when backing up and
restoring between different schema versions with primary key
changes on one or more tables, and it appears that
performing the restore operation using ndb_restore is
simpler or more efficient than issuing many
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statements after
restoring table schemas and data.
</p>
<p>
The following changes in primary key definitions are
supported by
<code class="option">
--allow-pk-changes
</code>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<span class="bold">
<strong>
Extending the primary
key
</strong>
</span>
: A non-nullable column that exists in the
table schema in the backup becomes part of the
table's primary key in the database.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
When extending a table's primary key, any columns
which become part of primary key must not be updated
while the backup is being taken; any such updates
discovered by
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
cause the
restore operation to fail, even when no change in
value takes place. In some cases, it may be possible
to override this behavior using the
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_ignore-extended-pk-updates">
<code class="option">
--ignore-extended-pk-updates
</code>
</a>
option; see the description of this option for more
information.
</p>
</div>
</li>
<li class="listitem">
<p>
<span class="bold">
<strong>
Contracting the primary key
(1)
</strong>
</span>
: A column that is already part of the
table's primary key in the backup schema is no
longer part of the primary key, but remains in the
table.
</p>
</li>
<li class="listitem">
<p>
<span class="bold">
<strong>
Contracting the primary key
(2)
</strong>
</span>
: A column that is already part of the
table's primary key in the backup schema is removed
from the table entirely.
</p>
</li>
</ul>
</div>
<p>
These differences can be combined with other schema
differences supported by
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
,
including changes to blob and text columns requiring the use
of staging tables.
</p>
<p>
Basic steps in a typical scenario using primary key schema
changes are listed here:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Restore table schemas using
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_restore-meta">
<code class="option">
--restore-meta
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
Alter schema to that desired, or create it
</p>
</li>
<li class="listitem">
<p>
Back up the desired schema
</p>
</li>
<li class="listitem">
<p>
Run
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_disable-indexes">
<code class="option">
--disable-indexes
</code>
</a>
using the backup from the previous step, to drop indexes
and constraints
</p>
</li>
<li class="listitem">
<p>
Run
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_allow-pk-changes">
<code class="option">
--allow-pk-changes
</code>
</a>
(possibly along with
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_ignore-extended-pk-updates">
<code class="option">
--ignore-extended-pk-updates
</code>
</a>
,
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_disable-indexes">
<code class="option">
--disable-indexes
</code>
</a>
,
and possibly other options as needed) to restore all
data
</p>
</li>
<li class="listitem">
<p>
Run
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_rebuild-indexes">
<code class="option">
--rebuild-indexes
</code>
</a>
using the backup made with the desired schema, to
rebuild indexes and constraints
</p>
</li>
</ol>
</div>
<p>
When extending the primary key, it may be necessary for
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
to use a temporary secondary
unique index during the restore operation to map from the
old primary key to the new one. Such an index is created
only when necessary to apply events from the backup log to a
table which has an extended primary key. This index is named
<code class="literal">
NDB$RESTORE_PK_MAPPING
</code>
, and is created on
each table requiring it; it can be shared, if necessary, by
multiple instances of
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
instances running in parallel. (Running
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_rebuild-indexes">
<code class="option">
--rebuild-indexes
</code>
</a>
at the
end of the restore process causes this index to be dropped.)
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_append">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_append">
<code class="option">
--append
</code>
</a>
</p>
<a class="indexterm" name="idm46045099734816">
</a>
<a class="indexterm" name="idm46045099733328">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for append">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--append
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
When used with the
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_tab">
<code class="option">
--tab
</code>
</a>
and
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_print-data">
<code class="option">
--print-data
</code>
</a>
options, this causes the data to be appended to any existing
files having the same names.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_backup-path">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_backup-path">
<code class="option">
--backup-path
</code>
</a>
=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</p>
<a class="indexterm" name="idm46045099720880">
</a>
<a class="indexterm" name="idm46045099719392">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for backup-path">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--backup-path=path
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Directory name
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
./
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The path to the backup directory is required; this is
supplied to
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
using the
<code class="option">
--backup-path
</code>
option, and must include the
subdirectory corresponding to the ID backup of the backup to
be restored. For example, if the data node's
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datadir">
<code class="literal">
DataDir
</code>
</a>
is
<code class="filename">
/var/lib/mysql-cluster
</code>
, then the backup
directory is
<code class="filename">
/var/lib/mysql-cluster/BACKUP
</code>
, and the
backup files for the backup with the ID 3 can be found in
<code class="filename">
/var/lib/mysql-cluster/BACKUP/BACKUP-3
</code>
.
The path may be absolute or relative to the directory in
which the
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
executable is
located, and may be optionally prefixed with
<code class="option">
backup-path=
</code>
.
</p>
<p>
It is possible to restore a backup to a database with a
different configuration than it was created from. For
example, suppose that a backup with backup ID
<code class="literal">
12
</code>
, created in a cluster with two storage
nodes having the node IDs
<code class="literal">
2
</code>
and
<code class="literal">
3
</code>
, is to be restored to a cluster with
four nodes. Then
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
must be run
twice—once for each storage node in the cluster where
the backup was taken. However,
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
cannot always restore backups
made from a cluster running one version of MySQL to a
cluster running a different MySQL version. See
<a class="xref" href="mysql-cluster-upgrade-downgrade.html" title="25.3.7 Upgrading and Downgrading NDB Cluster">
Section 25.3.7, “Upgrading and Downgrading NDB Cluster”
</a>
, for more
information.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
It is not possible to restore a backup made from a newer
version of NDB Cluster using an older version of
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
. You can restore a backup
made from a newer version of MySQL to an older cluster,
but you must use a copy of
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
from the newer NDB Cluster version to do so.
</p>
<p>
For example, to restore a cluster backup taken from a
cluster running NDB Cluster 8.4.0 to a
cluster running NDB Cluster 8.0.41, you
must use the
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
that comes
with the NDB Cluster 8.0.41
distribution.
</p>
</div>
<p>
For more rapid restoration, the data may be restored in
parallel, provided that there is a sufficient number of
cluster connections available. That is, when restoring to
multiple nodes in parallel, you must have an
<code class="literal">
[api]
</code>
or
<code class="literal">
[mysqld]
</code>
section in the cluster
<code class="filename">
config.ini
</code>
file
available for each concurrent
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
process. However, the data files must always be applied
before the logs.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_backup-password">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_backup-password">
<code class="option">
--backup-password=
<em class="replaceable">
<code>
password
</code>
</em>
</code>
</a>
</p>
<a class="indexterm" name="idm46045099680560">
</a>
<a class="indexterm" name="idm46045099679072">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for backup-password">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--backup-password=password
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This option specifies a password to be used when decrypting
an encrypted backup with the
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_decrypt">
<code class="option">
--decrypt
</code>
</a>
option. This
must be the same password that was used to encrypt the
backup.
</p>
<p>
The password must be 1 to 256 characters in length, and must
be enclosed by single or double quotation marks. It can
contain any of the ASCII characters having character codes
32, 35, 38, 40-91, 93, 95, and 97-126; in other words, it
can use any printable ASCII characters except for
<code class="literal">
!
</code>
,
<code class="literal">
'
</code>
,
<code class="literal">
"
</code>
,
<code class="literal">
$
</code>
,
<code class="literal">
%
</code>
,
<code class="literal">
\
</code>
, and
<code class="literal">
^
</code>
.
</p>
<p>
It is possible to omit the password, in which case
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
waits for it to be supplied
from
<code class="literal">
stdin
</code>
, as when using
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_backup-password-from-stdin">
<code class="option">
--backup-password-from-stdin
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_backup-password-from-stdin">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_backup-password-from-stdin">
<code class="option">
--backup-password-from-stdin[=TRUE|FALSE]
</code>
</a>
</p>
<a class="indexterm" name="idm46045099654432">
</a>
<a class="indexterm" name="idm46045099652928">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for backup-password-from-stdin">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--backup-password-from-stdin
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
When used in place of
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_backup-password">
<code class="option">
--backup-password
</code>
</a>
, this
option enables input of the backup password from the system
shell (
<code class="literal">
stdin
</code>
), similar to how this is
done when supplying the password interactively 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>
when using the
<a class="link" href="mysql-command-options.html#option_mysql_password">
<code class="option">
--password
</code>
</a>
without supplying
the password on the command line.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_backupid">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_backupid">
<code class="option">
--backupid
</code>
</a>
=
<em class="replaceable">
<code>
#
</code>
</em>
,
<code class="option">
-b
</code>
</p>
<a class="indexterm" name="idm46045099638128">
</a>
<a class="indexterm" name="idm46045099636640">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for backupid">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--backupid=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
none
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This option is required; it is used to specify the ID or
sequence number of the backup, and is the same number shown
by the management client in the
<code class="literal">
Backup
<em class="replaceable">
<code>
backup_id
</code>
</em>
completed
</code>
message displayed upon completion of a backup. (See
<a class="xref" href="mysql-cluster-backup-using-management-client.html" title="25.6.8.2 Using The NDB Cluster Management Client to Create a Backup">
Section 25.6.8.2, “Using The NDB Cluster Management Client to Create a Backup”
</a>
.)
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
When restoring cluster backups, you must be sure to
restore all data nodes from backups having the same backup
ID. Using files from different backups results at best in
restoring the cluster to an inconsistent state, and is
likely to fail altogether.
</p>
</div>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_character-sets-dir">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_character-sets-dir">
<code class="option">
--character-sets-dir
</code>
</a>
</p>
<a class="indexterm" name="idm46045099619168">
</a>
<a class="indexterm" name="idm46045099617712">
</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_restore_connect">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_connect">
<code class="option">
--connect
</code>
</a>
,
<code class="option">
-c
</code>
</p>
<a class="indexterm" name="idm46045099607440">
</a>
<a class="indexterm" name="idm46045099605952">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for connect">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--connect=connection_string
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
localhost:1186
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Alias for
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_connect-retries">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_connect-retries">
<code class="option">
--connect-retries
</code>
</a>
</p>
<a class="indexterm" name="idm46045099590672">
</a>
<a class="indexterm" name="idm46045099589184">
</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_restore_connect-retry-delay">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_connect-retry-delay">
<code class="option">
--connect-retry-delay
</code>
</a>
</p>
<a class="indexterm" name="idm46045099570160">
</a>
<a class="indexterm" name="idm46045099568704">
</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_restore_connect-string">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_connect-string">
<code class="option">
--connect-string
</code>
</a>
</p>
<a class="indexterm" name="idm46045099549456">
</a>
<a class="indexterm" name="idm46045099547968">
</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-restore.html#option_ndb_restore_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_core-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_core-file">
<code class="option">
--core-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045099532656">
</a>
<a class="indexterm" name="idm46045099531168">
</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_restore_decrypt">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_decrypt">
<code class="option">
--decrypt
</code>
</a>
</p>
<a class="indexterm" name="idm46045099521504">
</a>
<a class="indexterm" name="idm46045099520016">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for decrypt">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--decrypt
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Decrypt an encrypted backup using the password supplied by
the
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_backup-password">
<code class="option">
--backup-password
</code>
</a>
option.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_defaults-extra-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_defaults-extra-file">
<code class="option">
--defaults-extra-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045099509280">
</a>
<a class="indexterm" name="idm46045099507824">
</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_restore_defaults-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_defaults-file">
<code class="option">
--defaults-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045099493472">
</a>
<a class="indexterm" name="idm46045099491984">
</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_restore_defaults-group-suffix">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_defaults-group-suffix">
<code class="option">
--defaults-group-suffix
</code>
</a>
</p>
<a class="indexterm" name="idm46045099477696">
</a>
<a class="indexterm" name="idm46045099476192">
</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_restore_disable-indexes">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_disable-indexes">
<code class="option">
--disable-indexes
</code>
</a>
</p>
<a class="indexterm" name="idm46045099462080">
</a>
<a class="indexterm" name="idm46045099460592">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for disable-indexes">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--disable-indexes
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Disable restoration of indexes during restoration of the
data from a native
<code class="literal">
NDB
</code>
backup.
Afterwards, you can restore indexes for all tables at once
with multithreaded building of indexes using
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_rebuild-indexes">
<code class="option">
--rebuild-indexes
</code>
</a>
, which
should be faster than rebuilding indexes concurrently for
very large tables.
</p>
<p>
This option also drops any foreign keys specified in the
backup.
</p>
<p>
MySQL can open an
<code class="literal">
NDB
</code>
table for which one
or more indexes cannot be found, provided the query does not
use any of the affected indexes; otherwise the query is
rejected with
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_not_keyfile" target="_top">
<code class="literal">
ER_NOT_KEYFILE
</code>
</a>
. In the
latter case, you can temporarily work around the problem by
executing an
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statement such as this one:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa873374"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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 <span class="token keyword">ALTER</span> <span class="token keyword">INDEX</span> idx <span class="token keyword">INVISIBLE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
This causes MySQL to ignore the index
<code class="literal">
idx
</code>
on table
<code class="literal">
tbl
</code>
. See
<a class="xref" href="alter-table.html#alter-table-index" title="Primary Keys and Indexes">
Primary Keys and Indexes
</a>
, for more information,
as well as
<a class="xref" href="invisible-indexes.html" title="10.3.12 Invisible Indexes">
Section 10.3.12, “Invisible Indexes”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_dont-ignore-systab-0">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_dont-ignore-systab-0">
<code class="option">
--dont-ignore-systab-0
</code>
</a>
,
<code class="option">
-f
</code>
</p>
<a class="indexterm" name="idm46045099440000">
</a>
<a class="indexterm" name="idm46045099438544">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for dont-ignore-systab-0">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--dont-ignore-systab-0
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Normally, when restoring table data and metadata,
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
ignores the copy of the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
system table that is
present in the backup.
<code class="option">
--dont-ignore-systab-0
</code>
causes the system
table to be restored.
<span class="emphasis">
<em>
This option is intended for
experimental and development use only, and is not
recommended in a production environment
</em>
</span>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_exclude-databases">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_exclude-databases">
<code class="option">
--exclude-databases
</code>
</a>
=
<em class="replaceable">
<code>
db-list
</code>
</em>
</p>
<a class="indexterm" name="idm46045099424752">
</a>
<a class="indexterm" name="idm46045099423296">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for exclude-databases">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--exclude-databases=list
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Comma-delimited list of one or more databases which should
not be restored.
</p>
<p>
This option is often used in combination with
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_exclude-tables">
<code class="option">
--exclude-tables
</code>
</a>
; see
that option's description for further information and
examples.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_exclude-intermediate-sql-tables">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_exclude-intermediate-sql-tables">
<code class="option">
--exclude-intermediate-sql-tables[
</code>
</a>
=
<em class="replaceable">
<code>
TRUE|FALSE]
</code>
</em>
</p>
<a class="indexterm" name="idm46045099406816">
</a>
<a class="indexterm" name="idm46045099405312">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for exclude-intermediate-sql-tables">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--exclude-intermediate-sql-tables[=TRUE|FALSE]
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Boolean
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
TRUE
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
When performing copying
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
operations,
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
creates intermediate tables (whose names are prefixed with
<code class="literal">
#sql-
</code>
). When
<code class="literal">
TRUE
</code>
, the
<code class="option">
--exclude-intermediate-sql-tables
</code>
option
keeps
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
from restoring such
tables that may have been left over from these operations.
This option is
<code class="literal">
TRUE
</code>
by default.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_exclude-missing-columns">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_exclude-missing-columns">
<code class="option">
--exclude-missing-columns
</code>
</a>
</p>
<a class="indexterm" name="idm46045099384464">
</a>
<a class="indexterm" name="idm46045099382960">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for exclude-missing-columns">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--exclude-missing-columns
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
It is possible to restore only selected table columns using
this option, which causes
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
to
ignore any columns missing from tables being restored as
compared to the versions of those tables found in the
backup. This option applies to all tables being restored. If
you wish to apply this option only to selected tables or
databases, you can use it in combination with one or more of
the
<code class="option">
--include-*
</code>
or
<code class="option">
--exclude-*
</code>
options described elsewhere in
this section to do so, then restore data to the remaining
tables using a complementary set of these options.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_exclude-missing-tables">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_exclude-missing-tables">
<code class="option">
--exclude-missing-tables
</code>
</a>
</p>
<a class="indexterm" name="idm46045099370288">
</a>
<a class="indexterm" name="idm46045099368784">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for exclude-missing-tables">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--exclude-missing-tables
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
It is possible to restore only selected tables using this
option, which causes
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
to
ignore any tables from the backup that are not found in the
target database.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_exclude-tables">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_exclude-tables">
<code class="option">
--exclude-tables
</code>
</a>
=
<em class="replaceable">
<code>
table-list
</code>
</em>
</p>
<a class="indexterm" name="idm46045099357280">
</a>
<a class="indexterm" name="idm46045099355792">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for exclude-tables">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--exclude-tables=list
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
List of one or more tables to exclude; each table reference
must include the database name. Often used together with
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_exclude-databases">
<code class="option">
--exclude-databases
</code>
</a>
.
</p>
<p>
When
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_exclude-databases">
<code class="option">
--exclude-databases
</code>
</a>
or
<code class="option">
--exclude-tables
</code>
is used, only those
databases or tables named by the option are excluded; all
other databases and tables are restored by
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
.
</p>
<p>
This table shows several invocations of
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
using
<code class="option">
--exclude-*
</code>
options (other options possibly
required have been omitted for clarity), and the effects
these options have on restoring from an NDB Cluster backup:
</p>
<div class="table">
<a name="idm46045099337280">
</a>
<p class="title">
<b>
Table 25.23 Several invocations of ndb_restore using --exclude-*
options, and the effects these options have on restoring from an
NDB Cluster backup.
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col style="width: 50%"/>
<col style="width: 50%"/>
</colgroup>
<thead>
<tr>
<th>
Option
</th>
<th>
Result
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code class="option">
--exclude-databases=db1
</code>
</td>
<td>
All tables in all databases except
<code class="literal">
db1
</code>
are restored;
no tables in
<code class="literal">
db1
</code>
are restored
</td>
</tr>
<tr>
<td>
<code class="option">
--exclude-databases=db1,db2
</code>
(or
<code class="option">
--exclude-databases=db1
</code>
<code class="option">
--exclude-databases=db2
</code>
)
</td>
<td>
All tables in all databases except
<code class="literal">
db1
</code>
and
<code class="literal">
db2
</code>
are restored; no tables in
<code class="literal">
db1
</code>
or
<code class="literal">
db2
</code>
are
restored
</td>
</tr>
<tr>
<td>
<code class="option">
--exclude-tables=db1.t1
</code>
</td>
<td>
All tables except
<code class="literal">
t1
</code>
in database
<code class="literal">
db1
</code>
are restored; all other tables
in
<code class="literal">
db1
</code>
are restored; all tables in
all other databases are restored
</td>
</tr>
<tr>
<td>
<code class="option">
--exclude-tables=db1.t2,db2.t1
</code>
(or
<code class="option">
--exclude-tables=db1.t2
</code>
<code class="option">
--exclude-tables=db2.t1)
</code>
</td>
<td>
All tables in database
<code class="literal">
db1
</code>
except for
<code class="literal">
t2
</code>
and all tables in database
<code class="literal">
db2
</code>
except for table
<code class="literal">
t1
</code>
are restored; no other tables in
<code class="literal">
db1
</code>
or
<code class="literal">
db2
</code>
are
restored; all tables in all other databases are
restored
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
You can use these two options together. For example, the
following causes all tables in all databases
<span class="emphasis">
<em>
except for
</em>
</span>
databases
<code class="literal">
db1
</code>
and
<code class="literal">
db2
</code>
, and
tables
<code class="literal">
t1
</code>
and
<code class="literal">
t2
</code>
in
database
<code class="literal">
db3
</code>
, to be restored:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa28461299"><div class="copy-help left">Press ⌘+C to 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_restore</span> <span class="token punctuation">[</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">]</span> <span class="token constant">--exclude-databases</span><span class="token attr-value"><span class="token punctuation">=</span>db1,db2</span> <span class="token constant">--exclude-tables</span><span class="token attr-value"><span class="token punctuation">=</span>db3.t1,db3.t2</span></code></pre>
</div>
<p>
(Again, we have omitted other possibly necessary options in
the interest of clarity and brevity from the example just
shown.)
</p>
<p>
You can use
<code class="option">
--include-*
</code>
and
<code class="option">
--exclude-*
</code>
options together, subject to
the following rules:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The actions of all
<code class="option">
--include-*
</code>
and
<code class="option">
--exclude-*
</code>
options are cumulative.
</p>
</li>
<li class="listitem">
<p>
All
<code class="option">
--include-*
</code>
and
<code class="option">
--exclude-*
</code>
options are evaluated in
the order passed to ndb_restore, from right to left.
</p>
</li>
<li class="listitem">
<p>
In the event of conflicting options, the first
(rightmost) option takes precedence. In other words, the
first option (going from right to left) that matches
against a given database or table
<span class="quote">
“
<span class="quote">
wins
</span>
”
</span>
.
</p>
</li>
</ul>
</div>
<p>
For example, the following set of options causes
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
to restore all tables from
database
<code class="literal">
db1
</code>
except
<code class="literal">
db1.t1
</code>
, while restoring no other tables
from any other databases:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa78362150"><div class="copy-help left">Press ⌘+C to 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">--include-databases</span><span class="token attr-value"><span class="token punctuation">=</span>db1</span> <span class="token constant">--exclude-tables</span><span class="token attr-value"><span class="token punctuation">=</span>db1.t1</span></code></pre>
</div>
<p>
However, reversing the order of the options just given
simply causes all tables from database
<code class="literal">
db1
</code>
to be restored (including
<code class="literal">
db1.t1
</code>
, but no tables from any other
database), because the
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_include-databases">
<code class="option">
--include-databases
</code>
</a>
option, being farthest to the right, is the first match
against database
<code class="literal">
db1
</code>
and thus takes
precedence over any other option that matches
<code class="literal">
db1
</code>
or any tables in
<code class="literal">
db1
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa70520475"><div class="copy-help left">Press ⌘+C to 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">--exclude-tables</span><span class="token attr-value"><span class="token punctuation">=</span>db1.t1</span> <span class="token constant">--include-databases</span><span class="token attr-value"><span class="token punctuation">=</span>db1</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_fields-enclosed-by">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_fields-enclosed-by">
<code class="option">
--fields-enclosed-by
</code>
</a>
=
<em class="replaceable">
<code>
char
</code>
</em>
</p>
<a class="indexterm" name="idm46045099283104">
</a>
<a class="indexterm" name="idm46045099281648">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for fields-enclosed-by">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--fields-enclosed-by=char
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Each column value is enclosed by the string passed to this
option (regardless of data type; see the description of
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_fields-optionally-enclosed-by">
<code class="option">
--fields-optionally-enclosed-by
</code>
</a>
).
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_fields-optionally-enclosed-by">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_fields-optionally-enclosed-by">
<code class="option">
--fields-optionally-enclosed-by
</code>
</a>
</p>
<a class="indexterm" name="idm46045099266224">
</a>
<a class="indexterm" name="idm46045099264720">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for fields-optionally-enclosed-by">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--fields-optionally-enclosed-by
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The string passed to this option is used to enclose column
values containing character data (such as
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR
</code>
</a>
,
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
,
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
BINARY
</code>
</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="enum.html" title="13.3.5 The ENUM Type">
<code class="literal">
ENUM
</code>
</a>
).
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_fields-terminated-by">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_fields-terminated-by">
<code class="option">
--fields-terminated-by
</code>
</a>
=
<em class="replaceable">
<code>
char
</code>
</em>
</p>
<a class="indexterm" name="idm46045099243920">
</a>
<a class="indexterm" name="idm46045099242464">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for fields-terminated-by">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--fields-terminated-by=char
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
\t (tab)
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The string passed to this option is used to separate column
values. The default value is a tab character
(
<code class="literal">
\t
</code>
).
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_help">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_help">
<code class="option">
--help
</code>
</a>
</p>
<a class="indexterm" name="idm46045099227456">
</a>
<a class="indexterm" name="idm46045099225968">
</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_restore_hex">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_hex">
<code class="option">
--hex
</code>
</a>
</p>
<a class="indexterm" name="idm46045099216272">
</a>
<a class="indexterm" name="idm46045099214784">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for hex">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--hex
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
If this option is used, all binary values are output in
hexadecimal format.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_ignore-extended-pk-updates">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_ignore-extended-pk-updates">
<code class="option">
--ignore-extended-pk-updates
</code>
</a>
</p>
<a class="indexterm" name="idm46045099204944">
</a>
<a class="indexterm" name="idm46045099203440">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ignore-extended-pk-updates">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ignore-extended-pk-updates[=0|1]
</code>
</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">
0
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
When using
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_allow-pk-changes">
<code class="option">
--allow-pk-changes
</code>
</a>
,
columns which become part of a table's primary key must
not be updated while the backup is being taken; such columns
should keep the same values from the time values are
inserted into them until the rows containing the values are
deleted. If
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
encounters
updates to these columns when restoring a backup, the
restore fails. Because some applications may set values for
all columns when updating a row, even when some column
values are not changed, the backup may include log events
appearing to update columns which are not in fact modified.
In such cases you can set
<code class="option">
--ignore-extended-pk-updates
</code>
to
<code class="literal">
1
</code>
, forcing
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
to ignore such updates.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
When causing these updates to be ignored, the user is
responsible for ensuring that there are no updates to the
values of any columns that become part of the primary key.
</p>
</div>
<p>
For more information, see the description of
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_allow-pk-changes">
<code class="option">
--allow-pk-changes
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_include-databases">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_include-databases">
<code class="option">
--include-databases
</code>
</a>
=
<em class="replaceable">
<code>
db-list
</code>
</em>
</p>
<a class="indexterm" name="idm46045099176272">
</a>
<a class="indexterm" name="idm46045099174816">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for include-databases">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--include-databases=list
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Comma-delimited list of one or more databases to restore.
Often used together with
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_include-tables">
<code class="option">
--include-tables
</code>
</a>
; see
the description of that option for further information and
examples.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_include-stored-grants">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_include-stored-grants">
<code class="option">
--include-stored-grants
</code>
</a>
</p>
<a class="indexterm" name="idm46045099159280">
</a>
<a class="indexterm" name="idm46045099157776">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for include-stored-grants">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--include-stored-grants
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
does not by default restore
shared users and grants (see
<a class="xref" href="mysql-cluster-privilege-synchronization.html" title="25.6.13 Privilege Synchronization and NDB_STORED_USER">
Section 25.6.13, “Privilege Synchronization and NDB_STORED_USER”
</a>
)
to the
<code class="literal">
ndb_sql_metadata
</code>
table. Specifying
this option causes it to do so.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_include-tables">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_include-tables">
<code class="option">
--include-tables
</code>
</a>
=
<em class="replaceable">
<code>
table-list
</code>
</em>
</p>
<a class="indexterm" name="idm46045099145024">
</a>
<a class="indexterm" name="idm46045099143536">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for include-tables">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--include-tables=list
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Comma-delimited list of tables to restore; each table
reference must include the database name.
</p>
<p>
When
<code class="option">
--include-databases
</code>
or
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_include-tables">
<code class="option">
--include-tables
</code>
</a>
is
used, only those databases or tables named by the option are
restored; all other databases and tables are excluded by
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
, and are not restored.
</p>
<p>
The following table shows several invocations of
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
using
<code class="option">
--include-*
</code>
options (other options possibly
required have been omitted for clarity), and the effects
these have on restoring from an NDB Cluster backup:
</p>
<div class="table">
<a name="idm46045099126032">
</a>
<p class="title">
<b>
Table 25.24 Several invocations of ndb_restore using --include-*
options, and their effects on restoring from an NDB Cluster
backup.
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col style="width: 50%"/>
<col style="width: 50%"/>
</colgroup>
<thead>
<tr>
<th>
Option
</th>
<th>
Result
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code class="option">
--include-databases=db1
</code>
</td>
<td>
Only tables in database
<code class="literal">
db1
</code>
are restored; all tables
in all other databases are ignored
</td>
</tr>
<tr>
<td>
<code class="option">
--include-databases=db1,db2
</code>
(or
<code class="option">
--include-databases=db1
</code>
<code class="option">
--include-databases=db2
</code>
)
</td>
<td>
Only tables in databases
<code class="literal">
db1
</code>
and
<code class="literal">
db2
</code>
are restored; all tables in all
other databases are ignored
</td>
</tr>
<tr>
<td>
<code class="option">
--include-tables=db1.t1
</code>
</td>
<td>
Only table
<code class="literal">
t1
</code>
in database
<code class="literal">
db1
</code>
is
restored; no other tables in
<code class="literal">
db1
</code>
or
in any other database are restored
</td>
</tr>
<tr>
<td>
<code class="option">
--include-tables=db1.t2,db2.t1
</code>
(or
<code class="option">
--include-tables=db1.t2
</code>
<code class="option">
--include-tables=db2.t1
</code>
)
</td>
<td>
Only the table
<code class="literal">
t2
</code>
in database
<code class="literal">
db1
</code>
and the table
<code class="literal">
t1
</code>
in database
<code class="literal">
db2
</code>
are restored; no other tables
in
<code class="literal">
db1
</code>
,
<code class="literal">
db2
</code>
, or
any other database are restored
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
You can also use these two options together. For example,
the following causes all tables in databases
<code class="literal">
db1
</code>
and
<code class="literal">
db2
</code>
, together
with the tables
<code class="literal">
t1
</code>
and
<code class="literal">
t2
</code>
in database
<code class="literal">
db3
</code>
, to
be restored (and no other databases or tables):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa45029379"><div class="copy-help left">Press ⌘+C to 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_restore</span> <span class="token punctuation">[</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">]</span> <span class="token constant">--include-databases</span><span class="token attr-value"><span class="token punctuation">=</span>db1,db2</span> <span class="token constant">--include-tables</span><span class="token attr-value"><span class="token punctuation">=</span>db3.t1,db3.t2</span></code></pre>
</div>
<p>
(Again we have omitted other, possibly required, options in
the example just shown.)
</p>
<p>
It also possible to restore only selected databases, or
selected tables from a single database, without any
<code class="option">
--include-*
</code>
(or
<code class="option">
--exclude-*
</code>
) options, using the syntax
shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa4741059"><div class="copy-help left">Press ⌘+C to 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_restore <em class="replaceable">other_options</em> <em class="replaceable">db_name</em><span class="token punctuation">,</span><span class="token punctuation">[</span><em class="replaceable">db_name</em><span class="token punctuation">[</span><span class="token punctuation">,</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">]</span> | <em class="replaceable">tbl_name</em><span class="token punctuation">[</span><span class="token punctuation">,</span><em class="replaceable">tbl_name</em><span class="token punctuation">]</span><span class="token punctuation">[</span><span class="token punctuation">,</span><span 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>
In other words, you can specify either of the following to
be restored:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
All tables from one or more databases
</p>
</li>
<li class="listitem">
<p>
One or more tables from a single database
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_lines-terminated-by">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_lines-terminated-by">
<code class="option">
--lines-terminated-by
</code>
</a>
=
<em class="replaceable">
<code>
char
</code>
</em>
</p>
<a class="indexterm" name="idm46045099084672">
</a>
<a class="indexterm" name="idm46045099083216">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for lines-terminated-by">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--lines-terminated-by=char
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
\n (linebreak)
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Specifies the string used to end each line of output. The
default is a linefeed character (
<code class="literal">
\n
</code>
).
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_login-path">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_login-path">
<code class="option">
--login-path
</code>
</a>
</p>
<a class="indexterm" name="idm46045099068192">
</a>
<a class="indexterm" name="idm46045099066704">
</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_restore_no-login-paths">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_no-login-paths">
<code class="option">
--no-login-paths
</code>
</a>
</p>
<a class="indexterm" name="idm46045099052368">
</a>
<a class="indexterm" name="idm46045099050880">
</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_restore_lossy-conversions">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_lossy-conversions">
<code class="option">
--lossy-conversions
</code>
</a>
,
<code class="option">
-L
</code>
</p>
<a class="indexterm" name="idm46045099040752">
</a>
<a class="indexterm" name="idm46045099039296">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for lossy-conversions">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--lossy-conversions
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This option is intended to complement the
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_promote-attributes">
<code class="option">
--promote-attributes
</code>
</a>
option. Using
<code class="option">
--lossy-conversions
</code>
allows
lossy conversions of column values (type demotions or
changes in sign) when restoring data from backup. With some
exceptions, the rules governing demotion are the same as for
MySQL replication; see
<a class="xref" href="replication-features-differing-tables.html#replication-features-different-data-types" title="19.5.1.9.2 Replication of Columns Having Different Data Types">
Section 19.5.1.9.2, “Replication of Columns Having Different Data Types”
</a>
,
for information about specific type conversions currently
supported by attribute demotion.
</p>
<p>
This option also makes it possible to restore a
<code class="literal">
NULL
</code>
column as
<code class="literal">
NOT
NULL
</code>
. The column must not contain any
<code class="literal">
NULL
</code>
entries; otherwise
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
stops with an error.
</p>
<p>
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
reports any truncation of
data that it performs during lossy conversions once per
attribute and column.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_no-binlog">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_no-binlog">
<code class="option">
--no-binlog
</code>
</a>
</p>
<a class="indexterm" name="idm46045099020912">
</a>
<a class="indexterm" name="idm46045099019424">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for no-binlog">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--no-binlog
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This option prevents any connected SQL nodes from writing
data restored by
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
to their
binary logs.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_no-restore-disk-objects">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_no-restore-disk-objects">
<code class="option">
--no-restore-disk-objects
</code>
</a>
,
<code class="option">
-d
</code>
</p>
<a class="indexterm" name="idm46045099007872">
</a>
<a class="indexterm" name="idm46045099006368">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for no-restore-disk-objects">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--no-restore-disk-objects
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This option stops
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
from
restoring any NDB Cluster Disk Data objects, such as
tablespaces and log file groups; see
<a class="xref" href="mysql-cluster-disk-data.html" title="25.6.11 NDB Cluster Disk Data Tables">
Section 25.6.11, “NDB Cluster Disk Data Tables”
</a>
, for more
information about these.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_no-upgrade">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_no-upgrade">
<code class="option">
--no-upgrade
</code>
</a>
,
<code class="option">
-u
</code>
</p>
<a class="indexterm" name="idm46045098994096">
</a>
<a class="indexterm" name="idm46045098992608">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for no-upgrade">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--no-upgrade
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
When using
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
to restore a
backup,
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
columns
created using the old fixed format are resized and recreated
using the variable-width format now employed. This behavior
can be overridden by specifying
<code class="option">
--no-upgrade
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_ndb-connectstring">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
</p>
<a class="indexterm" name="idm46045098979888">
</a>
<a class="indexterm" name="idm46045098978432">
</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_restore_ndb-mgm-tls">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_ndb-mgm-tls">
<code class="option">
--ndb-mgm-tls
</code>
</a>
</p>
<a class="indexterm" name="idm46045098959392">
</a>
<a class="indexterm" name="idm46045098957904">
</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_restore_ndb-mgmd-host">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_ndb-mgmd-host">
<code class="option">
--ndb-mgmd-host
</code>
</a>
</p>
<a class="indexterm" name="idm46045098936848">
</a>
<a class="indexterm" name="idm46045098935360">
</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-restore.html#option_ndb_restore_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_ndb-nodegroup-map">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_ndb-nodegroup-map">
<code class="option">
--ndb-nodegroup-map
</code>
</a>
=
<em class="replaceable">
<code>
map
</code>
</em>
,
<code class="option">
-z
</code>
</p>
<a class="indexterm" name="idm46045098919376">
</a>
<a class="indexterm" name="idm46045098917872">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-nodegroup-map">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-nodegroup-map=map
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Any value set for this option is ignored, and the option
itself does nothing.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_ndb-nodeid">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_ndb-nodeid">
<code class="option">
--ndb-nodeid
</code>
</a>
</p>
<a class="indexterm" name="idm46045098908048">
</a>
<a class="indexterm" name="idm46045098906560">
</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-restore.html#option_ndb_restore_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_ndb-optimized-node-selection">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_ndb-optimized-node-selection">
<code class="option">
--ndb-optimized-node-selection
</code>
</a>
</p>
<a class="indexterm" name="idm46045098891184">
</a>
<a class="indexterm" name="idm46045098889680">
</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_restore_ndb-tls-search-path">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_ndb-tls-search-path">
<code class="option">
--ndb-tls-search-path
</code>
</a>
</p>
<a class="indexterm" name="idm46045098879264">
</a>
<a class="indexterm" name="idm46045098877808">
</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_restore_no-defaults">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
</p>
<a class="indexterm" name="idm46045098854048">
</a>
<a class="indexterm" name="idm46045098852560">
</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_restore_nodeid">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_nodeid">
<code class="option">
--nodeid
</code>
</a>
=
<em class="replaceable">
<code>
#
</code>
</em>
,
<code class="option">
-n
</code>
</p>
<a class="indexterm" name="idm46045098841936">
</a>
<a class="indexterm" name="idm46045098840448">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for nodeid">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--nodeid=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
none
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Specify the node ID of the data node on which the backup was
taken; required.
</p>
<p>
When restoring to a cluster with different number of data
nodes from that where the backup was taken, this information
helps identify the correct set or sets of files to be
restored to a given node. (In such cases, multiple files
usually need to be restored to a single data node.) See
<a class="ulink" href="/doc/refman/8.0/en/ndb-restore-different-number-nodes.html" target="_top">
Restoring to a different number of data nodes
</a>
, for
additional information and examples.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_num-slices">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_num-slices">
<code class="option">
--num-slices
</code>
</a>
=
<em class="replaceable">
<code>
#
</code>
</em>
</p>
<a class="indexterm" name="idm46045098823776">
</a>
<a class="indexterm" name="idm46045098822288">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for num-slices">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--num-slices=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
1
</code>
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
1
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1024
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
When restoring a backup by slices, this option sets the
number of slices into which to divide the backup. This
allows multiple instances of
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
to restore disjoint subsets in parallel, potentially
reducing the amount of time required to perform the restore
operation.
</p>
<p>
A
<span class="emphasis">
<em>
slice
</em>
</span>
is a subset of the data in a
given backup; that is, it is a set of fragments having the
same slice ID, specified using the
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_slice-id">
<code class="option">
--slice-id
</code>
</a>
option. The
two options must always be used together, and the value set
by
<code class="option">
--slice-id
</code>
must always be less than the
number of slices.
</p>
<p>
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
encounters fragments and
assigns each one a fragment counter. When restoring by
slices, a slice ID is assigned to each fragment; this slice
ID is in the range 0 to 1 less than the number of slices.
For a table that is not a
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
table, the slice to
which a given fragment belongs is determined using the
formula shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa27538780"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple"><span class="token punctuation">[</span><em class="replaceable">slice_ID</em><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token punctuation">[</span><em class="replaceable">fragment_counter</em><span class="token punctuation">]</span> <span class="token operator">%</span> <span class="token punctuation">[</span><em class="replaceable">number_of_slices</em><span class="token punctuation">]</span></code></pre>
</div>
<p>
For a
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
table, a fragment
counter is not used; the fragment number is used instead,
along with the ID of the main table for the
<code class="literal">
BLOB
</code>
table (recall that
<code class="literal">
NDB
</code>
stores
<em class="replaceable">
<code>
BLOB
</code>
</em>
values in a separate table
internally). In this case, the slice ID for a given fragment
is calculated as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa28230096"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple"><span class="token punctuation">[</span><em class="replaceable">slice_ID</em><span class="token punctuation">]</span> <span class="token operator">=</span>
<span class="token punctuation">(</span><span class="token punctuation">[</span><em class="replaceable">main_table_ID</em><span class="token punctuation">]</span> <span class="token operator">+</span> <span class="token punctuation">[</span><em class="replaceable">fragment_ID</em><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token operator">%</span> <span class="token punctuation">[</span><em class="replaceable">number_of_slices</em><span class="token punctuation">]</span></code></pre>
</div>
<p>
Thus, restoring by
<em class="replaceable">
<code>
N
</code>
</em>
slices means
running
<em class="replaceable">
<code>
N
</code>
</em>
instances of
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
, all with
<code class="option">
--num-slices=
<em class="replaceable">
<code>
N
</code>
</em>
</code>
(along with any other necessary options) and one each with
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_slice-id">
<code class="option">
--slice-id=1
</code>
</a>
,
<code class="option">
--slice-id=2
</code>
,
<code class="option">
--slice-id=3
</code>
, and so on through
<code class="option">
slice-id=
<em class="replaceable">
<code>
N
</code>
</em>
-1
</code>
.
</p>
<p>
<b>
Example.
</b>
Assume that you want to restore a backup named
<code class="filename">
BACKUP-1
</code>
, found in the default
directory
<code class="filename">
/var/lib/mysql-cluster/BACKUP/BACKUP-3
</code>
on the node file system on each data node, to a cluster
with four data nodes having the node IDs 1, 2, 3, and 4.
To perform this operation using five slices, execute the
sets of commands shown in the following list:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Restore the cluster metadata using
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa78573201"><div class="copy-help left">Press ⌘+C to 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_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 1 <span class="token property">-m</span> <span class="token property">--disable-indexes</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/home/ndbuser/backups</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Restore the cluster data to the data nodes invoking
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa68788424"><div class="copy-help left">Press ⌘+C to 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_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 1 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>0</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span>
<span class="token prompt">$> </span><span class="token command">ndb_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 1 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>1</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span>
<span class="token prompt">$> </span><span class="token command">ndb_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 1 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>2</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span>
<span class="token prompt">$> </span><span class="token command">ndb_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 1 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>3</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span>
<span class="token prompt">$> </span><span class="token command">ndb_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 1 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>4</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span>
<span class="token prompt">$> </span><span class="token command">ndb_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 2 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>0</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span>
<span class="token prompt">$> </span><span class="token command">ndb_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 2 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>1</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span>
<span class="token prompt">$> </span><span class="token command">ndb_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 2 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>2</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span>
<span class="token prompt">$> </span><span class="token command">ndb_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 2 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>3</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span>
<span class="token prompt">$> </span><span class="token command">ndb_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 2 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>4</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span>
<span class="token prompt">$> </span><span class="token command">ndb_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 3 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>0</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span>
<span class="token prompt">$> </span><span class="token command">ndb_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 3 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>1</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span>
<span class="token prompt">$> </span><span class="token command">ndb_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 3 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>2</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span>
<span class="token prompt">$> </span><span class="token command">ndb_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 3 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>3</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span>
<span class="token prompt">$> </span><span class="token command">ndb_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 3 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>4</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span>
<span class="token prompt">$> </span><span class="token command">ndb_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 4 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>0</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span>
<span class="token prompt">$> </span><span class="token command">ndb_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 4 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>1</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span>
<span class="token prompt">$> </span><span class="token command">ndb_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 4 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>2</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span>
<span class="token prompt">$> </span><span class="token command">ndb_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 4 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>3</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span>
<span class="token prompt">$> </span><span class="token command">ndb_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 4 <span class="token property">-r</span> <span class="token constant">--num-slices</span><span class="token attr-value"><span class="token punctuation">=</span>5</span> <span class="token constant">--slice-id</span><span class="token attr-value"><span class="token punctuation">=</span>4</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span></code></pre>
</div>
<p>
All of the commands just shown in this step can be
executed in parallel, provided there are enough slots
for connections to the cluster (see the description for
the
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_backup-path">
<code class="option">
--backup-path
</code>
</a>
option).
</p>
</li>
<li class="listitem">
<p>
Restore indexes as usual, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa17741601"><div class="copy-help left">Press ⌘+C to 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_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 1 <span class="token property">--rebuild-indexes</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Finally, restore the epoch, using the command shown
here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa75584834"><div class="copy-help left">Press ⌘+C to 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_restore</span> <span class="token property">-b</span> 1 <span class="token property">-n</span> 1 <span class="token property">--restore-epoch</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql-cluster/BACKUP/BACKUP-1</span></code></pre>
</div>
</li>
</ol>
</div>
<p>
You should use slicing to restore the cluster data only; it
is not necessary to employ
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_num-slices">
<code class="option">
--num-slices
</code>
</a>
or
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_slice-id">
<code class="option">
--slice-id
</code>
</a>
when
restoring the metadata, indexes, or epoch information. If
either or both of these options are used with the
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
options controlling
restoration of these, the program ignores them.
</p>
<p>
The effects of using the
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_parallelism">
<code class="option">
--parallelism
</code>
</a>
option on
the speed of restoration are independent of those produced
by slicing or parallel restoration using multiple instances
of
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
(
<code class="option">
--parallelism
</code>
specifies the number of
parallel transactions executed by a
<span class="emphasis">
<em>
single
</em>
</span>
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
thread), but it can be used together with either or both of
these. You should be aware that increasing
<code class="option">
--parallelism
</code>
causes
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
to impose a greater load on
the cluster; if the system can handle this, restoration
should complete even more quickly.
</p>
<p>
The value of
<code class="option">
--num-slices
</code>
is not directly
dependent on values relating to hardware such as number of
CPUs or CPU cores, amount of RAM, and so forth, nor does it
depend on the number of LDMs.
</p>
<p>
It is possible to employ different values for this option on
different data nodes as part of the same restoration; doing
so should not in and of itself produce any ill effects.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_parallelism">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_parallelism">
<code class="option">
--parallelism
</code>
</a>
=
<em class="replaceable">
<code>
#
</code>
</em>
,
<code class="option">
-p
</code>
</p>
<a class="indexterm" name="idm46045098733168">
</a>
<a class="indexterm" name="idm46045098731680">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for parallelism">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--parallelism=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
128
</code>
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
1
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1024
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
uses single-row transactions
to apply many rows concurrently. This parameter determines
the number of parallel transactions (concurrent rows) that
an instance of
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
tries to use.
By default, this is 128; the minimum is 1, and the maximum
is 1024.
</p>
<p>
The work of performing the inserts is parallelized across
the threads in the data nodes involved. This mechanism is
employed for restoring bulk data from the
<code class="filename">
.Data
</code>
file—that is, the fuzzy
snapshot of the data; it is not used for building or
rebuilding indexes. The change log is applied serially;
index drops and builds are DDL operations and handled
separately. There is no thread-level parallelism on the
client side of the restore.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_preserve-trailing-spaces">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_preserve-trailing-spaces">
<code class="option">
--preserve-trailing-spaces
</code>
</a>
,
<code class="option">
-P
</code>
</p>
<a class="indexterm" name="idm46045098707424">
</a>
<a class="indexterm" name="idm46045098705920">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for preserve-trailing-spaces">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--preserve-trailing-spaces
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Cause trailing spaces to be preserved when promoting a
fixed-width character data type to its variable-width
equivalent—that is, when promoting a
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR
</code>
</a>
column value to
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
, or a
<code class="literal">
BINARY
</code>
column value to
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
. Otherwise, any
trailing spaces are dropped from such column values when
they are inserted into the new columns.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Although you can promote
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR
</code>
</a>
columns to
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
and
<code class="literal">
BINARY
</code>
columns to
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
, you cannot
promote
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
columns to
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR
</code>
</a>
or
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
columns to
<code class="literal">
BINARY
</code>
.
</p>
</div>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_print">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_print">
<code class="option">
--print
</code>
</a>
</p>
<a class="indexterm" name="idm46045098681456">
</a>
<a class="indexterm" name="idm46045098679968">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for print">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--print
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Causes
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
to print all data,
metadata, and logs to
<code class="literal">
stdout
</code>
. Equivalent
to using the
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_print-data">
<code class="option">
--print-data
</code>
</a>
,
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_print-meta">
<code class="option">
--print-meta
</code>
</a>
, and
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_print-log">
<code class="option">
--print-log
</code>
</a>
options
together.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Use of
<code class="option">
--print
</code>
or any of the
<code class="option">
--print_*
</code>
options is in effect performing
a dry run. Including one or more of these options causes
any output to be redirected to
<code class="literal">
stdout
</code>
;
in such cases,
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
makes no
attempt to restore data or metadata to an NDB Cluster.
</p>
</div>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_print-data">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_print-data">
<code class="option">
--print-data
</code>
</a>
</p>
<a class="indexterm" name="idm46045098661104">
</a>
<a class="indexterm" name="idm46045098659616">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for print-data">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--print-data
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Cause
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
to direct its output to
<code class="literal">
stdout
</code>
. Often used together with one or
more of
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_tab">
<code class="option">
--tab
</code>
</a>
,
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_fields-enclosed-by">
<code class="option">
--fields-enclosed-by
</code>
</a>
,
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_fields-optionally-enclosed-by">
<code class="option">
--fields-optionally-enclosed-by
</code>
</a>
,
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_fields-terminated-by">
<code class="option">
--fields-terminated-by
</code>
</a>
,
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_hex">
<code class="option">
--hex
</code>
</a>
, and
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_append">
<code class="option">
--append
</code>
</a>
.
</p>
<p>
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
and
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
column values are always
truncated. Such values are truncated to the first 256 bytes
in the output. This cannot currently be overridden when
using
<code class="option">
--print-data
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_print-defaults">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_print-defaults">
<code class="option">
--print-defaults
</code>
</a>
</p>
<a class="indexterm" name="idm46045098638512">
</a>
<a class="indexterm" name="idm46045098637024">
</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_restore_print-log">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_print-log">
<code class="option">
--print-log
</code>
</a>
</p>
<a class="indexterm" name="idm46045098627424">
</a>
<a class="indexterm" name="idm46045098625936">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for print-log">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--print-log
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Cause
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
to output its log to
<code class="literal">
stdout
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_print-meta">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_print-meta">
<code class="option">
--print-meta
</code>
</a>
</p>
<a class="indexterm" name="idm46045098614320">
</a>
<a class="indexterm" name="idm46045098612832">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for print-meta">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--print-meta
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Print all metadata to
<code class="literal">
stdout
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_print-sql-log">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_print-sql-log">
<code class="option">
print-sql-log
</code>
</a>
</p>
<a class="indexterm" name="idm46045098602368">
</a>
<a class="indexterm" name="idm46045098600880">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for print-sql-log">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--print-sql-log
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Log SQL statements to
<code class="literal">
stdout
</code>
. Use the
option to enable; normally this behavior is disabled. The
option checks before attempting to log whether all the
tables being restored have explicitly defined primary keys;
queries on a table having only the hidden primary key
implemented by
<code class="literal">
NDB
</code>
cannot be converted to
valid SQL.
</p>
<p>
This option does not work with tables having
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
columns.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_progress-frequency">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_progress-frequency">
<code class="option">
--progress-frequency
</code>
</a>
=
<em class="replaceable">
<code>
N
</code>
</em>
</p>
<a class="indexterm" name="idm46045098587232">
</a>
<a class="indexterm" name="idm46045098585776">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for progress-frequency">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--progress-frequency=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
0
</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">
65535
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Print a status report each
<em class="replaceable">
<code>
N
</code>
</em>
seconds while the backup is in progress. 0 (the default)
causes no status reports to be printed. The maximum is
65535.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_promote-attributes">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_promote-attributes">
<code class="option">
--promote-attributes
</code>
</a>
,
<code class="option">
-A
</code>
</p>
<a class="indexterm" name="idm46045098565760">
</a>
<a class="indexterm" name="idm46045098564304">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for promote-attributes">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--promote-attributes
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
supports limited
<span class="firstterm">
attribute promotion
</span>
in
much the same way that it is supported by MySQL replication;
that is, data backed up from a column of a given type can
generally be restored to a column using a
<span class="quote">
“
<span class="quote">
larger,
similar
</span>
”
</span>
type. For example, data from a
<code class="literal">
CHAR(20)
</code>
column can be restored to a
column declared as
<code class="literal">
VARCHAR(20)
</code>
,
<code class="literal">
VARCHAR(30)
</code>
, or
<code class="literal">
CHAR(30)
</code>
; data from 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">
MEDIUMINT
</code>
</a>
column can be
restored to a column of type
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
INT
</code>
</a>
or
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
. See
<a class="xref" href="replication-features-differing-tables.html#replication-features-different-data-types" title="19.5.1.9.2 Replication of Columns Having Different Data Types">
Section 19.5.1.9.2, “Replication of Columns Having Different Data Types”
</a>
,
for a table of type conversions currently supported by
attribute promotion.
</p>
<p>
This option also makes it possible to restore a
<code class="literal">
NOT
NULL
</code>
column as
<code class="literal">
NULL
</code>
.
</p>
<p>
Attribute promotion by
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
must
be enabled explicitly, as follows:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Prepare the table to which the backup is to be restored.
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
cannot be used to
re-create the table with a different definition from the
original; this means that you must either create the
table manually, or alter the columns which you wish to
promote using
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
after restoring the table metadata but before restoring
the data.
</p>
</li>
<li class="listitem">
<p>
Invoke
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
with the
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_promote-attributes">
<code class="option">
--promote-attributes
</code>
</a>
option (short form
<code class="option">
-A
</code>
) when restoring
the table data. Attribute promotion does not occur if
this option is not used; instead, the restore operation
fails with an error.
</p>
</li>
</ol>
</div>
<p>
When converting between character data types and
<code class="literal">
TEXT
</code>
or
<code class="literal">
BLOB
</code>
, only
conversions between character types
(
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR
</code>
</a>
and
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
) and binary types
(
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
BINARY
</code>
</a>
and
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
) can be performed
at the same time. For example, you cannot promote an
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
INT
</code>
</a>
column to
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
while promoting a
<code class="literal">
VARCHAR
</code>
column to
<code class="literal">
TEXT
</code>
in the same invocation of
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
.
</p>
<p>
Converting between
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
columns using different character sets is not supported, and
is expressly disallowed.
</p>
<p>
When performing conversions of character or binary types to
<code class="literal">
TEXT
</code>
or
<code class="literal">
BLOB
</code>
with
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
, you may notice that it
creates and uses one or more staging tables named
<code class="literal">
<em class="replaceable">
<code>
table_name
</code>
</em>
$ST
<em class="replaceable">
<code>
node_id
</code>
</em>
</code>
.
These tables are not needed afterwards, and are normally
deleted by
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
following a
successful restoration.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_rebuild-indexes">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_rebuild-indexes">
<code class="option">
--rebuild-indexes
</code>
</a>
</p>
<a class="indexterm" name="idm46045098512640">
</a>
<a class="indexterm" name="idm46045098511152">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for rebuild-indexes">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--rebuild-indexes
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Enable multithreaded rebuilding of the ordered indexes while
restoring a native
<code class="literal">
NDB
</code>
backup. The number
of threads used for building ordered indexes by
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
with this option is
controlled by the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-buildindexthreads">
<code class="literal">
BuildIndexThreads
</code>
</a>
data node configuration parameter and the number of LDMs.
</p>
<a class="indexterm" name="idm46045098500224">
</a>
<p>
It is necessary to use this option only for the first run of
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
; this causes all ordered
indexes to be rebuilt without using
<code class="option">
--rebuild-indexes
</code>
again when restoring
subsequent nodes. You should use this option prior to
inserting new rows into the database; otherwise, it is
possible for a row to be inserted that later causes a unique
constraint violation when trying to rebuild the indexes.
</p>
<p>
Building of ordered indices is parallelized with the number
of LDMs by default. Offline index builds performed during
node and system restarts can be made faster using the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-buildindexthreads">
<code class="literal">
BuildIndexThreads
</code>
</a>
data node configuration parameter; this parameter has no
effect on dropping and rebuilding of indexes by
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
, which is performed online.
</p>
<p>
Rebuilding of unique indexes uses disk write bandwidth for
redo logging and local checkpointing. An insufficient amount
of this bandwidth can lead to redo buffer overload or log
overload errors. In such cases you can run
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
<code class="option">
--rebuild-indexes
</code>
again; the process
resumes at the point where the error occurred. You can also
do this when you have encountered temporary errors. You can
repeat execution of
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
<code class="option">
--rebuild-indexes
</code>
indefinitely; you may be
able to stop such errors by reducing the value of
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_parallelism">
<code class="option">
--parallelism
</code>
</a>
. If the
problem is insufficient space, you can increase the size of
the redo log
(
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-fragmentlogfilesize">
<code class="literal">
FragmentLogFileSize
</code>
</a>
node configuration parameter), or you can increase the speed
at which LCPs are performed
(
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxdiskwritespeed">
<code class="literal">
MaxDiskWriteSpeed
</code>
</a>
and related parameters), in order to free space more
quickly.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_remap-column">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_remap-column">
<code class="option">
--remap-column=
<em class="replaceable">
<code>
db
</code>
</em>
.
<em class="replaceable">
<code>
tbl
</code>
</em>
.
<em class="replaceable">
<code>
col
</code>
</em>
:
<em class="replaceable">
<code>
fn
</code>
</em>
:
<em class="replaceable">
<code>
args
</code>
</em>
</code>
</a>
</p>
<a class="indexterm" name="idm46045098480656">
</a>
<a class="indexterm" name="idm46045098479168">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for remap-column">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--remap-column=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>
When used together with
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_restore-data">
<code class="option">
--restore-data
</code>
</a>
, this
option applies a function to the value of the indicated
column. Values in the argument string are listed here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<em class="replaceable">
<code>
db
</code>
</em>
: Database name, following
any renames performed by
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_rewrite-database">
<code class="option">
--rewrite-database
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
tbl
</code>
</em>
: Table name.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
col
</code>
</em>
: Name of the column to be
updated. This column must be of type
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
INT
</code>
</a>
or
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
. The column can
also be but is not required to be
<code class="literal">
UNSIGNED
</code>
.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
fn
</code>
</em>
: Function name; currently,
the only supported name is
<code class="literal">
offset
</code>
.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
args
</code>
</em>
: Arguments supplied to
the function. Currently, only a single argument, the
size of the offset to be added by the
<code class="literal">
offset
</code>
function, is supported.
Negative values are supported. The size of the argument
cannot exceed that of the signed variant of the
column's type; for example, if
<em class="replaceable">
<code>
col
</code>
</em>
is an
<code class="literal">
INT
</code>
column, then the allowed range of
the argument passed to the
<code class="literal">
offset
</code>
function is
<code class="literal">
-2147483648
</code>
to
<code class="literal">
2147483647
</code>
(see
<a class="xref" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
Section 13.1.2, “Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT,
MEDIUMINT, BIGINT”
</a>
).
</p>
<p>
If applying the offset value to the column would cause
an overflow or underflow, the restore operation fails.
This could happen, for example, if the column is a
<code class="literal">
BIGINT
</code>
, and the option attempts to
apply an offset value of 8 on a row in which the column
value is 4294967291, since
<code class="literal">
4294967291 + 8
= 4294967299 > 4294967295
</code>
.
</p>
</li>
</ul>
</div>
<p>
This option can be useful when you wish to merge data stored
in multiple source instances of NDB Cluster (all using the
same schema) into a single destination NDB Cluster, using
NDB native backup (see
<a class="xref" href="mysql-cluster-backup-using-management-client.html" title="25.6.8.2 Using The NDB Cluster Management Client to Create a Backup">
Section 25.6.8.2, “Using The NDB Cluster Management Client to Create a Backup”
</a>
)
and
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
to merge the data, where
primary and unique key values are overlapping between source
clusters, and it is necessary as part of the process to
remap these values to ranges that do not overlap. It may
also be necessary to preserve other relationships between
tables. To fulfill such requirements, it is possible to use
the option multiple times in the same invocation of
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
to remap columns of different
tables, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa33435437"><div class="copy-help left">Press ⌘+C to 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_restore</span> <span class="token property">--restore-data</span> <span class="token constant">--remap-column</span><span class="token attr-value"><span class="token punctuation">=</span>hr.employee.id:offset:1000</span> \
<span class="token constant">--remap-column</span><span class="token attr-value"><span class="token punctuation">=</span>hr.manager.id:offset:1000</span> <span class="token constant">--remap-column</span><span class="token attr-value"><span class="token punctuation">=</span>hr.firstaiders.id:offset:1000</span></code></pre>
</div>
<p>
(Other options not shown here may also be used.)
</p>
<p>
<code class="option">
--remap-column
</code>
can also be used to update
multiple columns of the same table. Combinations of multiple
tables and columns are possible. Different offset values can
also be used for different columns of the same table, like
this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa77532522"><div class="copy-help left">Press ⌘+C to 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_restore</span> <span class="token property">--restore-data</span> <span class="token constant">--remap-column</span><span class="token attr-value"><span class="token punctuation">=</span>hr.employee.salary:offset:10000</span> \
<span class="token constant">--remap-column</span><span class="token attr-value"><span class="token punctuation">=</span>hr.employee.hours:offset:-10</span></code></pre>
</div>
<p>
When source backups contain duplicate tables which should
not be merged, you can handle this by using
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_exclude-tables">
<code class="option">
--exclude-tables
</code>
</a>
,
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_exclude-databases">
<code class="option">
--exclude-databases
</code>
</a>
, or
by some other means in your application.
</p>
<p>
Information about the structure and other characteristics of
tables to be merged can obtained 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>
; 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>
tool; and
<a class="link" href="aggregate-functions.html#function_max">
<code class="literal">
MAX()
</code>
</a>
,
<a class="link" href="aggregate-functions.html#function_min">
<code class="literal">
MIN()
</code>
</a>
,
<a class="link" href="information-functions.html#function_last-insert-id">
<code class="literal">
LAST_INSERT_ID()
</code>
</a>
, and other
MySQL functions.
</p>
<p>
Replication of changes from merged to unmerged tables, or
from unmerged to merged tables, in separate instances of NDB
Cluster is not supported.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_restore-data">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_restore-data">
<code class="option">
--restore-data
</code>
</a>
,
<code class="option">
-r
</code>
</p>
<a class="indexterm" name="idm46045098424896">
</a>
<a class="indexterm" name="idm46045098423408">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for restore-data">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--restore-data
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Output
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table data and logs.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_restore-epoch">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_restore-epoch">
<code class="option">
--restore-epoch
</code>
</a>
,
<code class="option">
-e
</code>
</p>
<a class="indexterm" name="idm46045098412096">
</a>
<a class="indexterm" name="idm46045098410608">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for restore-epoch">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--restore-epoch
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Add (or restore) epoch information to the cluster
replication status table. This is useful for starting
replication on an NDB Cluster replica. When this option is
used, the row in the
<code class="literal">
mysql.ndb_apply_status
</code>
having
<code class="literal">
0
</code>
in the
<code class="literal">
id
</code>
column is
updated if it already exists; such a row is inserted if it
does not already exist. (See
<a class="xref" href="mysql-cluster-replication-backups.html" title="25.7.9 NDB Cluster Backups With NDB Cluster Replication">
Section 25.7.9, “NDB Cluster Backups With NDB Cluster Replication”
</a>
.)
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_restore-meta">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_restore-meta">
<code class="option">
--restore-meta
</code>
</a>
,
<code class="option">
-m
</code>
</p>
<a class="indexterm" name="idm46045098397328">
</a>
<a class="indexterm" name="idm46045098395840">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for restore-meta">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--restore-meta
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This option causes
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
to print
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table metadata.
</p>
<p>
The first time you run the
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
restoration program, you also need to restore the metadata.
In other words, you must re-create the database
tables—this can be done by running it with the
<code class="option">
--restore-meta
</code>
(
<code class="option">
-m
</code>
)
option. Restoring the metadata need be done only on a single
data node; this is sufficient to restore it to the entire
cluster.
</p>
<p>
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
uses the default number of
partitions for the target cluster, unless the number of
local data manager threads is also changed from what it was
for data nodes in the original cluster.
</p>
<p>
When using this option, it is recommended that auto
synchronization be disabled by setting
<a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_metadata_check">
<code class="literal">
ndb_metadata_check=OFF
</code>
</a>
until
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
has completed restoring
the metadata, after which it can it turned on again to
synchronize objects newly created in the NDB dictionary.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The cluster should have an empty database when starting to
restore a backup. (In other words, you should start the
data nodes with
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
prior to performing the restore.)
</p>
</div>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_restore-privilege-tables">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_restore-privilege-tables">
<code class="option">
--restore-privilege-tables
</code>
</a>
</p>
<a class="indexterm" name="idm46045098373440">
</a>
<a class="indexterm" name="idm46045098371936">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for restore-privilege-tables">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--restore-privilege-tables
</code>
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes
</td>
</tr>
</tbody>
</table>
</div>
<p>
No longer used.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_rewrite-database">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_rewrite-database">
<code class="option">
--rewrite-database
</code>
</a>
=
<em class="replaceable">
<code>
olddb,newdb
</code>
</em>
</p>
<a class="indexterm" name="idm46045098359920">
</a>
<a class="indexterm" name="idm46045098358432">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for rewrite-database">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--rewrite-database=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>
This option makes it possible to restore to a database
having a different name from that used in the backup. For
example, if a backup is made of a database named
<code class="literal">
products
</code>
, you can restore the data it
contains to a database named
<code class="literal">
inventory
</code>
,
use this option as shown here (omitting any other options
that might be required):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa7017297"><div class="copy-help left">Press ⌘+C to 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_restore</span> <span class="token constant">--rewrite-database</span><span class="token attr-value"><span class="token punctuation">=</span>product,inventory</span></code></pre>
</div>
<p>
The option can be employed multiple times in a single
invocation of
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
. Thus it is
possible to restore simultaneously from a database named
<code class="literal">
db1
</code>
to a database named
<code class="literal">
db2
</code>
and from a database named
<code class="literal">
db3
</code>
to one named
<code class="literal">
db4
</code>
using
<code class="option">
--rewrite-database=db1,db2
--rewrite-database=db3,db4
</code>
. Other
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
options may be used between
multiple occurrences of
<code class="option">
--rewrite-database
</code>
.
</p>
<p>
In the event of conflicts between multiple
<code class="option">
--rewrite-database
</code>
options, the last
<code class="option">
--rewrite-database
</code>
option used, reading
from left to right, is the one that takes effect. For
example, if
<code class="option">
--rewrite-database=db1,db2
--rewrite-database=db1,db3
</code>
is used, only
<code class="option">
--rewrite-database=db1,db3
</code>
is honored, and
<code class="option">
--rewrite-database=db1,db2
</code>
is ignored. It
is also possible to restore from multiple databases to a
single database, so that
<code class="option">
--rewrite-database=db1,db3
--rewrite-database=db2,db3
</code>
restores all tables and
data from databases
<code class="literal">
db1
</code>
and
<code class="literal">
db2
</code>
into database
<code class="literal">
db3
</code>
.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
When restoring from multiple backup databases into a
single target database using
<code class="option">
--rewrite-database
</code>
, no check is made for
collisions between table or other object names, and the
order in which rows are restored is not guaranteed. This
means that it is possible in such cases for rows to be
overwritten and updates to be lost.
</p>
</div>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_skip-broken-objects">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_skip-broken-objects">
<code class="option">
--skip-broken-objects
</code>
</a>
</p>
<a class="indexterm" name="idm46045098327152">
</a>
<a class="indexterm" name="idm46045098325696">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for skip-broken-objects">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--skip-broken-objects
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This option causes
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
to ignore
corrupt tables while reading a native
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
backup, and to continue
restoring any remaining tables (that are not also
corrupted). Currently, the
<code class="option">
--skip-broken-objects
</code>
option works only in
the case of missing blob parts tables.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_skip-table-check">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_skip-table-check">
<code class="option">
--skip-table-check
</code>
</a>
,
<code class="option">
-s
</code>
</p>
<a class="indexterm" name="idm46045098312368">
</a>
<a class="indexterm" name="idm46045098310880">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for skip-table-check">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--skip-table-check
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
It is possible to restore data without restoring table
metadata. By default when doing this,
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
fails with an error if a
mismatch is found between the table data and the table
schema; this option overrides that behavior.
</p>
<p>
Some of the restrictions on mismatches in column definitions
when restoring data using
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
are
relaxed; when one of these types of mismatches is
encountered,
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
does not stop
with an error as it did previously, but rather accepts the
data and inserts it into the target table while issuing a
warning to the user that this is being done. This behavior
occurs whether or not either of the options
<code class="option">
--skip-table-check
</code>
or
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_promote-attributes">
<code class="option">
--promote-attributes
</code>
</a>
is
in use. These differences in column definitions are of the
following types:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Different
<code class="literal">
COLUMN_FORMAT
</code>
settings
(
<code class="literal">
FIXED
</code>
,
<code class="literal">
DYNAMIC
</code>
,
<code class="literal">
DEFAULT
</code>
)
</p>
</li>
<li class="listitem">
<p>
Different
<code class="literal">
STORAGE
</code>
settings
(
<code class="literal">
MEMORY
</code>
,
<code class="literal">
DISK
</code>
)
</p>
</li>
<li class="listitem">
<p>
Different default values
</p>
</li>
<li class="listitem">
<p>
Different distribution key settings
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_skip-unknown-objects">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_skip-unknown-objects">
<code class="option">
--skip-unknown-objects
</code>
</a>
</p>
<a class="indexterm" name="idm46045098285984">
</a>
<a class="indexterm" name="idm46045098284528">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for skip-unknown-objects">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--skip-unknown-objects
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This option causes
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
to ignore
any schema objects it does not recognize while reading a
native
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
backup. This can be
used for restoring a backup made from a cluster running (for
example) NDB 7.6 to a cluster running NDB Cluster 7.5.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_slice-id">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_slice-id">
<code class="option">
--slice-id
</code>
</a>
=
<em class="replaceable">
<code>
#
</code>
</em>
</p>
<a class="indexterm" name="idm46045098271808">
</a>
<a class="indexterm" name="idm46045098270320">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for slice-id">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--slice-id=#
</code>
</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">
0
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
1023
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
When restoring by slices, this is the ID of the slice to
restore. This option is always used together with
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_num-slices">
<code class="option">
--num-slices
</code>
</a>
, and its
value must be always less than that of
<code class="option">
--num-slices
</code>
.
</p>
<p>
For more information, see the description of the
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_num-slices">
<code class="option">
--num-slices
</code>
</a>
elsewhere
in this section.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_tab">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_tab">
<code class="option">
--tab
</code>
</a>
=
<em class="replaceable">
<code>
dir_name
</code>
</em>
,
<code class="option">
-T
</code>
<em class="replaceable">
<code>
dir_name
</code>
</em>
</p>
<a class="indexterm" name="idm46045098247184">
</a>
<a class="indexterm" name="idm46045098245696">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for tab">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--tab=path
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Directory name
</td>
</tr>
</tbody>
</table>
</div>
<p>
Causes
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_print-data">
<code class="option">
--print-data
</code>
</a>
to
create dump files, one per table, each named
<code class="filename">
<em class="replaceable">
<code>
tbl_name
</code>
</em>
.txt
</code>
.
It requires as its argument the path to the directory where
the files should be saved; use
<code class="literal">
.
</code>
for the
current directory.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_timestamp-printouts">
</a>
<code class="option">
--timestamp-printouts
</code>
</p>
<a class="indexterm" name="idm46045098231680">
</a>
<a class="indexterm" name="idm46045098230224">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for timestamp-printouts">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--timestamp-printouts{=true|false}
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Boolean
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
true
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Causes info, error, and debug log messages to be prefixed
with timestamps.
</p>
<p>
This option is enabled by default. Disable it with
<code class="option">
--timestamp-printouts=false
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_usage">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_usage">
<code class="option">
--usage
</code>
</a>
</p>
<a class="indexterm" name="idm46045098214944">
</a>
<a class="indexterm" name="idm46045098213456">
</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-restore.html#option_ndb_restore_help">
<code class="option">
--help
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_verbose">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_verbose">
<code class="option">
--verbose
</code>
</a>
=
<em class="replaceable">
<code>
#
</code>
</em>
</p>
<a class="indexterm" name="idm46045098202352">
</a>
<a class="indexterm" name="idm46045098200864">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for verbose">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--verbose=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
1
</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">
255
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Sets the level for the verbosity of the output. The minimum
is 0; the maximum is 255. The default value is 1.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_restore_version">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_version">
<code class="option">
--version
</code>
</a>
</p>
<a class="indexterm" name="idm46045098181792">
</a>
<a class="indexterm" name="idm46045098180304">
</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>
<li class="listitem">
<p>
<a name="option_ndb_restore_with-apply-status">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_with-apply-status">
<code class="option">
--with-apply-status
</code>
</a>
</p>
<a class="indexterm" name="idm46045098170544">
</a>
<a class="indexterm" name="idm46045098169088">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for with-apply-status">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--with-apply-status
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Restore all rows from the backup's
<code class="literal">
ndb_apply_status
</code>
table (except for the
row having
<code class="literal">
server_id = 0
</code>
, which is
generated using
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_restore-epoch">
<code class="option">
--restore-epoch
</code>
</a>
). This
option requires that
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_restore-data">
<code class="option">
--restore-data
</code>
</a>
also be
used.
</p>
<p>
If the
<code class="literal">
ndb_apply_status
</code>
table from the
backup already contains a row with
<code class="literal">
server_id =
0
</code>
,
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
<code class="option">
--with-apply-status
</code>
deletes it. For this
reason, we recommend that you use
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
<code class="option">
--restore-epoch
</code>
after invoking
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
with the
<code class="option">
--with-apply-status
</code>
option. You can also
use
<code class="option">
--restore-epoch
</code>
concurrently with the
last of any invocations of
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
<code class="option">
--with-apply-status
</code>
used to restore the
cluster.
</p>
<p>
For more information, see
<a class="xref" href="mysql-cluster-replication-schema.html#ndb-replication-ndb-apply-status" title="ndb_apply_status Table">
ndb_apply_status Table
</a>
.
</p>
</li>
</ul>
</div>
<a class="indexterm" name="idm46045098147232">
</a>
<p>
Typical options for this utility are shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa15171218"><div class="copy-help left">Press ⌘+C to 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_restore <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">-n</span> <em class="replaceable">node_id</em> <span class="token property">-b</span> <em class="replaceable">backup_id</em> \
<span class="token punctuation">[</span><span class="token property">-m</span><span class="token punctuation">]</span> <span class="token property">-r</span> <span class="token constant">--backup-path</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">/path/to/backup/files</em></span></code></pre>
</div>
<p>
Normally, when restoring from an NDB Cluster backup,
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
requires at a minimum the
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_nodeid">
<code class="option">
--nodeid
</code>
</a>
(short form:
<code class="option">
-n
</code>
),
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_backupid">
<code class="option">
--backupid
</code>
</a>
(short form:
<code class="option">
-b
</code>
), and
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_backup-path">
<code class="option">
--backup-path
</code>
</a>
options.
</p>
<p>
The
<code class="option">
-c
</code>
option is used to specify a connection
string which tells
<code class="literal">
ndb_restore
</code>
where to
locate the cluster management server (see
<a class="xref" href="mysql-cluster-connection-strings.html" title="25.4.3.3 NDB Cluster Connection Strings">
Section 25.4.3.3, “NDB Cluster Connection Strings”
</a>
). If this
option is not used, then
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
attempts
to connect to a management server on
<code class="literal">
localhost:1186
</code>
. This utility acts as a
cluster API node, and so requires a free connection
<span class="quote">
“
<span class="quote">
slot
</span>
”
</span>
to connect to the cluster management server.
This means that there must be at least one
<code class="literal">
[api]
</code>
or
<code class="literal">
[mysqld]
</code>
section
that can be used by it in the cluster
<code class="filename">
config.ini
</code>
file. It is a good idea to keep
at least one empty
<code class="literal">
[api]
</code>
or
<code class="literal">
[mysqld]
</code>
section in
<code class="filename">
config.ini
</code>
that is not being used for a
MySQL server or other application for this reason (see
<a class="xref" href="mysql-cluster-api-definition.html" title="25.4.3.7 Defining SQL and Other API Nodes in an NDB Cluster">
Section 25.4.3.7, “Defining SQL and Other API Nodes in an NDB Cluster”
</a>
).
</p>
<p>
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
can decrypt an encrypted backup
using
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_decrypt">
<code class="option">
--decrypt
</code>
</a>
and
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_backup-password">
<code class="option">
--backup-password
</code>
</a>
. Both
options must be specified to perform decryption. See the
documentation for the
<a class="link" href="mysql-cluster-backup-using-management-client.html" title="25.6.8.2 Using The NDB Cluster Management Client to Create a Backup">
<code class="literal">
START
BACKUP
</code>
</a>
management client command for information on
creating encrypted backups.
</p>
<p>
You can verify that
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
is connected
to the cluster by using the
<a class="link" href="mysql-cluster-mgm-client-commands.html#ndbclient-show">
<code class="literal">
SHOW
</code>
</a>
command in the
<a class="link" href="mysql-cluster-programs-ndb-mgm.html" title="25.5.5 ndb_mgm — The NDB Cluster Management Client">
<span class="command">
<strong>
ndb_mgm
</strong>
</span>
</a>
management client. You can also
accomplish this from a system shell, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa62397107"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">ndb_mgm</span> <span class="token property">-e</span> <span class="token atrule">"SHOW"</span></code></pre>
</div>
<p>
<b>
Error reporting.
</b>
<a class="indexterm" name="idm46045098114896">
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
reports both temporary and
permanent errors. In the case of temporary errors, it may able
to recover from them, and reports
<code class="literal">
Restore successful,
but encountered temporary error, please look at
configuration
</code>
in such cases.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
After using
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
to initialize an
NDB Cluster for use in circular replication, binary logs on
the SQL node acting as the replica are not automatically
created, and you must cause them to be created manually. To
cause the binary logs to be created, issue a
<a class="link" href="show-tables.html" title="15.7.7.39 SHOW TABLES Statement">
<code class="literal">
SHOW TABLES
</code>
</a>
statement on that
SQL node before running
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START
REPLICA
</code>
</a>
. This is a known issue in NDB Cluster.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/fips-mode.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="fips-mode">
</a>
8.8 FIPS Support
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045231474144">
</a>
<a class="indexterm" name="idm46045231473072">
</a>
<a class="indexterm" name="idm46045231471584">
</a>
<p>
MySQL supports FIPS mode when a supported OpenSSL library and FIPS
Object Module are available on the host system.
</p>
<p>
FIPS mode on the server side applies to cryptographic operations
performed by the server. This includes replication (source/replica
and Group Replication) and X Plugin, which run within the server.
FIPS mode also applies to attempts by clients to connect to the
server.
</p>
<p>
The following sections describe FIPS mode and how to take
advantage of it within MySQL:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="fips-mode.html#fips-overview" title="FIPS Overview">
FIPS Overview
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="fips-mode.html#fips-system-requirements" title="System Requirements for FIPS Mode in MySQL">
System Requirements for FIPS Mode in MySQL
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="fips-mode.html#fips-enabling" title="Enabling FIPS Mode in MySQL">
Enabling FIPS Mode in MySQL
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="fips-overview">
</a>
FIPS Overview
</h3>
</div>
</div>
</div>
<p>
Federal Information Processing Standards 140-2 (FIPS 140-2)
describes a security standard that can be required by Federal
(US Government) agencies for cryptographic modules used to
protect sensitive or valuable information. To be considered
acceptable for such Federal use, a cryptographic module must be
certified for FIPS 140-2. If a system intended to protect
sensitive data lacks the proper FIPS 140-2 certificate, Federal
agencies cannot purchase it.
</p>
<p>
Products such as OpenSSL can be used in FIPS mode, although the
OpenSSL library itself is not validated for FIPS. Instead, the
OpenSSL library is used with the OpenSSL FIPS Object Module to
enable OpenSSL-based applications to operate in FIPS mode.
</p>
<p>
For general information about FIPS and its implementation in
OpenSSL, these references may be helpful:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="ulink" href="https://doi.org/10.6028/NIST.FIPS.140-2" target="_blank">
National
Institute of Standards and Technology FIPS PUB 140-2
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="https://csrc.nist.gov/csrc/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp1747.pdf" target="_blank">
OpenSSL
FIPS 140-2 Security Policy
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="https://www.openssl.org/docs/man3.0/man7/fips_module.html" target="_blank">
fips_module
manual page
</a>
</p>
</li>
</ul>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
FIPS mode imposes conditions on cryptographic operations such
as restrictions on acceptable encryption algorithms or
requirements for longer key lengths. For OpenSSL, the exact
FIPS behavior depends on the OpenSSL version.
</p>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="fips-system-requirements">
</a>
System Requirements for FIPS Mode in MySQL
</h3>
</div>
</div>
</div>
<p>
For MySQL to support FIPS mode, these system requirements must
be satisfied:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
MySQL must be compiled with an OpenSSL version that is
certified for use with FIPS. OpenSSL 1.0.2 and OpenSSL 3.0
are certified, but OpenSSL 1.1.1 is not. Binary
distributions for recent versions of MySQL are compiled
using OpenSSL 3.0 on some platforms, which means they are
not certified for FIPS. This means you have the following
options, depending on system and MySQL configuration:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Use a system that has OpenSSL 3.0 and the required FIPS
object module. In this case, you can enable FIPS mode
for MySQL if you use a binary distribution compiled
using OpenSSL 3.0, or compile MySQL from source using
OpenSSL 3.0.
</p>
<p>
For general information about upgrading to OpenSSL 3.0,
see
<a class="ulink" href="https://www.openssl.org/docs/man3.0/man7/migration_guide.html" target="_blank">
OpenSSL
3.0 Migration Guide
</a>
.
</p>
</li>
<li class="listitem">
<p>
Use a system that has OpenSSL 1.1.1 or higher. In this
case, you can install MySQL using binary packages, and
you can use the TLS v1.3 protocol and ciphersuites, in
addition to other already supported TLS protocols.
However, you cannot enable FIPS mode for MySQL.
</p>
</li>
<li class="listitem">
<p>
Use a system that has OpenSSL 1.0.2 and the required
FIPS Object Module. In this case, you can enable FIPS
mode for MySQL if you use a binary distribution compiled
using OpenSSL 1.0.2, or compile MySQL from source using
OpenSSL 1.0.2. In this case, you cannot use the TLS v1.3
protocol or ciphersuites, which require OpenSSL 1.1.1 or
3.0. In addition, you should be aware that OpenSSL 1.0.2
reached end of life status in 2019, and that all
operating platforms embedding OpenSSL 1.1.1 reach their
end of life in 2024.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
At runtime, the OpenSSL library and OpenSSL FIPS Object
Module must be available as shared (dynamically linked)
objects.
</p>
</li>
</ol>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="fips-enabling">
</a>
Enabling FIPS Mode in MySQL
</h3>
</div>
</div>
</div>
<p>
To determine whether MySQL is running on a system with FIPS mode
enabled, check the value of the
<a class="link" href="server-system-variables.html#sysvar_ssl_fips_mode">
<code class="literal">
ssl_fips_mode
</code>
</a>
server system
variable using an SQL statement such as
<a class="link" href="show-variables.html" title="15.7.7.41 SHOW VARIABLES Statement">
<code class="literal">
SHOW VARIABLES
LIKE '%fips%'
</code>
</a>
or
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
@@ssl_fips_mode
</code>
</a>
. If the value of this variable is 1
(
<code class="literal">
ON
</code>
) or 2 (
<code class="literal">
STRICT
</code>
), FIPS
mode is enabled for OpenSSL; if it is 0
(
<code class="literal">
OFF
</code>
), FIPS mode is not available.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
In general,
<code class="literal">
STRICT
</code>
imposes more
restrictions than
<code class="literal">
ON
</code>
, but MySQL itself has
no FIPS-specific code other than to specify the FIPS mode
value to OpenSSL. The exact behavior of FIPS mode for
<code class="literal">
ON
</code>
or
<code class="literal">
STRICT
</code>
depends on
the OpenSSL version. For details, refer to the
<code class="literal">
fips_module
</code>
manpage (see
<a class="xref" href="fips-mode.html#fips-overview" title="FIPS Overview">
FIPS Overview
</a>
).
</p>
</div>
<p>
FIPS mode on the server side applies to cryptographic operations
performed by the server, including those performed by MySQL
Replication (including Group Replication) and X Plugin, which
run within the server.
</p>
<p>
FIPS mode also applies to attempts by clients to connect to the
server. When enabled, on either the client or server side, it
restricts which of the supported encryption ciphers can be
chosen. However, enabling FIPS mode does not require that an
encrypted connection must be used, or that user credentials must
be encrypted. For example, if FIPS mode is enabled, stronger
cryptographic algorithms are required. In particular, MD5 is
restricted, so trying to establish an encrypted connection using
an encryption cipher such as
<code class="literal">
RC4-MD5
</code>
does not
work. But there is nothing about FIPS mode that prevents
establishing an unencrypted connection. (To do that, you can use
the
<code class="literal">
REQUIRE
</code>
clause for
<a class="link" href="create-user.html" title="15.7.1.3 CREATE USER Statement">
<code class="literal">
CREATE USER
</code>
</a>
or
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
for specific user
accounts, or set the
<a class="link" href="server-system-variables.html#sysvar_require_secure_transport">
<code class="literal">
require_secure_transport
</code>
</a>
system
variable to affect all accounts.)
</p>
<p>
If FIPS mode is required, it is recommended to use an operating
platforms that includes it; if it does, you can (and should) use
it. If your platform does not include FIPS, you have two
options:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Migrate to a platform which has FIPS OpenSSL support.
</p>
</li>
<li class="listitem">
<p>
Build the OpenSSL library and FIPS object module from
source, using the instructions from
the
<code class="literal">
fips_module
</code>
manpage
(see
<a class="xref" href="fips-mode.html#fips-overview" title="FIPS Overview">
FIPS Overview
</a>
).
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If the OpenSSL FIPS Object Module is not available, the only
permitted value for
<a class="link" href="server-system-variables.html#sysvar_ssl_fips_mode">
<code class="literal">
ssl_fips_mode
</code>
</a>
and
<a class="link" href="connection-options.html#option_general_ssl-fips-mode">
<code class="option">
--ssl-fips-mode
</code>
</a>
is
<code class="literal">
OFF
</code>
. An error occurs for attempts to set
the FIPS mode to a different value.
</p>
</div>
<p>
If FIPS mode is required, it is recommended to use an operating
platform that includes it; if it does, you can (and should) use
it. If your platform does not include FIPS, you have two
options:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Migrate to a platform which has FIPS OpenSSL support.
</p>
</li>
<li class="listitem">
<p>
Build the OpenSSL library and FIPS object module from
source, using the instructions from
the
<code class="literal">
fips_module
</code>
manpage
(see
<a class="xref" href="fips-mode.html#fips-overview" title="FIPS Overview">
FIPS Overview
</a>
).
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/memory-storage-engine.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="memory-storage-engine">
</a>
18.3 The MEMORY Storage Engine
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045147958032">
</a>
<a class="indexterm" name="idm46045147956992">
</a>
<a class="indexterm" name="idm46045147955920">
</a>
<a class="indexterm" name="idm46045147954432">
</a>
<p>
The
<code class="literal">
MEMORY
</code>
storage engine (formerly known as
<code class="literal">
HEAP
</code>
) creates special-purpose tables with
contents that are stored in memory. Because the data is vulnerable
to crashes, hardware issues, or power outages, only use these tables
as temporary work areas or read-only caches for data pulled from
other tables.
</p>
<div class="table">
<a name="idm46045147950816">
</a>
<p class="title">
<b>
Table 18.4 MEMORY Storage Engine Features
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="Features supported by the MEMORY storage engine.">
<colgroup>
<col style="width: 60%"/>
<col style="width: 40%"/>
</colgroup>
<thead>
<tr>
<th>
Feature
</th>
<th>
Support
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<span class="bold">
<strong>
B-tree indexes
</strong>
</span>
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Backup/point-in-time recovery
</strong>
</span>
(Implemented in the server, rather than in the storage engine.)
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Cluster database support
</strong>
</span>
</td>
<td>
No
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Clustered indexes
</strong>
</span>
</td>
<td>
No
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Compressed data
</strong>
</span>
</td>
<td>
No
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Data caches
</strong>
</span>
</td>
<td>
N/A
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Encrypted data
</strong>
</span>
</td>
<td>
Yes (Implemented in the server via encryption functions.)
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Foreign key support
</strong>
</span>
</td>
<td>
No
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Full-text search indexes
</strong>
</span>
</td>
<td>
No
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Geospatial data type support
</strong>
</span>
</td>
<td>
No
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Geospatial indexing support
</strong>
</span>
</td>
<td>
No
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Hash indexes
</strong>
</span>
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Index caches
</strong>
</span>
</td>
<td>
N/A
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Locking granularity
</strong>
</span>
</td>
<td>
Table
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
MVCC
</strong>
</span>
</td>
<td>
No
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Replication support
</strong>
</span>
(Implemented in the server, rather than in the storage engine.)
</td>
<td>
Limited (See the discussion later in this section.)
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Storage limits
</strong>
</span>
</td>
<td>
RAM
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
T-tree indexes
</strong>
</span>
</td>
<td>
No
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Transactions
</strong>
</span>
</td>
<td>
No
</td>
</tr>
<tr>
<td>
<span class="bold">
<strong>
Update statistics for data dictionary
</strong>
</span>
</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 style="width: 442.797px;">
Feature
</th>
<th style="width: 295.203px;">
Support
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="memory-storage-engine.html#memory-storage-engine-compared-cluster" title="When to Use MEMORY or NDB Cluster">
When to Use MEMORY or NDB Cluster
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="memory-storage-engine.html#memory-storage-engine-partitioning" title="Partitioning">
Partitioning
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="memory-storage-engine.html#memory-storage-engine-performance-characteristics" title="Performance Characteristics">
Performance Characteristics
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="memory-storage-engine.html#memory-storage-engine-characteristics-of-memory-tables" title="Characteristics of MEMORY Tables">
Characteristics of MEMORY Tables
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="memory-storage-engine.html#memory-storage-engine-ddl-operations-for-memory-tables" title="DDL Operations for MEMORY Tables">
DDL Operations for MEMORY Tables
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="memory-storage-engine.html#memory-storage-engine-indexes" title="Indexes">
Indexes
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="memory-storage-engine.html#memory-storage-engine-user-created-and-temporary-tables" title="User-Created and Temporary Tables">
User-Created and Temporary Tables
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="memory-storage-engine.html#memory-storage-engine-loading-data" title="Loading Data">
Loading Data
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="memory-storage-engine.html#memory-tables-replication" title="MEMORY Tables and Replication">
MEMORY Tables and Replication
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="memory-storage-engine.html#memory-storage-engine-managing-memory-use" title="Managing Memory Use">
Managing Memory Use
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="memory-storage-engine.html#memory-storage-engine-additional-resources" title="Additional Resources">
Additional Resources
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="memory-storage-engine-compared-cluster">
</a>
When to Use MEMORY or NDB Cluster
</h3>
</div>
</div>
</div>
<p>
Developers looking to deploy applications that use the
<code class="literal">
MEMORY
</code>
storage engine for important, highly
available, or frequently updated data should consider whether NDB
Cluster is a better choice. A typical use case for the
<code class="literal">
MEMORY
</code>
engine involves these characteristics:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Operations involving transient, non-critical data such as
session management or caching. When the MySQL server halts or
restarts, the data in
<code class="literal">
MEMORY
</code>
tables is
lost.
</p>
</li>
<li class="listitem">
<p>
In-memory storage for fast access and low latency. Data volume
can fit entirely in memory without causing the operating
system to swap out virtual memory pages.
</p>
</li>
<li class="listitem">
<p>
A read-only or read-mostly data access pattern (limited
updates).
</p>
</li>
</ul>
</div>
<p>
NDB Cluster offers the same features as the
<code class="literal">
MEMORY
</code>
engine with higher performance levels,
and provides additional features not available with
<code class="literal">
MEMORY
</code>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Row-level locking and multiple-thread operation for low
contention between clients.
</p>
</li>
<li class="listitem">
<p>
Scalability even with statement mixes that include writes.
</p>
</li>
<li class="listitem">
<p>
Optional disk-backed operation for data durability.
</p>
</li>
<li class="listitem">
<p>
Shared-nothing architecture and multiple-host operation with
no single point of failure, enabling 99.999% availability.
</p>
</li>
<li class="listitem">
<p>
Automatic data distribution across nodes; application
developers need not craft custom sharding or partitioning
solutions.
</p>
</li>
<li class="listitem">
<p>
Support for variable-length data types (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>
) not supported by
<code class="literal">
MEMORY
</code>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="memory-storage-engine-partitioning">
</a>
Partitioning
</h3>
</div>
</div>
</div>
<p>
<code class="literal">
MEMORY
</code>
tables cannot be partitioned.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="memory-storage-engine-performance-characteristics">
</a>
Performance Characteristics
</h3>
</div>
</div>
</div>
<p>
<code class="literal">
MEMORY
</code>
performance is constrained by contention
resulting from single-thread execution and table lock overhead
when processing updates. This limits scalability when load
increases, particularly for statement mixes that include writes.
</p>
<p>
Despite the in-memory processing for
<code class="literal">
MEMORY
</code>
tables, they are not necessarily faster than
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
tables on a busy server, for
general-purpose queries, or under a read/write workload. In
particular, the table locking involved with performing updates can
slow down concurrent usage of
<code class="literal">
MEMORY
</code>
tables
from multiple sessions.
</p>
<p>
Depending on the kinds of queries performed on a
<code class="literal">
MEMORY
</code>
table, you might create indexes as
either the default hash data structure (for looking up single
values based on a unique key), or a general-purpose B-tree data
structure (for all kinds of queries involving equality,
inequality, or range operators such as less than or greater than).
The following sections illustrate the syntax for creating both
kinds of indexes. A common performance issue is using the default
hash indexes in workloads where B-tree indexes are more efficient.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="memory-storage-engine-characteristics-of-memory-tables">
</a>
Characteristics of MEMORY Tables
</h3>
</div>
</div>
</div>
<p>
The
<code class="literal">
MEMORY
</code>
storage engine does not create any
files on disk. The table definition is stored in the MySQL data
dictionary.
</p>
<p>
<code class="literal">
MEMORY
</code>
tables have the following
characteristics:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Space for
<code class="literal">
MEMORY
</code>
tables is allocated in
small blocks. Tables use 100% dynamic hashing for inserts. No
overflow area or extra key space is needed. No extra space is
needed for free lists. Deleted rows are put in a linked list
and are reused when you insert new data into the table.
<code class="literal">
MEMORY
</code>
tables also have none of the
problems commonly associated with deletes plus inserts in
hashed tables.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MEMORY
</code>
tables use a fixed-length
row-storage format. Variable-length types such as
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
are stored using a
fixed length.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MEMORY
</code>
tables cannot contain
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
columns.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MEMORY
</code>
includes support for
<code class="literal">
AUTO_INCREMENT
</code>
columns.
</p>
</li>
<li class="listitem">
<p>
Non-
<code class="literal">
TEMPORARY
</code>
<code class="literal">
MEMORY
</code>
tables are shared among all clients, just like any other
non-
<code class="literal">
TEMPORARY
</code>
table.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="memory-storage-engine-ddl-operations-for-memory-tables">
</a>
DDL Operations for MEMORY Tables
</h3>
</div>
</div>
</div>
<p>
To create a
<code class="literal">
MEMORY
</code>
table, specify the clause
<code class="literal">
ENGINE=MEMORY
</code>
on the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa33889725"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t <span class="token punctuation">(</span>i <span class="token datatype">INT</span><span class="token punctuation">)</span> <span class="token keyword">ENGINE</span> <span class="token operator">=</span> <span class="token keyword">MEMORY</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
As indicated by the engine name,
<code class="literal">
MEMORY
</code>
tables
are stored in memory. They use hash indexes by default, which
makes them very fast for single-value lookups, and very useful for
creating temporary tables. However, when the server shuts down,
all rows stored in
<code class="literal">
MEMORY
</code>
tables are lost. The
tables themselves continue to exist because their definitions are
stored in the MySQL data dictionary, but they are empty when the
server restarts.
</p>
<p>
This example shows how you might create, use, and remove a
<code class="literal">
MEMORY
</code>
table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa98454567"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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 keyword">ENGINE</span><span class="token operator">=</span><span class="token keyword">MEMORY</span>
<span class="token keyword">SELECT</span> ip<span class="token punctuation">,</span><span class="token function">SUM</span><span class="token punctuation">(</span>downloads<span class="token punctuation">)</span> <span class="token keyword">AS</span> down
<span class="token keyword">FROM</span> log_table <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> ip<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">COUNT</span><span class="token punctuation">(</span>ip<span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token function">AVG</span><span class="token punctuation">(</span>down<span class="token punctuation">)</span> <span class="token keyword">FROM</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">DROP</span> <span class="token keyword">TABLE</span> test<span class="token punctuation">;</span></code></pre>
</div>
<p>
The maximum size of
<code class="literal">
MEMORY
</code>
tables is limited by
the
<a class="link" href="server-system-variables.html#sysvar_max_heap_table_size">
<code class="literal">
max_heap_table_size
</code>
</a>
system
variable, which has a default value of 16MB. To enforce different
size limits for
<code class="literal">
MEMORY
</code>
tables, change the value
of this variable. The value in effect for
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
, or a subsequent
<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="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
, is the value used
for the life of the table. A server restart also sets the maximum
size of existing
<code class="literal">
MEMORY
</code>
tables to the global
<a class="link" href="server-system-variables.html#sysvar_max_heap_table_size">
<code class="literal">
max_heap_table_size
</code>
</a>
value. You
can set the size for individual tables as described later in this
section.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="memory-storage-engine-indexes">
</a>
Indexes
</h3>
</div>
</div>
</div>
<p>
The
<code class="literal">
MEMORY
</code>
storage engine supports both
<code class="literal">
HASH
</code>
and
<code class="literal">
BTREE
</code>
indexes. You
can specify one or the other for a given index by adding a
<code class="literal">
USING
</code>
clause as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa13708515"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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> lookup
<span class="token punctuation">(</span>id <span class="token datatype">INT</span><span class="token punctuation">,</span> <span class="token keyword">INDEX</span> <span class="token keyword">USING</span> <span class="token keyword">HASH</span> <span class="token punctuation">(</span>id<span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token keyword">ENGINE</span> <span class="token operator">=</span> <span class="token keyword">MEMORY</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> lookup
<span class="token punctuation">(</span>id <span class="token datatype">INT</span><span class="token punctuation">,</span> <span class="token keyword">INDEX</span> <span class="token keyword">USING</span> <span class="token keyword">BTREE</span> <span class="token punctuation">(</span>id<span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token keyword">ENGINE</span> <span class="token operator">=</span> <span class="token keyword">MEMORY</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For general characteristics of B-tree and hash indexes, 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>
.
</p>
<p>
<code class="literal">
MEMORY
</code>
tables can have up to 64 indexes per
table, 16 columns per index and a maximum key length of 3072
bytes.
</p>
<p>
If a
<code class="literal">
MEMORY
</code>
table hash index has a high degree
of key duplication (many index entries containing the same value),
updates to the table that affect key values and all deletes are
significantly slower. The degree of this slowdown is proportional
to the degree of duplication (or, inversely proportional to the
index cardinality). You can use a
<code class="literal">
BTREE
</code>
index
to avoid this problem.
</p>
<p>
<code class="literal">
MEMORY
</code>
tables can have nonunique keys. (This is
an uncommon feature for implementations of hash indexes.)
</p>
<p>
Columns that are indexed can contain
<code class="literal">
NULL
</code>
values.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="memory-storage-engine-user-created-and-temporary-tables">
</a>
User-Created and Temporary Tables
</h3>
</div>
</div>
</div>
<p>
<code class="literal">
MEMORY
</code>
table contents are stored in memory,
which is a property that
<code class="literal">
MEMORY
</code>
tables share
with internal temporary tables that the server creates on the fly
while processing queries. However, the two types of tables differ
in that
<code class="literal">
MEMORY
</code>
tables are not subject to
storage conversion, whereas internal temporary tables are:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If an internal temporary table becomes too large, the server
automatically converts it to on-disk storage, as described in
<a class="xref" href="internal-temporary-tables.html" title="10.4.4 Internal Temporary Table Use in MySQL">
Section 10.4.4, “Internal Temporary Table Use in MySQL”
</a>
.
</p>
</li>
<li class="listitem">
<p>
User-created
<code class="literal">
MEMORY
</code>
tables are never
converted to disk tables.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="memory-storage-engine-loading-data">
</a>
Loading Data
</h3>
</div>
</div>
</div>
<p>
To populate a
<code class="literal">
MEMORY
</code>
table when the MySQL
server starts, you can use the
<a class="link" href="server-system-variables.html#sysvar_init_file">
<code class="literal">
init_file
</code>
</a>
system variable. For
example, you can put statements such as
<a class="link" href="insert-select.html" title="15.2.7.1 INSERT ... SELECT Statement">
<code class="literal">
INSERT INTO ...
SELECT
</code>
</a>
or
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
into
a file to load the table from a persistent data source, and use
<a class="link" href="server-system-variables.html#sysvar_init_file">
<code class="literal">
init_file
</code>
</a>
to name the file. See
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
, and
<a class="xref" href="load-data.html" title="15.2.9 LOAD DATA Statement">
Section 15.2.9, “LOAD DATA Statement”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="memory-tables-replication">
</a>
MEMORY Tables and Replication
</h3>
</div>
</div>
</div>
<p>
When a replication source server shuts down and restarts, its
<a class="link" href="memory-storage-engine.html" title="18.3 The MEMORY Storage Engine">
<code class="literal">
MEMORY
</code>
</a>
tables become empty. To
replicate this effect to replicas, the first time that the source
uses a given
<a class="link" href="memory-storage-engine.html" title="18.3 The MEMORY Storage Engine">
<code class="literal">
MEMORY
</code>
</a>
table after
startup, it logs an event that notifies replicas that the table
must be emptied by writing a
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE
TABLE
</code>
</a>
statement for that table to the binary log. When a
replica server shuts down and restarts, its
<a class="link" href="memory-storage-engine.html" title="18.3 The MEMORY Storage Engine">
<code class="literal">
MEMORY
</code>
</a>
tables also become empty, and
it writes a
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
statement to its own binary log, which is passed on to any
downstream replicas.
</p>
<p>
When you use
<a class="link" href="memory-storage-engine.html" title="18.3 The MEMORY Storage Engine">
<code class="literal">
MEMORY
</code>
</a>
tables in a
replication topology, in some situations, the table on the source
and the table on the replica can differ. For information on
handling each of these situations to prevent stale reads or
errors, see
<a class="xref" href="replication-features-memory.html" title="19.5.1.21 Replication and MEMORY Tables">
Section 19.5.1.21, “Replication and MEMORY Tables”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="memory-storage-engine-managing-memory-use">
</a>
Managing Memory Use
</h3>
</div>
</div>
</div>
<p>
The server needs sufficient memory to maintain all
<code class="literal">
MEMORY
</code>
tables that are in use at the same time.
</p>
<p>
Memory is not reclaimed if you delete individual rows from a
<code class="literal">
MEMORY
</code>
table. Memory is reclaimed only when the
entire table is deleted. Memory that was previously used for
deleted rows is re-used for new rows within the same table. To
free all the memory used by a
<code class="literal">
MEMORY
</code>
table when
you no longer require its contents, execute
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
or
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
to remove all rows,
or remove the table altogether using
<a class="link" href="drop-table.html" title="15.1.32 DROP TABLE Statement">
<code class="literal">
DROP
TABLE
</code>
</a>
. To free up the memory used by deleted rows, use
<code class="literal">
ALTER TABLE ENGINE=MEMORY
</code>
to force a table
rebuild.
</p>
<p>
The memory needed for one row in a
<code class="literal">
MEMORY
</code>
table
is calculated using the following expression:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa61101822"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql">SUM_OVER_ALL_BTREE_KEYS<span class="token punctuation">(</span><em class="replaceable">max_length_of_key</em> <span class="token operator">+</span> sizeof<span class="token punctuation">(</span><span class="token datatype">char</span><span class="token operator">*</span><span class="token punctuation">)</span> <span class="token operator">*</span> <span class="token number">4</span><span class="token punctuation">)</span>
<span class="token operator">+</span> SUM_OVER_ALL_HASH_KEYS<span class="token punctuation">(</span>sizeof<span class="token punctuation">(</span><span class="token datatype">char</span><span class="token operator">*</span><span class="token punctuation">)</span> <span class="token operator">*</span> <span class="token number">2</span><span class="token punctuation">)</span>
<span class="token operator">+</span> ALIGN<span class="token punctuation">(</span><em class="replaceable">length_of_row</em><span class="token operator">+</span><span class="token number">1</span><span class="token punctuation">,</span> sizeof<span class="token punctuation">(</span><span class="token datatype">char</span><span class="token operator">*</span><span class="token punctuation">)</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
<code class="literal">
ALIGN()
</code>
represents a round-up factor to cause
the row length to be an exact multiple of the
<code class="literal">
char
</code>
pointer size.
<code class="literal">
sizeof(char*)
</code>
is 4 on 32-bit machines and 8 on
64-bit machines.
</p>
<p>
As mentioned earlier, the
<a class="link" href="server-system-variables.html#sysvar_max_heap_table_size">
<code class="literal">
max_heap_table_size
</code>
</a>
system
variable sets the limit on the maximum size of
<code class="literal">
MEMORY
</code>
tables. To control the maximum size for
individual tables, set the session value of this variable before
creating each table. (Do not change the global
<a class="link" href="server-system-variables.html#sysvar_max_heap_table_size">
<code class="literal">
max_heap_table_size
</code>
</a>
value unless
you intend the value to be used for
<code class="literal">
MEMORY
</code>
tables created by all clients.) The following example creates two
<code class="literal">
MEMORY
</code>
tables, with a maximum size of 1MB and
2MB, respectively:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa75659818"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> max_heap_table_size <span class="token operator">=</span> <span class="token number">1024</span><span class="token operator">*</span><span class="token number">1024</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>id <span class="token datatype">INT</span><span class="token punctuation">,</span> <span class="token keyword">UNIQUE</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">ENGINE</span> <span class="token operator">=</span> <span class="token keyword">MEMORY</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.01 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> max_heap_table_size <span class="token operator">=</span> <span class="token number">1024</span><span class="token operator">*</span><span class="token number">1024</span><span class="token operator">*</span><span class="token number">2</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t2 <span class="token punctuation">(</span>id <span class="token datatype">INT</span><span class="token punctuation">,</span> <span class="token keyword">UNIQUE</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">ENGINE</span> <span class="token operator">=</span> <span class="token keyword">MEMORY</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span></code></pre>
</div>
<p>
Both tables revert to the server's global
<a class="link" href="server-system-variables.html#sysvar_max_heap_table_size">
<code class="literal">
max_heap_table_size
</code>
</a>
value if the
server restarts.
</p>
<p>
You can also specify a
<code class="literal">
MAX_ROWS
</code>
table option in
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statements for
<code class="literal">
MEMORY
</code>
tables to provide a hint about the
number of rows you plan to store in them. This does not enable the
table to grow beyond the
<a class="link" href="server-system-variables.html#sysvar_max_heap_table_size">
<code class="literal">
max_heap_table_size
</code>
</a>
value, which
still acts as a constraint on maximum table size. For maximum
flexibility in being able to use
<code class="literal">
MAX_ROWS
</code>
, set
<a class="link" href="server-system-variables.html#sysvar_max_heap_table_size">
<code class="literal">
max_heap_table_size
</code>
</a>
at least as
high as the value to which you want each
<code class="literal">
MEMORY
</code>
table to be able to grow.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="memory-storage-engine-additional-resources">
</a>
Additional Resources
</h3>
</div>
</div>
</div>
<p>
A forum dedicated to the
<code class="literal">
MEMORY
</code>
storage engine
is available at
<a class="ulink" href="https://forums.mysql.com/list.php?92" target="_blank">
https://forums.mysql.com/list.php?92
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/optimizer-statistics.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="optimizer-statistics">
</a>
10.9.6 Optimizer Statistics
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045223227600">
</a>
<a class="indexterm" name="idm46045223226112">
</a>
<p>
The
<code class="literal">
column_statistics
</code>
data dictionary table
stores histogram statistics about column values, for use by the
optimizer in constructing query execution plans. To perform
histogram management, use the
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE
TABLE
</code>
</a>
statement.
</p>
<p>
The
<code class="literal">
column_statistics
</code>
table has these
characteristics:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The table contains statistics for columns of all data types
except geometry types (spatial data) and
<a class="link" href="json.html" title="13.5 The JSON Data Type">
<code class="literal">
JSON
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
The table is persistent so that column statistics need not
be created each time the server starts.
</p>
</li>
<li class="listitem">
<p>
The server performs updates to the table; users do not.
</p>
</li>
</ul>
</div>
<p>
The
<code class="literal">
column_statistics
</code>
table is not directly
accessible by users because it is part of the data dictionary.
Histogram information is available using
<a class="link" href="information-schema-column-statistics-table.html" title="28.3.11 The INFORMATION_SCHEMA COLUMN_STATISTICS Table">
<code class="literal">
INFORMATION_SCHEMA.COLUMN_STATISTICS
</code>
</a>
,
which is implemented as a view on the data dictionary table.
<a class="link" href="information-schema-column-statistics-table.html" title="28.3.11 The INFORMATION_SCHEMA COLUMN_STATISTICS Table">
<code class="literal">
COLUMN_STATISTICS
</code>
</a>
has these
columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
SCHEMA_NAME
</code>
,
<code class="literal">
TABLE_NAME
</code>
,
<code class="literal">
COLUMN_NAME
</code>
: The names of the schema,
table, and column for which the statistics apply.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
HISTOGRAM
</code>
: A
<a class="link" href="json.html" title="13.5 The JSON Data Type">
<code class="literal">
JSON
</code>
</a>
value describing the
column statistics, stored as a histogram.
</p>
</li>
</ul>
</div>
<p>
Column histograms contain buckets for parts of the range of
values stored in the column. Histograms are
<a class="link" href="json.html" title="13.5 The JSON Data Type">
<code class="literal">
JSON
</code>
</a>
objects to permit
flexibility in the representation of column statistics. Here is
a sample histogram object:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-json"><div class="docs-select-all right" id="sa30339173"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-json"><span class="token punctuation">{</span>
<span class="token property">"buckets"</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token punctuation">[</span>
<span class="token number">1</span><span class="token punctuation">,</span>
<span class="token number">0.3333333333333333</span>
<span class="token punctuation">]</span><span class="token punctuation">,</span>
<span class="token punctuation">[</span>
<span class="token number">2</span><span class="token punctuation">,</span>
<span class="token number">0.6666666666666666</span>
<span class="token punctuation">]</span><span class="token punctuation">,</span>
<span class="token punctuation">[</span>
<span class="token number">3</span><span class="token punctuation">,</span>
<span class="token number">1</span>
<span class="token punctuation">]</span>
<span class="token punctuation">]</span><span class="token punctuation">,</span>
<span class="token property">"null-values"</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
<span class="token property">"last-updated"</span><span class="token operator">:</span> <span class="token string">"2017-03-24 13:32:40.000000"</span><span class="token punctuation">,</span>
<span class="token property">"sampling-rate"</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
<span class="token property">"histogram-type"</span><span class="token operator">:</span> <span class="token string">"singleton"</span><span class="token punctuation">,</span>
<span class="token property">"number-of-buckets-specified"</span><span class="token operator">:</span> <span class="token number">128</span><span class="token punctuation">,</span>
<span class="token property">"data-type"</span><span class="token operator">:</span> <span class="token string">"int"</span><span class="token punctuation">,</span>
<span class="token property">"collation-id"</span><span class="token operator">:</span> <span class="token number">8</span>
<span class="token punctuation">}</span></code></pre>
</div>
<p>
Histogram objects have these keys:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
buckets
</code>
: The histogram buckets. Bucket
structure depends on the histogram type.
</p>
<p>
For
<code class="literal">
singleton
</code>
histograms, buckets contain
two values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Value 1: The value for the bucket. The type depends on
the column data type.
</p>
</li>
<li class="listitem">
<p>
Value 2: A double representing the cumulative frequency
for the value. For example, .25 and .75 indicate that
25% and 75% of the values in the column are less than or
equal to the bucket value.
</p>
</li>
</ul>
</div>
<p>
For
<code class="literal">
equi-height
</code>
histograms, buckets
contain four values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Values 1, 2: The lower and upper inclusive values for
the bucket. The type depends on the column data type.
</p>
</li>
<li class="listitem">
<p>
Value 3: A double representing the cumulative frequency
for the value. For example, .25 and .75 indicate that
25% and 75% of the values in the column are less than or
equal to the bucket upper value.
</p>
</li>
<li class="listitem">
<p>
Value 4: The number of distinct values in the range from
the bucket lower value to its upper value.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
null-values
</code>
: A number between 0.0 and 1.0
indicating the fraction of column values that are SQL
<code class="literal">
NULL
</code>
values. If 0, the column contains no
<code class="literal">
NULL
</code>
values.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
last-updated
</code>
: When the histogram was
generated, as a UTC value in
<em class="replaceable">
<code>
YYYY-MM-DD
hh:mm:ss.uuuuuu
</code>
</em>
format.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
sampling-rate
</code>
: A number between 0.0 and
1.0 indicating the fraction of data that was sampled to
create the histogram. A value of 1 means that all of the
data was read (no sampling).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
histogram-type
</code>
: The histogram type:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
singleton
</code>
: One bucket represents one
single value in the column. This histogram type is
created when the number of distinct values in the column
is less than or equal to the number of buckets specified
in the
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
statement that generated the histogram.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
equi-height
</code>
: One bucket represents a
range of values. This histogram type is created when the
number of distinct values in the column is greater than
the number of buckets specified in the
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
statement
that generated the histogram.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
number-of-buckets-specified
</code>
: The number
of buckets specified in the
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE
TABLE
</code>
</a>
statement that generated the histogram.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
data-type
</code>
: The type of data this
histogram contains. This is needed when reading and parsing
histograms from persistent storage into memory. The value is
one of
<code class="literal">
int
</code>
,
<code class="literal">
uint
</code>
(unsigned integer),
<code class="literal">
double
</code>
,
<code class="literal">
decimal
</code>
,
<code class="literal">
datetime
</code>
, or
<code class="literal">
string
</code>
(includes character and binary
strings).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
collation-id
</code>
: The collation ID for the
histogram data. It is mostly meaningful when the
<code class="literal">
data-type
</code>
value is
<code class="literal">
string
</code>
. Values correspond to
<code class="literal">
ID
</code>
column values in the Information
Schema
<a class="link" href="information-schema-collations-table.html" title="28.3.6 The INFORMATION_SCHEMA COLLATIONS Table">
<code class="literal">
COLLATIONS
</code>
</a>
table.
</p>
</li>
</ul>
</div>
<p>
To extract particular values from the histogram objects, you can
use
<a class="link" href="json.html" title="13.5 The JSON Data Type">
<code class="literal">
JSON
</code>
</a>
operations. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa39935142"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span>
<span class="token keyword">TABLE_NAME</span><span class="token punctuation">,</span> <span class="token keyword">COLUMN_NAME</span><span class="token punctuation">,</span>
<span class="token keyword">HISTOGRAM</span><span class="token operator">-</span><span class="token operator">>></span><span class="token string">'$."data-type"'</span> <span class="token keyword">AS</span> <span class="token string">'data-type'</span><span class="token punctuation">,</span>
<span class="token function">JSON_LENGTH</span><span class="token punctuation">(</span><span class="token keyword">HISTOGRAM</span><span class="token operator">-</span><span class="token operator">>></span><span class="token string">'$."buckets"'</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token string">'bucket-count'</span>
<span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>COLUMN_STATISTICS<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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> COLUMN_NAME <span class="token punctuation">|</span> data<span class="token punctuation">-</span>type <span class="token punctuation">|</span> bucket<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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> country <span class="token punctuation">|</span> Population <span class="token punctuation">|</span> int <span class="token punctuation">|</span> 226 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> city <span class="token punctuation">|</span> Population <span class="token punctuation">|</span> int <span class="token punctuation">|</span> 1024 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> countrylanguage <span class="token punctuation">|</span> Language <span class="token punctuation">|</span> string <span class="token punctuation">|</span> 457 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 optimizer uses histogram statistics, if applicable, for
columns of any data type for which statistics are collected. The
optimizer applies histogram statistics to determine row
estimates based on the selectivity (filtering effect) of column
value comparisons against constant values. Predicates of these
forms qualify for histogram use:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa82032681"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><em class="replaceable">col_name</em> <span class="token operator">=</span> <em class="replaceable">constant</em>
<em class="replaceable">col_name</em> <span class="token operator"><></span> <em class="replaceable">constant</em>
<em class="replaceable">col_name</em> <span class="token operator">!=</span> <em class="replaceable">constant</em>
<em class="replaceable">col_name</em> <span class="token operator">></span> <em class="replaceable">constant</em>
<em class="replaceable">col_name</em> <span class="token operator"><</span> <em class="replaceable">constant</em>
<em class="replaceable">col_name</em> <span class="token operator">>=</span> <em class="replaceable">constant</em>
<em class="replaceable">col_name</em> <span class="token operator"><=</span> <em class="replaceable">constant</em>
<em class="replaceable">col_name</em> <span class="token operator">IS</span> <span class="token boolean">NULL</span>
<em class="replaceable">col_name</em> <span class="token operator">IS</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span>
<em class="replaceable">col_name</em> <span class="token operator">BETWEEN</span> <em class="replaceable">constant</em> <span class="token operator">AND</span> <em class="replaceable">constant</em>
<em class="replaceable">col_name</em> <span class="token operator">NOT</span> <span class="token operator">BETWEEN</span> <em class="replaceable">constant</em> <span class="token operator">AND</span> <em class="replaceable">constant</em>
<em class="replaceable">col_name</em> <span class="token keyword">IN</span> <span class="token punctuation">(</span><em class="replaceable">constant</em><span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">constant</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>
<em class="replaceable">col_name</em> <span class="token operator">NOT</span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><em class="replaceable">constant</em><span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">constant</em><span class="token punctuation">]</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
For example, these statements contain predicates that qualify
for histogram use:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa19853682"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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> orders <span class="token keyword">WHERE</span> amount <span class="token operator">BETWEEN</span> <span class="token number">100.0</span> <span class="token operator">AND</span> <span class="token number">300.0</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> tbl <span class="token keyword">WHERE</span> col1 <span class="token operator">=</span> <span class="token number">15</span> <span class="token operator">AND</span> col2 <span class="token operator">></span> <span class="token number">100</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The requirement for comparison against a constant value includes
functions that are constant, such as
<a class="link" href="mathematical-functions.html#function_abs">
<code class="literal">
ABS()
</code>
</a>
and
<a class="link" href="mathematical-functions.html#function_floor">
<code class="literal">
FLOOR()
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa7986903"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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> tbl <span class="token keyword">WHERE</span> col1 <span class="token operator"><</span> <span class="token function">ABS</span><span class="token punctuation">(</span><span class="token operator">-</span><span class="token number">34</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Histogram statistics are useful primarily for nonindexed
columns. Adding an index to a column for which histogram
statistics are applicable might also help the optimizer make row
estimates. The tradeoffs are:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
An index must be updated when table data is modified.
</p>
</li>
<li class="listitem">
<p>
A histogram is created or updated only on demand, so it adds
no overhead when table data is modified. On the other hand,
the statistics become progressively more out of date when
table modifications occur, until the next time they are
updated.
</p>
</li>
</ul>
</div>
<p>
The optimizer prefers range optimizer row estimates to those
obtained from histogram statistics. If the optimizer determines
that the range optimizer applies, it does not use histogram
statistics.
</p>
<p>
For columns that are indexed, row estimates can be obtained for
equality comparisons using index dives (see
<a class="xref" href="range-optimization.html" title="10.2.1.2 Range Optimization">
Section 10.2.1.2, “Range Optimization”
</a>
). In this case, histogram
statistics are not necessarily useful because index dives can
yield better estimates.
</p>
<p>
In some cases, use of histogram statistics may not improve query
execution (for example, if the statistics are out of date). To
check whether this is the case, use
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE
TABLE
</code>
</a>
to regenerate the histogram statistics, then run
the query again.
</p>
<p>
Alternatively, to disable histogram statistics, use
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
to drop them. A
different method of disabling histogram statistics is to turn
off the
<a class="link" href="switchable-optimizations.html#optflag_condition-fanout-filter">
<code class="literal">
condition_fanout_filter
</code>
</a>
flag
of the
<a class="link" href="server-system-variables.html#sysvar_optimizer_switch">
<code class="literal">
optimizer_switch
</code>
</a>
system
variable (although this may disable other optimizations as
well):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa80297040"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> optimizer_switch<span class="token operator">=</span><span class="token string">'condition_fanout_filter=off'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If histogram statistics are used, the resulting effect is
visible using
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
. Consider
the following query, where no index is available for column
<code class="literal">
col1
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa5327569"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> col1 <span class="token operator"><</span> <span class="token number">24</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If histogram statistics indicate that 57% of the rows in
<code class="literal">
t1
</code>
satisfy the
<code class="literal">
col1 <
24
</code>
predicate, filtering can occur even in the absence
of an index, and
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
shows
57.00 in the
<code class="literal">
filtered
</code>
column.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-oci-marketplace.html | <div id="docs-body">
<div class="chapter">
<div class="titlepage">
<div>
<div>
<h1 class="title">
<a name="mysql-oci-marketplace">
</a>
Chapter 34 MySQL on OCI Marketplace
</h1>
</div>
</div>
</div>
<div class="toc">
<p>
<b>
Table of Contents
</b>
</p>
<dl class="toc">
<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>
</div>
<p>
This chapter describes how to deploy MySQL Enterprise Edition as an Oracle Cloud
Infrastructure (OCI) Marketplace Application. This is a BYOL
product.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
For more information on OCI marketplace, see
<a class="ulink" href="https://docs.cloud.oracle.com/iaas/Content/Marketplace/Concepts/marketoverview.htm" target="_blank">
Overview
of Marketplace
</a>
.
</p>
</div>
<p>
The MySQL Enterprise Edition Marketplace Application is an OCI compute instance,
running Oracle Linux 9.3, with MySQL EE 8.4. The MySQL EE
installation on the deployed image is similar to the RPM
installation, as described in
<a class="xref" href="linux-installation-rpm.html" title="2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle">
Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle”
</a>
.
</p>
<p>
For more information on MySQL Enterprise Edition, see
<a class="xref" href="mysql-enterprise.html" title="Chapter 32 MySQL Enterprise Edition">
Chapter 32,
<i>
MySQL Enterprise Edition
</i>
</a>
.
</p>
<p>
For more information on MySQL advanced configuration, see
<a class="ulink" href="/doc/mysql-secure-deployment-guide/en/" target="_top">
Secure
Deployment Guide
</a>
.
</p>
<p>
For more information on Oracle Linux 9, see
<a class="ulink" href="https://docs.oracle.com/en/operating-systems/oracle-linux/9/" target="_blank">
Oracle
Linux Documentation
</a>
</p>
<p>
This product is user-managed, meaning you are responsible for
upgrades and maintenance.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/partitioning-list.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="partitioning-list">
</a>
26.2.2 LIST Partitioning
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045084674544">
</a>
<a class="indexterm" name="idm46045084673056">
</a>
<p>
List partitioning in MySQL is similar to range partitioning in
many ways. As in partitioning by
<code class="literal">
RANGE
</code>
, each
partition must be explicitly defined. The chief difference
between the two types of partitioning is that, in list
partitioning, each partition is defined and selected based on
the membership of a column value in one of a set of value lists,
rather than in one of a set of contiguous ranges of values. This
is done by using
<code class="literal">
PARTITION BY
LIST(
<em class="replaceable">
<code>
expr
</code>
</em>
)
</code>
where
<em class="replaceable">
<code>
expr
</code>
</em>
is a column value or an
expression based on a column value and returning an integer
value, and then defining each partition by means of a
<code class="literal">
VALUES IN
(
<em class="replaceable">
<code>
value_list
</code>
</em>
)
</code>
, where
<em class="replaceable">
<code>
value_list
</code>
</em>
is a comma-separated list
of integers.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
In MySQL 8.4, it is possible to match against
only a list of integers (and possibly
<code class="literal">
NULL
</code>
—see
<a class="xref" href="partitioning-handling-nulls.html" title="26.2.7 How MySQL Partitioning Handles NULL">
Section 26.2.7, “How MySQL Partitioning Handles NULL”
</a>
) when
partitioning by
<code class="literal">
LIST
</code>
.
</p>
<p>
However, other column types may be used in value lists when
employing
<code class="literal">
LIST COLUMN
</code>
partitioning, which
is described later in this section.
</p>
</div>
<p>
Unlike the case with partitions defined by range, list
partitions do not need to be declared in any particular order.
For more detailed syntactical information, see
<a class="xref" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
Section 15.1.20, “CREATE TABLE Statement”
</a>
.
</p>
<p>
For the examples that follow, we assume that the basic
definition of the table to be partitioned is provided by the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement shown
here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa61566980"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> employees <span class="token punctuation">(</span>
id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
fname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
lname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
hired <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token string">'1970-01-01'</span><span class="token punctuation">,</span>
separated <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token string">'9999-12-31'</span><span class="token punctuation">,</span>
job_code <span class="token datatype">INT</span><span class="token punctuation">,</span>
store_id <span class="token datatype">INT</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
(This is the same table used as a basis for the examples in
<a class="xref" href="partitioning-range.html" title="26.2.1 RANGE Partitioning">
Section 26.2.1, “RANGE Partitioning”
</a>
. As with the other
partitioning examples, we assume that the
<a class="link" href="server-system-variables.html#sysvar_default_storage_engine">
<code class="literal">
default_storage_engine
</code>
</a>
is
<code class="literal">
InnoDB
</code>
.)
</p>
<p>
Suppose that there are 20 video stores distributed among 4
franchises as shown in the following table.
</p>
<div class="informaltable">
<table summary="An example of 20 video stores distributed among 4 regional franchises, as described in the preceding text.">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<thead>
<tr>
<th>
Region
</th>
<th>
Store ID Numbers
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
North
</td>
<td>
3, 5, 6, 9, 17
</td>
</tr>
<tr>
<td>
East
</td>
<td>
1, 2, 10, 11, 19, 20
</td>
</tr>
<tr>
<td>
West
</td>
<td>
4, 12, 13, 14, 18
</td>
</tr>
<tr>
<td>
Central
</td>
<td>
7, 8, 15, 16
</td>
</tr>
</tbody>
</table>
</div>
<p>
To partition this table in such a way that rows for stores
belonging to the same region are stored in the same partition,
you could use the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa55158908"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> employees <span class="token punctuation">(</span>
id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
fname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
lname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
hired <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token string">'1970-01-01'</span><span class="token punctuation">,</span>
separated <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token string">'9999-12-31'</span><span class="token punctuation">,</span>
job_code <span class="token datatype">INT</span><span class="token punctuation">,</span>
store_id <span class="token datatype">INT</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">LIST</span><span class="token punctuation">(</span>store_id<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> pNorth <span class="token keyword">VALUES</span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">6</span><span class="token punctuation">,</span><span class="token number">9</span><span class="token punctuation">,</span><span class="token number">17</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> pEast <span class="token keyword">VALUES</span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">11</span><span class="token punctuation">,</span><span class="token number">19</span><span class="token punctuation">,</span><span class="token number">20</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> pWest <span class="token keyword">VALUES</span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">,</span><span class="token number">12</span><span class="token punctuation">,</span><span class="token number">13</span><span class="token punctuation">,</span><span class="token number">14</span><span class="token punctuation">,</span><span class="token number">18</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> pCentral <span class="token keyword">VALUES</span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token number">7</span><span class="token punctuation">,</span><span class="token number">8</span><span class="token punctuation">,</span><span class="token number">15</span><span class="token punctuation">,</span><span class="token number">16</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
This makes it easy to add or drop employee records relating to
specific regions to or from the table. For instance, suppose
that all stores in the West region are sold to another company.
In MySQL 8.4, all rows relating to employees
working at stores in that region can be deleted with the query
<code class="literal">
ALTER TABLE employees TRUNCATE PARTITION
pWest
</code>
, which can be executed much more efficiently
than the equivalent
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statement
<code class="literal">
DELETE FROM employees WHERE store_id IN
(4,12,13,14,18);
</code>
. (Using
<code class="literal">
ALTER TABLE
employees DROP PARTITION pWest
</code>
would also delete all
of these rows, but would also remove the partition
<code class="literal">
pWest
</code>
from the definition of the table; you
would need to use an
<code class="literal">
ALTER TABLE ... ADD
PARTITION
</code>
statement to restore the table's
original partitioning scheme.)
</p>
<p>
As with
<code class="literal">
RANGE
</code>
partitioning, it is possible to
combine
<code class="literal">
LIST
</code>
partitioning with partitioning
by hash or key to produce a composite partitioning
(subpartitioning). See
<a class="xref" href="partitioning-subpartitions.html" title="26.2.6 Subpartitioning">
Section 26.2.6, “Subpartitioning”
</a>
.
</p>
<p>
Unlike the case with
<code class="literal">
RANGE
</code>
partitioning,
there is no
<span class="quote">
“
<span class="quote">
catch-all
</span>
”
</span>
such as
<code class="literal">
MAXVALUE
</code>
; all expected values for the
partitioning expression should be covered in
<code class="literal">
PARTITION
... VALUES IN (...)
</code>
clauses. An
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statement containing an
unmatched partitioning column value fails with an error, as
shown in this example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34094469"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> h2 <span class="token punctuation">(</span>
<span class="token prompt"> -></span> c1 <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> c2 <span class="token datatype">INT</span>
<span class="token prompt"> -></span> <span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">LIST</span><span class="token punctuation">(</span>c1<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token prompt"> -></span> <span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">7</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">8</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.11 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> h2 <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">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1525 (HY000)<span class="token punctuation">:</span> Table has no partition for value 3</span></code></pre>
</div>
<p>
When inserting multiple rows using a single
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statement into a single
<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">
InnoDB
</code>
considers the statement a single
transaction, so that the presence of any unmatched values causes
the statement to fail completely, and so no rows are inserted.
</p>
<p>
You can cause this type of error to be ignored by using the
<code class="literal">
IGNORE
</code>
keyword, although a warning is issued
for each row containing unmatched partitioning column values, as
shown here.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24871551"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">TRUNCATE</span> h2<span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">TABLE</span> h2<span class="token punctuation">;</span>
<span class="token output">Empty set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">IGNORE</span> <span class="token keyword">INTO</span> h2 <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">6</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">7</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">9</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 3 rows affected, 2 warnings (0.01 sec)</span>
<span class="token output">Records: 5 Duplicates: 2 Warnings: 2</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Level <span class="token punctuation">|</span> Code <span class="token punctuation">|</span> Message <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Warning <span class="token punctuation">|</span> 1526 <span class="token punctuation">|</span> Table has no partition for value 6 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Warning <span class="token punctuation">|</span> 1526 <span class="token punctuation">|</span> Table has no partition for value 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">2 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
You can see in the output of the following
<a class="link" href="table.html" title="15.2.16 TABLE Statement">
<code class="literal">
TABLE
</code>
</a>
statement that rows
containing unmatched partitioning column values were silently
rejected, while rows containing no unmatched values were
inserted into the table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa47778381"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">TABLE</span> h2<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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> c2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 7 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 9 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <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>
<span class="token output">3 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
MySQL also provides support for
<code class="literal">
LIST COLUMNS
</code>
partitioning, a variant of
<code class="literal">
LIST
</code>
partitioning
that enables you to use columns of types other than integer for
partitioning columns, and to use multiple columns as
partitioning keys. For more information, see
<a class="xref" href="partitioning-columns-list.html" title="26.2.3.2 LIST COLUMNS partitioning">
Section 26.2.3.2, “LIST COLUMNS partitioning”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/resource-group-statements.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="resource-group-statements">
</a>
15.7.2 Resource Group Management Statements
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="alter-resource-group.html">
15.7.2.1 ALTER RESOURCE GROUP Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="create-resource-group.html">
15.7.2.2 CREATE RESOURCE GROUP Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="drop-resource-group.html">
15.7.2.3 DROP RESOURCE GROUP Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="set-resource-group.html">
15.7.2.4 SET RESOURCE GROUP Statement
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045172849824">
</a>
<p>
MySQL supports creation and management of resource groups, and
permits assigning threads running within the server to particular
groups so that threads execute according to the resources
available to the group. This section describes the SQL statements
available for resource group management. For general discussion of
the resource group capability, see
<a class="xref" href="resource-groups.html" title="7.1.16 Resource Groups">
Section 7.1.16, “Resource Groups”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/version-tokens-installation.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="version-tokens-installation">
</a>
7.6.6.2 Installing or Uninstalling Version Tokens
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045256108640">
</a>
<a class="indexterm" name="idm46045256107152">
</a>
<a class="indexterm" name="idm46045256105664">
</a>
<a class="indexterm" name="idm46045256104176">
</a>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If installed, Version Tokens involves some overhead. To avoid
this overhead, do not install it unless you plan to use it.
</p>
</div>
<p>
This section describes how to install or uninstall Version
Tokens, which is implemented in a plugin library file containing
a plugin and loadable functions. For general information about
installing or uninstalling plugins and loadable functions, 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>
, and
<a class="xref" href="function-loading.html" title="7.7.1 Installing and Uninstalling Loadable Functions">
Section 7.7.1, “Installing and Uninstalling Loadable Functions”
</a>
.
</p>
<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>
The plugin library file base name is
<code class="literal">
version_tokens
</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 install the Version Tokens plugin and functions, use the
<a class="link" href="install-plugin.html" title="15.7.4.4 INSTALL PLUGIN Statement">
<code class="literal">
INSTALL PLUGIN
</code>
</a>
and
<a class="link" href="create-function.html" title="15.1.14 CREATE FUNCTION Statement">
<code class="literal">
CREATE FUNCTION
</code>
</a>
statements,
adjusting the
<code class="filename">
.so
</code>
suffix for your platform
as necessary:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa35925107"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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> version_tokens <span class="token keyword">SONAME</span> <span class="token string">'version_token.so'</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> version_tokens_set <span class="token keyword">RETURNS</span> <span class="token keyword">STRING</span>
<span class="token keyword">SONAME</span> <span class="token string">'version_token.so'</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> version_tokens_show <span class="token keyword">RETURNS</span> <span class="token keyword">STRING</span>
<span class="token keyword">SONAME</span> <span class="token string">'version_token.so'</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> version_tokens_edit <span class="token keyword">RETURNS</span> <span class="token keyword">STRING</span>
<span class="token keyword">SONAME</span> <span class="token string">'version_token.so'</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> version_tokens_delete <span class="token keyword">RETURNS</span> <span class="token keyword">STRING</span>
<span class="token keyword">SONAME</span> <span class="token string">'version_token.so'</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> version_tokens_lock_shared <span class="token keyword">RETURNS</span> <span class="token datatype">INT</span>
<span class="token keyword">SONAME</span> <span class="token string">'version_token.so'</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> version_tokens_lock_exclusive <span class="token keyword">RETURNS</span> <span class="token datatype">INT</span>
<span class="token keyword">SONAME</span> <span class="token string">'version_token.so'</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> version_tokens_unlock <span class="token keyword">RETURNS</span> <span class="token datatype">INT</span>
<span class="token keyword">SONAME</span> <span class="token string">'version_token.so'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
You must install the functions to manage the server's version
token list, but you must also install the plugin because the
functions do not work correctly without it.
</p>
<p>
If the plugin and functions are used on a replication source
server, install them on all replica servers as well to avoid
replication problems.
</p>
<p>
Once installed as just described, the plugin and functions
remain installed until uninstalled. To remove them, use the
<a class="link" href="uninstall-plugin.html" title="15.7.4.6 UNINSTALL PLUGIN Statement">
<code class="literal">
UNINSTALL PLUGIN
</code>
</a>
and
<a class="link" href="drop-function.html" title="15.1.26 DROP FUNCTION Statement">
<code class="literal">
DROP FUNCTION
</code>
</a>
statements:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24096498"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">UNINSTALL</span> <span class="token keyword">PLUGIN</span> version_tokens<span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">FUNCTION</span> version_tokens_set<span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">FUNCTION</span> version_tokens_show<span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">FUNCTION</span> version_tokens_edit<span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">FUNCTION</span> version_tokens_delete<span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">FUNCTION</span> version_tokens_lock_shared<span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">FUNCTION</span> version_tokens_lock_exclusive<span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">FUNCTION</span> version_tokens_unlock<span class="token punctuation">;</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/constraint-enum.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="constraint-enum">
</a>
1.7.3.3 ENUM and SET Constraints
</h4>
</div>
</div>
</div>
<p>
<a class="link" href="enum.html" title="13.3.5 The ENUM Type">
<code class="literal">
ENUM
</code>
</a>
and
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
columns provide an
efficient way to define columns that can contain only a given
set of values. See
<a class="xref" href="enum.html" title="13.3.5 The ENUM Type">
Section 13.3.5, “The ENUM Type”
</a>
, and
<a class="xref" href="set.html" title="13.3.6 The SET Type">
Section 13.3.6, “The SET Type”
</a>
.
</p>
<p>
Unless strict mode is disabled (not recommended, but see
<a class="xref" href="sql-mode.html" title="7.1.11 Server SQL Modes">
Section 7.1.11, “Server SQL Modes”
</a>
), the definition of a
<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 acts as a constraint
on values entered into the column. An error occurs for values
that do not satisfy these conditions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
An
<a class="link" href="enum.html" title="13.3.5 The ENUM Type">
<code class="literal">
ENUM
</code>
</a>
value must be one
of those listed in the column definition, or the internal
numeric equivalent thereof. The value cannot be the error
value (that is, 0 or the empty string). For a column
defined as
<a class="link" href="enum.html" title="13.3.5 The ENUM Type">
<code class="literal">
ENUM('a','b','c')
</code>
</a>
, values
such as
<code class="literal">
''
</code>
,
<code class="literal">
'd'
</code>
, or
<code class="literal">
'ax'
</code>
are invalid and are rejected.
</p>
</li>
<li class="listitem">
<p>
A
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
value must be the
empty string or a value consisting only of the values
listed in the column definition separated by commas. For a
column defined as
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET('a','b','c')
</code>
</a>
, values
such as
<code class="literal">
'd'
</code>
or
<code class="literal">
'a,b,c,d'
</code>
are invalid and are rejected.
</p>
</li>
</ul>
</div>
<p>
Errors for invalid values can be suppressed in strict mode if
you use
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
IGNORE
</code>
</a>
or
<code class="literal">
UPDATE IGNORE
</code>
. In this
case, a warning is generated rather than an error. For
<a class="link" href="enum.html" title="13.3.5 The ENUM Type">
<code class="literal">
ENUM
</code>
</a>
, the value is inserted as
the error member (
<code class="literal">
0
</code>
). For
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
, the value is inserted as
given except that any invalid substrings are deleted. For
example,
<code class="literal">
'a,x,b,y'
</code>
results in a value of
<code class="literal">
'a,b'
</code>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/partitioning-info.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="partitioning-info">
</a>
26.3.5 Obtaining Information About Partitions
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045083422496">
</a>
<a class="indexterm" name="idm46045083421440">
</a>
<a class="indexterm" name="idm46045083420352">
</a>
<a class="indexterm" name="idm46045083419264">
</a>
<p>
This section discusses obtaining information about existing
partitions, which can be done in a number of ways. Methods of
obtaining such information include the following:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Using the
<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>
statement to view the partitioning clauses used in creating
a partitioned table.
</p>
</li>
<li class="listitem">
<p>
Using the
<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 to determine whether a table is partitioned.
</p>
</li>
<li class="listitem">
<p>
Querying the Information Schema
<a class="link" href="information-schema-partitions-table.html" title="28.3.21 The INFORMATION_SCHEMA PARTITIONS Table">
<code class="literal">
PARTITIONS
</code>
</a>
table.
</p>
</li>
<li class="listitem">
<p>
Using the statement
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
SELECT
</code>
</a>
to see which partitions are used by a given
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
.
</p>
</li>
</ul>
</div>
<p>
When insertions, deletions, or updates are made to partitioned
tables, the binary log records information about the partition
and (if any) the subpartition in which the row event took place.
A new row event is created for a modification that takes place
in a different partition or subpartition, even if the table
involved is the same. So if a transaction involves three
partitions or subpartitions, three row events are generated. For
an update event, the partition information is recorded for both
the
<span class="quote">
“
<span class="quote">
before
</span>
”
</span>
image and the
<span class="quote">
“
<span class="quote">
after
</span>
”
</span>
image. The partition information is displayed if you specify the
<code class="literal">
-v
</code>
or
<code class="literal">
--verbose
</code>
option
when viewing the binary log using
<a class="link" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
<span class="command">
<strong>
mysqlbinlog
</strong>
</span>
</a>
. Partition information is only
recorded when row-based logging is in use
(
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
<code class="literal">
binlog_format=ROW
</code>
</a>
).
</p>
<p>
As discussed elsewhere in this chapter,
<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>
includes in its
output the
<code class="literal">
PARTITION BY
</code>
clause used to create
a partitioned table. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa54910540"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> trb3\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> trb3
Create Table<span class="token punctuation">:</span> CREATE TABLE `trb3` (
`id` int(11) DEFAULT NULL,
`name` varchar(50) DEFAULT NULL,
`purchased` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/<span class="token punctuation">*</span>!50100 PARTITION BY RANGE (YEAR(purchased))
(PARTITION p0 VALUES LESS THAN (1990) ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN (1995) ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN (2000) ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN (2005) ENGINE = InnoDB) <span class="token punctuation">*</span>/
</span><span class="token output">0 row in set (0.00 sec)</span></code></pre>
</div>
<p>
The output from
<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>
for partitioned tables is the same as that for nonpartitioned
tables, except that the
<code class="literal">
Create_options
</code>
column
contains the string
<code class="literal">
partitioned
</code>
. The
<code class="literal">
Engine
</code>
column contains the name of the
storage engine used by all partitions of the table. (See
<a class="xref" href="show-table-status.html" title="15.7.7.38 SHOW TABLE STATUS Statement">
Section 15.7.7.38, “SHOW TABLE STATUS Statement”
</a>
, for more information about
this statement.)
</p>
<p>
You can also obtain information about partitions from
<code class="literal">
INFORMATION_SCHEMA
</code>
, which contains a
<a class="link" href="information-schema-partitions-table.html" title="28.3.21 The INFORMATION_SCHEMA PARTITIONS Table">
<code class="literal">
PARTITIONS
</code>
</a>
table. See
<a class="xref" href="information-schema-partitions-table.html" title="28.3.21 The INFORMATION_SCHEMA PARTITIONS Table">
Section 28.3.21, “The INFORMATION_SCHEMA PARTITIONS Table”
</a>
.
</p>
<a class="indexterm" name="idm46045083388336">
</a>
<a class="indexterm" name="idm46045083386848">
</a>
<p>
It is possible to determine which partitions of a partitioned
table are involved in a given
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
query using
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
. The
<code class="literal">
partitions
</code>
column in the
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
output lists the
partitions from which records would be matched by the query.
</p>
<p>
Suppose that a table
<code class="literal">
trb1
</code>
is created and
populated as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa49824611"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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> trb1 <span class="token punctuation">(</span>id <span class="token datatype">INT</span><span class="token punctuation">,</span> <span class="token keyword">name</span> <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">50</span><span class="token punctuation">)</span><span class="token punctuation">,</span> purchased <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 punctuation">(</span>id<span class="token punctuation">)</span>
<span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">7</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">9</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">11</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> trb1 <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">'desk organiser'</span><span class="token punctuation">,</span> <span class="token string">'2003-10-15'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token string">'CD player'</span><span class="token punctuation">,</span> <span class="token string">'1993-11-05'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span> <span class="token string">'TV set'</span><span class="token punctuation">,</span> <span class="token string">'1996-03-10'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">,</span> <span class="token string">'bookcase'</span><span class="token punctuation">,</span> <span class="token string">'1982-01-10'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span> <span class="token string">'exercise bike'</span><span class="token punctuation">,</span> <span class="token string">'2004-05-09'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">6</span><span class="token punctuation">,</span> <span class="token string">'sofa'</span><span class="token punctuation">,</span> <span class="token string">'1987-06-05'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">7</span><span class="token punctuation">,</span> <span class="token string">'popcorn maker'</span><span class="token punctuation">,</span> <span class="token string">'2001-11-22'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">8</span><span class="token punctuation">,</span> <span class="token string">'aquarium'</span><span class="token punctuation">,</span> <span class="token string">'1992-08-04'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">9</span><span class="token punctuation">,</span> <span class="token string">'study desk'</span><span class="token punctuation">,</span> <span class="token string">'1984-09-16'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span> <span class="token string">'lava lamp'</span><span class="token punctuation">,</span> <span class="token string">'1998-12-25'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
You can see which partitions are used in a query such as
<code class="literal">
SELECT * FROM trb1;
</code>
, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa75593582"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">EXPLAIN</span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> trb1\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
id<span class="token punctuation">:</span> 1
select_type<span class="token punctuation">:</span> SIMPLE
table<span class="token punctuation">:</span> trb1
partitions<span class="token punctuation">:</span> p0,p1,p2,p3
type<span class="token punctuation">:</span> ALL
possible_keys<span class="token punctuation">:</span> NULL
key<span class="token punctuation">:</span> NULL
key_len<span class="token punctuation">:</span> NULL
ref<span class="token punctuation">:</span> NULL
rows<span class="token punctuation">:</span> 10
Extra<span class="token punctuation">:</span> Using filesort</span></code></pre>
</div>
<p>
In this case, all four partitions are searched. However, when a
limiting condition making use of the partitioning key is added
to the query, you can see that only those partitions containing
matching values are scanned, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa62429990"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">EXPLAIN</span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> trb1 <span class="token keyword">WHERE</span> id <span class="token operator"><</span> <span class="token number">5</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
id<span class="token punctuation">:</span> 1
select_type<span class="token punctuation">:</span> SIMPLE
table<span class="token punctuation">:</span> trb1
partitions<span class="token punctuation">:</span> p0,p1
type<span class="token punctuation">:</span> ALL
possible_keys<span class="token punctuation">:</span> NULL
key<span class="token punctuation">:</span> NULL
key_len<span class="token punctuation">:</span> NULL
ref<span class="token punctuation">:</span> NULL
rows<span class="token punctuation">:</span> 10
Extra<span class="token punctuation">:</span> Using where</span></code></pre>
</div>
<p>
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
also provides
information about keys used and possible keys:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa90032825"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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> trb1 <span class="token keyword">ADD</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span>id<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 10 rows affected (0.03 sec)</span>
<span class="token output">Records: 10 Duplicates: 0 Warnings: 0</span>
<span class="token prompt">mysql></span> <span class="token keyword">EXPLAIN</span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> trb1 <span class="token keyword">WHERE</span> id <span class="token operator"><</span> <span class="token number">5</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
id<span class="token punctuation">:</span> 1
select_type<span class="token punctuation">:</span> SIMPLE
table<span class="token punctuation">:</span> trb1
partitions<span class="token punctuation">:</span> p0,p1
type<span class="token punctuation">:</span> range
possible_keys<span class="token punctuation">:</span> PRIMARY
key<span class="token punctuation">:</span> PRIMARY
key_len<span class="token punctuation">:</span> 4
ref<span class="token punctuation">:</span> NULL
rows<span class="token punctuation">:</span> 7
Extra<span class="token punctuation">:</span> Using where</span></code></pre>
</div>
<p>
If
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
is used to examine a
query against a nonpartitioned table, no error is produced, but
the value of the
<code class="literal">
partitions
</code>
column is always
<code class="literal">
NULL
</code>
.
</p>
<p>
The
<code class="literal">
rows
</code>
column of
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
output displays the total
number of rows in the table.
</p>
<p>
See also
<a class="xref" href="explain.html" title="15.8.2 EXPLAIN Statement">
Section 15.8.2, “EXPLAIN Statement”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/comparisons-using-subqueries.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="comparisons-using-subqueries">
</a>
15.2.15.2 Comparisons Using Subqueries
</h4>
</div>
</div>
</div>
<p>
The most common use of a subquery is in the form:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa87561705"><div class="copy-help left">Press ⌘+C to copy</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">non_subquery_operand</em> <em class="replaceable">comparison_operator</em> <span class="token punctuation">(</span><em class="replaceable">subquery</em><span class="token punctuation">)</span></code></pre>
</div>
<p>
Where
<em class="replaceable">
<code>
comparison_operator
</code>
</em>
is one of
these operators:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa44249406"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token operator">=</span> <span class="token operator">></span> <span class="token operator"><</span> <span class="token operator">>=</span> <span class="token operator"><=</span> <span class="token operator"><></span> <span class="token operator">!=</span> <span class="token operator"><=></span></code></pre>
</div>
<p>
For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa32895026"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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 punctuation">.</span><span class="token punctuation">.</span> <span class="token keyword">WHERE</span> <span class="token string">'a'</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> column1 <span class="token keyword">FROM</span> t1<span class="token punctuation">)</span></code></pre>
</div>
<p>
MySQL also permits this construct:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa88152287"><div class="copy-help left">Press ⌘+C to copy</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">non_subquery_operand</em> <span class="token operator">LIKE</span> <span class="token punctuation">(</span><em class="replaceable">subquery</em><span class="token punctuation">)</span></code></pre>
</div>
<p>
At one time the only legal place for a subquery was on the right
side of a comparison, and you might still find some old DBMSs
that insist on this.
</p>
<p>
Here is an example of a common-form subquery comparison that you
cannot do with a join. It finds all the rows in table
<code class="literal">
t1
</code>
for which the
<code class="literal">
column1
</code>
value is equal to a maximum value in table
<code class="literal">
t2
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa7009455"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1
<span class="token keyword">WHERE</span> column1 <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>column2<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t2<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Here is another example, which again is impossible with a join
because it involves aggregating for one of the tables. It finds
all rows in table
<code class="literal">
t1
</code>
containing a value that
occurs twice in a given column:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa36201939"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">AS</span> t
<span class="token keyword">WHERE</span> <span class="token number">2</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token function">COUNT</span><span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> t1<span class="token punctuation">.</span>id <span class="token operator">=</span> t<span class="token punctuation">.</span>id<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For a comparison of the subquery to a scalar, the subquery must
return a scalar. For a comparison of the subquery to a row
constructor, the subquery must be a row subquery that returns a
row with the same number of values as the row constructor. See
<a class="xref" href="row-subqueries.html" title="15.2.15.5 Row Subqueries">
Section 15.2.15.5, “Row Subqueries”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/expired-password-handling.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="expired-password-handling">
</a>
8.2.16 Server Handling of Expired Passwords
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045248285520">
</a>
<a class="indexterm" name="idm46045248284448">
</a>
<a class="indexterm" name="idm46045248282960">
</a>
<a class="indexterm" name="idm46045248281472">
</a>
<p>
MySQL provides password-expiration capability, which enables
database administrators to require that users reset their
password. Passwords can be expired manually, and on the basis of a
policy for automatic expiration (see
<a class="xref" href="password-management.html" title="8.2.15 Password Management">
Section 8.2.15, “Password Management”
</a>
).
</p>
<p>
The
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
statement enables
account password expiration. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa88101035"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><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">USER</span> <span class="token string">'myuser'</span>@<span class="token string">'localhost'</span> <span class="token keyword">PASSWORD</span> <span class="token keyword">EXPIRE</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For each connection that uses an account with an expired password,
the server either disconnects the client or restricts the client
to
<span class="quote">
“
<span class="quote">
sandbox mode,
</span>
”
</span>
in which the server permits the
client to perform only those operations necessary to reset the
expired password. Which action is taken by the server depends on
both client and server settings, as discussed later.
</p>
<p>
If the server disconnects the client, it returns an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_must_change_password_login" target="_top">
<code class="literal">
ER_MUST_CHANGE_PASSWORD_LOGIN
</code>
</a>
error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa62109102"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span> <span class="token property">-u</span> myuser <span class="token property">-p</span>
Password<span class="token punctuation">:</span> ******
<span class="token output">ERROR 1862 (HY000)<span class="token punctuation">:</span> Your password has expired. To log in you must
change it using a client that supports expired passwords.</span></code></pre>
</div>
<p>
If the server restricts the client to sandbox mode, these
operations are permitted within the client session:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The client can reset the account password with
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
or
<a class="link" href="set-password.html" title="15.7.1.10 SET PASSWORD Statement">
<code class="literal">
SET PASSWORD
</code>
</a>
. After that has
been done, the server restores normal access for the session,
as well as for subsequent connections that use the account.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Although it is possible to
<span class="quote">
“
<span class="quote">
reset
</span>
”
</span>
an expired
password by setting it to its current value, it is
preferable, as a matter of good policy, to choose a
different password. DBAs can enforce non-reuse by
establishing an appropriate password-reuse policy. See
<a class="xref" href="password-management.html#password-reuse-policy" title="Password Reuse Policy">
Password Reuse Policy
</a>
.
</p>
</div>
</li>
</ul>
</div>
<p>
For any operation not permitted within the session, the server
returns an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_must_change_password" target="_top">
<code class="literal">
ER_MUST_CHANGE_PASSWORD
</code>
</a>
error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa93984337"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">USE</span> performance_schema<span class="token punctuation">;</span>
<span class="token output">ERROR 1820 (HY000)<span class="token punctuation">:</span> You must reset your password using ALTER USER
statement before executing this statement.
</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1820 (HY000)<span class="token punctuation">:</span> You must reset your password using ALTER USER
statement before executing this statement.</span></code></pre>
</div>
<p>
That is what normally happens for interactive invocations 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 because by default such
invocations are put in sandbox mode. To resume normal functioning,
select a new password.
</p>
<p>
For noninteractive invocations 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 (for example, in batch mode), the server normally
disconnects the client if the password is expired. To permit
noninteractive
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
invocations to stay
connected so that the password can be changed (using the
statements permitted in sandbox mode), add the
<a class="link" href="mysql-command-options.html#option_mysql_connect-expired-password">
<code class="option">
--connect-expired-password
</code>
</a>
option to
the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
command.
</p>
<p>
As mentioned previously, whether the server disconnects an
expired-password client or restricts it to sandbox mode depends on
a combination of client and server settings. The following
discussion describes the relevant settings and how they interact.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
This discussion applies only for accounts with expired
passwords. If a client connects using a nonexpired password, the
server handles the client normally.
</p>
</div>
<p>
On the client side, a given client indicates whether it can handle
sandbox mode for expired passwords. For clients that use the C
client library, there are two ways to do this:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Pass the
<code class="literal">
MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS
</code>
flag
to
<a class="ulink" href="/doc/c-api/8.4/en/mysql-options.html" target="_top">
<code class="literal">
mysql_options()
</code>
</a>
prior to
connecting:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-c"><div class="docs-select-all right" id="sa6192308"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-c">bool arg <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token function">mysql_options</span><span class="token punctuation">(</span>mysql<span class="token punctuation">,</span>
MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS<span class="token punctuation">,</span>
<span class="token operator">&</span>arg<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
This is the technique used within the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, which enables
<code class="literal">
MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS
</code>
if
invoked interactively or with the
<a class="link" href="mysql-command-options.html#option_mysql_connect-expired-password">
<code class="option">
--connect-expired-password
</code>
</a>
option.
</p>
</li>
<li class="listitem">
<p>
Pass the
<code class="literal">
CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS
</code>
flag 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:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-c"><div class="docs-select-all right" id="sa33213958"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-c">MYSQL mysql<span class="token punctuation">;</span>
<span class="token function">mysql_init</span><span class="token punctuation">(</span><span class="token operator">&</span>mysql<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span><span class="token function">mysql_real_connect</span><span class="token punctuation">(</span><span class="token operator">&</span>mysql<span class="token punctuation">,</span>
host<span class="token punctuation">,</span> user<span class="token punctuation">,</span> password<span class="token punctuation">,</span> db<span class="token punctuation">,</span>
port<span class="token punctuation">,</span> unix_socket<span class="token punctuation">,</span>
CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS<span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> handle error <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>
Other MySQL Connectors have their own conventions for indicating
readiness to handle sandbox mode. See the documentation for the
Connector in which you are interested.
</p>
<p>
On the server side, if a client indicates that it can handle
expired passwords, the server puts it in sandbox mode.
</p>
<p>
If a client does not indicate that it can handle expired passwords
(or uses an older version of the client library that cannot so
indicate), the server action depends on the value of the
<a class="link" href="server-system-variables.html#sysvar_disconnect_on_expired_password">
<code class="literal">
disconnect_on_expired_password
</code>
</a>
system variable:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If
<a class="link" href="server-system-variables.html#sysvar_disconnect_on_expired_password">
<code class="literal">
disconnect_on_expired_password
</code>
</a>
is enabled (the default), the server disconnects the client
with an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_must_change_password_login" target="_top">
<code class="literal">
ER_MUST_CHANGE_PASSWORD_LOGIN
</code>
</a>
error.
</p>
</li>
<li class="listitem">
<p>
If
<a class="link" href="server-system-variables.html#sysvar_disconnect_on_expired_password">
<code class="literal">
disconnect_on_expired_password
</code>
</a>
is disabled, the server puts the client in sandbox mode.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-information-schema.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="innodb-information-schema">
</a>
17.15 InnoDB INFORMATION_SCHEMA Tables
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<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>
</div>
<a class="indexterm" name="idm46045151425536">
</a>
<p>
This section provides information and usage examples for
<code class="literal">
InnoDB
</code>
<a class="link" href="information-schema.html" title="Chapter 28 INFORMATION_SCHEMA Tables">
<code class="literal">
INFORMATION_SCHEMA
</code>
</a>
tables.
</p>
<p>
<code class="literal">
InnoDB
</code>
<code class="literal">
INFORMATION_SCHEMA
</code>
tables provide metadata, status information, and statistics about
various aspects of the
<code class="literal">
InnoDB
</code>
storage engine. You
can view a list of
<code class="literal">
InnoDB
</code>
<code class="literal">
INFORMATION_SCHEMA
</code>
tables by issuing a
<a class="link" href="show-tables.html" title="15.7.7.39 SHOW TABLES Statement">
<code class="literal">
SHOW TABLES
</code>
</a>
statement on the
<code class="literal">
INFORMATION_SCHEMA
</code>
database:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa80592752"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy 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">TABLES</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA <span class="token operator">LIKE</span> <span class="token string">'INNODB%'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For table definitions, see
<a class="xref" href="innodb-information-schema-tables.html" title="28.4 INFORMATION_SCHEMA InnoDB Tables">
Section 28.4, “INFORMATION_SCHEMA InnoDB Tables”
</a>
. For general
information regarding the
<code class="literal">
MySQL
</code>
<code class="literal">
INFORMATION_SCHEMA
</code>
database, see
<a class="xref" href="information-schema.html" title="Chapter 28 INFORMATION_SCHEMA Tables">
Chapter 28,
<i>
INFORMATION_SCHEMA Tables
</i>
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/condition-handling.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="condition-handling">
</a>
15.6.7 Condition Handling
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="declare-condition.html">
15.6.7.1 DECLARE ... CONDITION Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="declare-handler.html">
15.6.7.2 DECLARE ... HANDLER Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="get-diagnostics.html">
15.6.7.3 GET DIAGNOSTICS Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="resignal.html">
15.6.7.4 RESIGNAL Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="signal.html">
15.6.7.5 SIGNAL Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="handler-scope.html">
15.6.7.6 Scope Rules for Handlers
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="diagnostics-area.html">
15.6.7.7 The MySQL Diagnostics Area
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="conditions-and-parameters.html">
15.6.7.8 Condition Handling and OUT or INOUT Parameters
</a>
</span>
</dt>
</dl>
</div>
<p>
Conditions may arise during stored program execution that require
special handling, such as exiting the current program block or
continuing execution. Handlers can be defined for general
conditions such as warnings or exceptions, or for specific
conditions such as a particular error code. Specific conditions
can be assigned names and referred to that way in handlers.
</p>
<p>
To name a condition, use the
<a class="link" href="declare-condition.html" title="15.6.7.1 DECLARE ... CONDITION Statement">
<code class="literal">
DECLARE ...
CONDITION
</code>
</a>
statement. To declare a handler, use the
<a class="link" href="declare-handler.html" title="15.6.7.2 DECLARE ... HANDLER Statement">
<code class="literal">
DECLARE ...
HANDLER
</code>
</a>
statement. See
<a class="xref" href="declare-condition.html" title="15.6.7.1 DECLARE ... CONDITION Statement">
Section 15.6.7.1, “DECLARE ... CONDITION Statement”
</a>
, and
<a class="xref" href="declare-handler.html" title="15.6.7.2 DECLARE ... HANDLER Statement">
Section 15.6.7.2, “DECLARE ... HANDLER Statement”
</a>
. For information about how the
server chooses handlers when a condition occurs, see
<a class="xref" href="handler-scope.html" title="15.6.7.6 Scope Rules for Handlers">
Section 15.6.7.6, “Scope Rules for Handlers”
</a>
.
</p>
<p>
To raise a condition, use the
<a class="link" href="signal.html" title="15.6.7.5 SIGNAL Statement">
<code class="literal">
SIGNAL
</code>
</a>
statement. To modify
condition information within a condition handler, use
<a class="link" href="resignal.html" title="15.6.7.4 RESIGNAL Statement">
<code class="literal">
RESIGNAL
</code>
</a>
. See
<a class="xref" href="declare-condition.html" title="15.6.7.1 DECLARE ... CONDITION Statement">
Section 15.6.7.1, “DECLARE ... CONDITION Statement”
</a>
, and
<a class="xref" href="declare-handler.html" title="15.6.7.2 DECLARE ... HANDLER Statement">
Section 15.6.7.2, “DECLARE ... HANDLER Statement”
</a>
.
</p>
<p>
To retrieve information from the diagnostics area, use the
<a class="link" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
<code class="literal">
GET DIAGNOSTICS
</code>
</a>
statement (see
<a class="xref" href="get-diagnostics.html" title="15.6.7.3 GET DIAGNOSTICS Statement">
Section 15.6.7.3, “GET DIAGNOSTICS Statement”
</a>
). For information about the
diagnostics area, see
<a class="xref" href="diagnostics-area.html" title="15.6.7.7 The MySQL Diagnostics Area">
Section 15.6.7.7, “The MySQL Diagnostics Area”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-tablespace-autoextend-size.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="innodb-tablespace-autoextend-size">
</a>
17.6.3.9 Tablespace AUTOEXTEND_SIZE Configuration
</h4>
</div>
</div>
</div>
<p>
By default, when a file-per-table or general tablespace requires
additional space, the tablespace is extended incrementally
according to the following rules:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the tablespace is less than an extent in size, it is
extended one page at a time.
</p>
</li>
<li class="listitem">
<p>
If the tablespace is greater than 1 extent but smaller than 32
extents in size, it is extended one extent at a time.
</p>
</li>
<li class="listitem">
<p>
If the tablespace is more than 32 extents in size, it is
extended four extents at a time.
</p>
</li>
</ul>
</div>
<p>
For information about extent size, see
<a class="xref" href="innodb-file-space.html" title="17.11.2 File Space Management">
Section 17.11.2, “File Space Management”
</a>
.
</p>
<p>
The amount by which a file-per-table or general tablespace is
extended is configurable by specifying the
<code class="literal">
AUTOEXTEND_SIZE
</code>
option. Configuring a larger
extension size can help avoid fragmentation and facilitate
ingestion of large amounts of data.
</p>
<p>
To configure the extension size for a file-per-table tablespace,
specify the
<code class="literal">
AUTOEXTEND_SIZE
</code>
size in a
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
or
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa80823585"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>c1 <span class="token datatype">INT</span><span class="token punctuation">)</span> <span class="token keyword">AUTOEXTEND_SIZE</span> <span class="token operator">=</span> 4M<span class="token punctuation">;</span>
<span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">AUTOEXTEND_SIZE</span> <span class="token operator">=</span> 8M<span class="token punctuation">;</span></code></pre>
</div>
<p>
To configure the extension size for a general tablespace, specify
the
<code class="literal">
AUTOEXTEND_SIZE
</code>
size in a
<a class="link" href="create-tablespace.html" title="15.1.21 CREATE TABLESPACE Statement">
<code class="literal">
CREATE TABLESPACE
</code>
</a>
or
<a class="link" href="alter-tablespace.html" title="15.1.10 ALTER TABLESPACE Statement">
<code class="literal">
ALTER TABLESPACE
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa2420417"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLESPACE</span> ts1 <span class="token keyword">AUTOEXTEND_SIZE</span> <span class="token operator">=</span> 4M<span class="token punctuation">;</span>
<span class="token keyword">ALTER</span> <span class="token keyword">TABLESPACE</span> ts1 <span class="token keyword">AUTOEXTEND_SIZE</span> <span class="token operator">=</span> 8M<span class="token punctuation">;</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<code class="literal">
AUTOEXTEND_SIZE
</code>
option can also be used
when creating an undo tablespace, but the extension behavior for
undo tablespaces differs. For more information, see
<a class="xref" href="innodb-undo-tablespaces.html" title="17.6.3.4 Undo Tablespaces">
Section 17.6.3.4, “Undo Tablespaces”
</a>
.
</p>
</div>
<p>
The
<code class="literal">
AUTOEXTEND_SIZE
</code>
setting must be a multiple
of 4M. Specifying an
<code class="literal">
AUTOEXTEND_SIZE
</code>
setting
that is not a multiple of 4M returns an error.
</p>
<p>
The
<code class="literal">
AUTOEXTEND_SIZE
</code>
default setting is 0, which
causes the tablespace to be extended according to the default
behavior described above.
</p>
<p>
The maximum allowed
<code class="literal">
AUTOEXTEND_SIZE
</code>
is 4GB. The
maximum tablespace size is described at
<a class="xref" href="innodb-limits.html" title="17.21 InnoDB Limits">
Section 17.21, “InnoDB Limits”
</a>
.
</p>
<p>
The minimum
<code class="literal">
AUTOEXTEND_SIZE
</code>
setting depends on
the
<code class="literal">
InnoDB
</code>
page size, as shown in the following
table:
</p>
<div class="informaltable">
<table summary="The minimum AUTOEXTEND_SIZE for each InnoDB page size">
<colgroup>
<col style="width: 50%"/>
<col style="width: 50%"/>
</colgroup>
<thead>
<tr>
<th>
InnoDB Page Size
</th>
<th>
Minimum AUTOEXTEND_SIZE
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code class="literal">
4K
</code>
</td>
<td>
<code class="literal">
4M
</code>
</td>
</tr>
<tr>
<td>
<code class="literal">
8K
</code>
</td>
<td>
<code class="literal">
4M
</code>
</td>
</tr>
<tr>
<td>
<code class="literal">
16K
</code>
</td>
<td>
<code class="literal">
4M
</code>
</td>
</tr>
<tr>
<td>
<code class="literal">
32K
</code>
</td>
<td>
<code class="literal">
8M
</code>
</td>
</tr>
<tr>
<td>
<code class="literal">
64K
</code>
</td>
<td>
<code class="literal">
16M
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The default
<code class="literal">
InnoDB
</code>
page size is 16K (16384
bytes). To determine the
<code class="literal">
InnoDB
</code>
page size for
your MySQL instance, query the
<a class="link" href="innodb-parameters.html#sysvar_innodb_page_size">
<code class="literal">
innodb_page_size
</code>
</a>
setting:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34077843"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@@GLOBAL.innodb_page_size</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @@GLOBAL.innodb_page_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>
<span class="token output"><span class="token punctuation">|</span> 16384 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 the
<code class="literal">
AUTOEXTEND_SIZE
</code>
setting for a
tablespace is altered, the first extension that occurs afterward
increases the tablespace size to a multiple of the
<code class="literal">
AUTOEXTEND_SIZE
</code>
setting. Subsequent extensions
are of the configured size.
</p>
<p>
When a file-per-table or general tablespace is created with a
non-zero
<code class="literal">
AUTOEXTEND_SIZE
</code>
setting, the
tablespace is initialized at the specified
<code class="literal">
AUTOEXTEND_SIZE
</code>
size.
</p>
<p>
<a class="link" href="alter-tablespace.html" title="15.1.10 ALTER TABLESPACE Statement">
<code class="literal">
ALTER TABLESPACE
</code>
</a>
cannot be used to
configure the
<code class="literal">
AUTOEXTEND_SIZE
</code>
of a
file-per-table tablespace.
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
must be used.
</p>
<p>
For tables created in file-per-table tablespaces,
<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>
shows the
<code class="literal">
AUTOEXTEND_SIZE
</code>
option only when it is
configured to a non-zero value.
</p>
<p>
To determine the
<code class="literal">
AUTOEXTEND_SIZE
</code>
for any
<code class="literal">
InnoDB
</code>
tablespace, query the Information Schema
<a class="link" href="information-schema-innodb-tablespaces-table.html" title="28.4.24 The INFORMATION_SCHEMA INNODB_TABLESPACES Table">
<code class="literal">
INNODB_TABLESPACES
</code>
</a>
table. For
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa30664136"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">NAME</span><span class="token punctuation">,</span> <span class="token keyword">AUTOEXTEND_SIZE</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_TABLESPACES
<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>
<span class="token output"><span class="token punctuation">|</span> NAME <span class="token punctuation">|</span> AUTOEXTEND_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>
<span class="token output"><span class="token punctuation">|</span> test/t1 <span class="token punctuation">|</span> 4194304 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><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 keyword">NAME</span><span class="token punctuation">,</span> <span class="token keyword">AUTOEXTEND_SIZE</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_TABLESPACES
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'ts1'</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>
<span class="token output"><span class="token punctuation">|</span> NAME <span class="token punctuation">|</span> AUTOEXTEND_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>
<span class="token output"><span class="token punctuation">|</span> ts1 <span class="token punctuation">|</span> 4194304 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
An
<code class="literal">
AUTOEXTEND_SIZE
</code>
of 0, which is the default
setting, means that the tablespace is extended according to the
default tablespace extension behavior described above.
</p>
</div>
</div>
<br/>
</div>
|
Subsets and Splits