External Locking
713
concurrent inserts at the end of the table are permitted even for tables that have deleted rows. See also
the description of the
concurrent_insert
[445]
system variable.
Under circumstances where concurrent inserts can be used, there is seldom any need to use the
DELAYED
modifier for
INSERT
statements. See
Section 13.2.5.2, “
INSERT DELAYED
Syntax”
.
If you are using the binary log, concurrent inserts are converted to normal inserts for
CREATE ...
SELECT
or
INSERT ... SELECT
statements. This is done to ensure that you can re-create an exact
copy of your tables by applying the log during a backup operation. See
Section 5.2.3, “The Binary Log”
.
In addition, for those statements a read lock is placed on the selected-from table such that inserts into
that table are blocked. The effect is that concurrent inserts for that table must wait as well.
With
LOAD DATA INFILE
, if you specify
CONCURRENT
with a
MyISAM
table that satisfies the condition
for concurrent inserts (that is, it contains no free blocks in the middle), other sessions can retrieve data
from the table while
LOAD DATA
is executing. Use of the
CONCURRENT
option affects the performance
of
LOAD DATA
a bit, even if no other session is using the table at the same time.
If you specify
HIGH_PRIORITY
, it overrides the effect of the
--low-priority-updates
[414]
option
if the server was started with that option. It also causes concurrent inserts not to be used.
For
LOCK TABLE
, the difference between
READ LOCAL
and
READ
is that
READ LOCAL
permits
nonconflicting
INSERT
statements (concurrent inserts) to execute while the lock is held. However, this
cannot be used if you are going to manipulate the database using processes external to the server
while you hold the lock.
8.7.4. External Locking
External locking is the use of file system locking to manage contention for
MyISAM
database tables by
multiple processes. External locking is used in situations where a single process such as the MySQL
server cannot be assumed to be the only process that requires access to tables. Here are some
examples:
• If you run multiple servers that use the same database directory (not recommended), each server
must have external locking enabled.
• If you use
myisamchk
to perform table maintenance operations on
MyISAM
tables, you must either
ensure that the server is not running, or that the server has external locking enabled so that it locks
table files as necessary to coordinate with
myisamchk
for access to the tables. The same is true for
use of
myisampack
to pack
MyISAM
tables.
If the server is run with external locking enabled, you can use
myisamchk
at any time for read
operations such a checking tables. In this case, if the server tries to update a table that
myisamchk
is using, the server will wait for
myisamchk
to finish before it continues.
If you use
myisamchk
for write operations such as repairing or optimizing tables, or if you use
myisampack
to pack tables, you must always ensure that the
mysqld
server is not using the table.
If you don't stop
mysqld
, you should at least do a
mysqladmin flush-tables
before you run
myisamchk
. Your tables may become corrupted if the server and
myisamchk
access the tables
simultaneously.
With external locking in effect, each process that requires access to a table acquires a file system lock
for the table files before proceeding to access the table. If all necessary locks cannot be acquired,
the process is blocked from accessing the table until the locks can be obtained (after the process that
currently holds the locks releases them).
External locking affects server performance because the server must sometimes wait for other
processes before it can access tables.
External locking is unnecessary if you run a single server to access a given data directory (which is
the usual case) and if no other programs such as
myisamchk
need to modify tables while the server
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...