InnoDB
CREATE
TABLE
ENGINE=
InnoDB
InnoDB
InnoDB
InnoDB
FOREIGN
KEY
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
WHERE
ORDER
BY
GROUP BY
InnoDB
InnoDB
InnoDB
MEMORY
InnoDB
InnoDB
InnoDB
InnoDB
START TRANSACTION
INSERT
UPDATE
DELETE
LOCK TABLES
SELECT
... FOR UPDATE
innodb_file_per_table
innodb_file_per_table
InnoDB
InnoDB
--sql_mode=NO_ENGINE_SUBSTITUTION
ENGINE=
CREATE TABLE
SHOW ENGINES
InnoDB
MySQL >显示引擎;
INFORMATION_SCHEMA.ENGINES
MySQL SELECT * FROM information_schema.engines >;
InnoDB
--default-storage-engine=InnoDB
default-storage-engine=innodb
ENGINE=
other_engine_name
CREATE TABLE
InnoDB
ALTER TABLE
table_name ENGINE=InnoDB;
CREATE TABLE InnoDB_Table (...) ENGINE=InnoDB AS SELECT * FROMother_engine_table
;
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
innodb_doublewrite
sync_binlog
fsync()
InnoDB
InnoDB
InnoDB
DB_ROLL_PTR
InnoDB
InnoDB
InnoDB
InnoDB
innodb_max_purge_lag
InnoDB
InnoDB
InnoDB
WHERE
InnoDB
InnoDB
InnoDB
INSERT
UPDATE
DELETE
InnoDB
innodb_change_buffering
InnoDB
mysql> SHOW ENGINE INNODB STATUS\G
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------插入缓冲和自适应哈希索引------------------------------------- IBUF:大小1,自由列表Len 0,赛格2号,0 mergesmerged操作:插入0,删除标记0,删除0discarded操作:插入0,删除标记0,删除0hash表大小4425293,用细胞32,结堆缓冲区1(S)13577.57哈希搜索/ s,202.47非哈希搜索/
INFORMATION_SCHEMA.INNODB_METRICS
mysql> SELECT NAME, COMMENT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME LIKE '%ibuf%'\G
INNODB_METRICS
INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
IBUF_INDEX
INNODB_BUFFER_PAGE
INNODB_BUFFER_PAGE
IBUF_BITMAP
MySQL的> SELECT (SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE PAGE_TYPE LIKE 'IBUF%') AS change_buffer_pages,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE) AS total_pages,
(SELECT ((change_buffer_pages/total_pages)*100))
AS change_buffer_page_percentage;
--------------------- ------------- ------------------------------- | change_buffer_pages | total_pages | change_buffer_page_percentage | --------------------- ------------- ------------------------------- | 25 | 8192 | 0.3052 | --------------------- ------------- -------------------------------
INNODB_BUFFER_PAGE
mysql>SELECT * FROM performance_schema.setup_instruments
WHERE NAME LIKE '%wait/synch/mutex/innodb/ibuf%';
+-------------------------------------------------------+---------+-------+ | NAME | ENABLED | TIMED | +-------------------------------------------------------+---------+-------+ | wait/synch/mutex/innodb/ibuf_bitmap_mutex | YES | YES | | wait/synch/mutex/innodb/ibuf_mutex | YES | YES | | wait/synch/mutex/innodb/ibuf_pessimistic_insert_mutex | YES | YES | +-------------------------------------------------------+---------+-------+
InnoDB
InnoDB
innodb_adaptive_hash_index
InnoDB
LIKE
innodb_adaptive_hash_index_parts
innodb_adaptive_hash_index_parts
InnoDB
SEMAPHORES
SHOW ENGINE INNODB
STATUS
innodb_log_buffer_size
innodb_flush_log_at_trx_commit
innodb_flush_log_at_timeout
InnoDB
InnoDB
ibdata1
innodb_data_file_path
InnoDB
InnoDB
InnoDB
fsync()
innodb_doublewrite
innodb_flush_method
innodb_rollback_segments
innodb_file_per_table
.ibd
DYNAMIC
InnoDB
CREATE TABLESPACE
CREATE TABLE
tbl_name
... TABLESPACE [=]
tablespace_name
ALTER TABLE
tbl_name
TABLESPACE [=]
tablespace_name
InnoDB
innodb_undo_tablespaces
innodb_undo_tablespaces
innodb_temp_data_file_path
innodb_temp_data_file_path
innodb_data_home_dir
INFORMATION_SCHEMA.FILES
mysql> SELECT * FROM INFORMATION_SCHEMA.FILES WHERE TABLESPACE_NAME='innodb_temporary'\G
INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO
innodb_temp_data_file_path
MySQL的> SELECT @@innodb_temp_data_file_path;
------------------------------ | @ @ InnoDB _ _文件日期时间_ _路径| ------------------------------ | ibtmp1::autoextend | ------------------------------ 12M
INFORMATION_SCHEMA.FILES
MySQL的> SELECT FILE_NAME, TABLESPACE_NAME, ENGINE, INITIAL_SIZE, TOTAL_EXTENTS*EXTENT_SIZE
AS TotalSizeBytes, DATA_FREE, MAXIMUM_SIZE FROM INFORMATION_SCHEMA.FILES
WHERE TABLESPACE_NAME = 'innodb_temporary'\G
*************************** 1。行:*************************** file_name。/ ibtmp1tablespace_name:innodb_temporary引擎:InnoDB initial_size:12582912:12582912:6291456 totalsizebytes data_free maximum_size:空
TotalSizeBytes
innodb_temp_data_file_path
innodb_data_home_dir
innodb_temp_data_file_path
innodb_temp_data_file_path
[mysqld]innodb_temp_data_file_path=ibtmp1:12M:autoextend:max:500M
innodb_temp_data_file_path
default_tmp_storage_engine
internal_tmp_disk_storage_engine
MyISAM
innodb_rollback_segments
InnoDB
ib_logfile0
InnoDB
InnoDB
InnoDB
COMMIT
InnoDB
InnoDB
InnoDB
autocommit
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
S
X
S
X
T1
S
T2
T2
S
T2
S
T2
X
T1
X
T2
T2
r
InnoDB
LOCK TABLES ...
WRITE
InnoDB
SELECT ...
FOR SHARE
SELECT ... FOR
UPDATE
IS
IX
X | IX | S | IS | |
---|---|---|---|---|
X | ||||
IX | ||||
S | ||||
IS |
LOCK
TABLES ... WRITE
SHOW
ENGINE INNODB STATUS
TABLE LOCK table `test`.`t` trx id 10080 lock mode IX
SELECT c1 FROM t WHERE c1 = 10 FOR UPDATE;
10
InnoDB
SHOW
ENGINE INNODB STATUS
RECORD LOCKS space id 58 page no 3 n bits 72 index `PRIMARY` of table `test`.`t` trx id 10078 lock_mode X locks rec but not gap Record lock, heap no 2 PHYSICAL RECORD: n_fields 3; compact format; info bits 0 0: len 4; hex 8000000a; asc ;; 1: len 6; hex 00000000274f; asc 'O;; 2: len 7; hex b60000019d0110; asc ;;
SELECT c1 FROM t WHERE c1 BETWEEN 10 and 20
FOR UPDATE;
t.c1
id
SELECT * FROM child WHERE id = 100;
id
InnoDB
READ COMMITTED
READ COMMITTED
UPDATE
WHERE
UPDATE
InnoDB
R
(negative infinity, 10] (10, 11] (11, 13] (13, 20] (20, positive infinity)
InnoDB
REPEATABLE READ
SHOW
ENGINE INNODB STATUS
RECORD LOCKS space id 58 page no 3 n bits 72 index `PRIMARY` of table `test`.`t` trx id 10080 lock_mode X Record lock, heap no 1 PHYSICAL RECORD: n_fields 1; compact format; info bits 0 0: len 8; hex 73757072656d756d; asc supremum;; Record lock, heap no 2 PHYSICAL RECORD: n_fields 3; compact format; info bits 0 0: len 4; hex 8000000a; asc ;; 1: len 6; hex 00000000274f; asc 'O;; 2: len 7; hex b60000019d0110; asc ;;
INSERT
mysql>CREATE TABLE child (id int(11) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
mysql>INSERT INTO child (id) values (90),(102);
mysql>START TRANSACTION;
mysql>SELECT * FROM child WHERE id > 100 FOR UPDATE;
+-----+ | id | +-----+ | 102 | +-----+
mysql>START TRANSACTION;
mysql>INSERT INTO child (id) VALUES (101);
SHOW ENGINE INNODB
STATUS
RECORD LOCKS space id 31 page no 3 n bits 72 index `PRIMARY` of table `test`.`child`
trx id 8731 lock_mode X locks gap before rec insert intention waiting
Record lock, heap no 3 PHYSICAL RECORD: n_fields 3; compact format; info bits 0
0: len 4; hex 80000066; asc f;;
1: len 6; hex 000000002215; asc " ;;
2: len 7; hex 9000000172011c; asc r ;;...
AUTO-INC
innodb_autoinc_lock_mode
InnoDB
SPATIAL
REPEATABLE
READ
SERIALIZABLE
SPATIAL
SPATIAL
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
READ UNCOMMITTED
READ COMMITTED
REPEATABLE READ
SERIALIZABLE
REPEATABLE READ
SET
TRANSACTION
--transaction-isolation
InnoDB
REPEATABLE READ
READ COMMITTED
READ UNCOMMITTED
SERIALIZABLE
REPEATABLE
READ
InnoDB
SELECT
SELECT
SELECT
FOR SHARE
UPDATE
DELETE
InnoDB
InnoDB
SELECT
FOR
SHARE
UPDATE
DELETE
READ COMMITTED
binlog_format=MIXED
READ COMMITTED
CREATE TABLE t (a INT NOT NULL, b INT) ENGINE = InnoDB; INSERT INTO t VALUES (1,2),(2,3),(3,2),(4,3),(5,2); COMMIT;
UPDATE
# Session ASTART TRANSACTION;UPDATE t SET b = 5 WHERE b = 3;
UPDATE
# Session BUPDATE t SET b = 4 WHERE b = 2;
InnoDB
UPDATE
InnoDB
InnoDB
REPEATABLE READ
UPDATE
X-lock(1.2);retain X-Lockx-lock(2.3);Update(2.3)to(2.5);retain X-Lockx-lock(3.2);retain x-ockx-lock(4.3);update(4.3)to(4.5);retain X-Lockx-lock(5.2);retain X-lock
UPDATE
UPDATE
他(1,2);阻塞并等待第一次更新提交或回滚
READ COMMITTED
UPDATE
X-lock(1.2);unlock(1.2)x-lock(2.3);Update(2.3)to(2.5);retain X-Lockx-lock(3.2);unlock(3..2)x-lock(4.3);update(4.3)to(4.5);retain X-Lockx-Lock(5.2);UNlock(5.2)
UPDATE
WHERE
UPDATE
的X锁(1.2);(2)Update to retain X(1);(2);lockx锁锁解锁(2)×(3);(3)Update to retain X(3);(4);lockx锁解锁锁(X(4)更新(2);(4);2)to retain X锁
WHERE
UPDATE
takes and retains an x-lock on each row where b = 2. The secondUPDATE
CREATE TABLE t (a INT NOT NULL, b INT, c INT, INDEX (b)) ENGINE = InnoDB;INSERT INTO t VALUES (1,2,3),(2,2,4);COMMIT;# Session ASTART TRANSACTION;UPDATE t SET b = 3 WHERE b = 2 AND c = 3;# Session BUPDATE t SET b = 4 WHERE b = 2 AND c = 4;
READ COMMITTED
innodb_locks_unsafe_for_binlog
innodb_locks_unsafe_for_binlog
innodb_locks_unsafe_for_binlog
READ COMMITTED
innodb_locks_unsafe_for_binlog
SELECT
READ COMMITTED
REPEATABLE
READ
SELECT
SELECT
... FOR SHARE
autocommit
autocommit
SELECT
SELECT
autocommit
InnoDB
autocommit
autocommit
autocommit
START
TRANSACTION
BEGIN
COMMIT
ROLLBACK
autocommit
SET autocommit = 0
COMMIT
ROLLBACK
autocommit
COMMIT
COMMIT
ROLLBACK
COMMIT
ROLLBACK
SET autocommit
= 0
COMMIT
ROLLBACK
START
TRANSACTION
COMMIT
ROLLBACK
内核> mysql test
MySQL的> CREATE TABLE customer (a INT, b CHAR (20), INDEX (a));
查询行,0行受影响(0秒)MySQL > -- Do a transaction with autocommit turned on.
MySQL的> START TRANSACTION;
查询行,0行受影响(0秒)MySQL > INSERT INTO customer VALUES (10, 'Heikki');
查询行,1行的影响(0秒)MySQL > COMMIT;
查询行,0行受影响(0秒)MySQL > -- Do another transaction with autocommit turned off.
MySQL的> SET autocommit=0;
查询行,0行受影响(0秒)MySQL > INSERT INTO customer VALUES (15, 'John');
查询行,1行的影响(0秒)MySQL > INSERT INTO customer VALUES (20, 'Paul');
查询行,1行的影响(0秒)MySQL > DELETE FROM customer WHERE b = 'Heikki';
查询行,1行的影响(0秒)MySQL > -- Now we undo those last 2 inserts and the delete.
MySQL的> ROLLBACK;
查询行,0行受影响(0秒)MySQL > SELECT * FROM customer;
————| A B | | ------ -------- | 10 |海基|————在1行集(0.00美国证券交易委员会(SEC)的MySQL >
COMMIT
SELECT
INSERT
InnoDB
SELECT
REPEATABLE READ
READ COMMITTED
InnoDB
SELECT
READ COMMITTED
REPEATABLE READ
REPEATABLE READ
SELECT
SELECT
DELETE
UPDATE
SELECT COUNT(c1) FROM t1 WHERE c1 = 'xyz'; -- Returns 0: no rows match. DELETE FROM t1 WHERE c1 = 'xyz'; -- Deletes several rows recently committed by other transaction. SELECT COUNT(c2) FROM t1 WHERE c2 = 'abc'; -- Returns 0: no rows match. UPDATE t1 SET c2 = 'cba' WHERE c2 = 'abc'; -- Affects 10 rows: another txn just committed 10 rows with 'abc' values. SELECT COUNT(c2) FROM t1 WHERE c2 = 'cba'; -- Returns 10: this txn can now see the rows it just updated.
SELECT
START TRANSACTION WITH
CONSISTENT SNAPSHOT
Session A Session B SET autocommit=0; SET autocommit=0; time | SELECT * FROM t; | empty set | INSERT INTO t VALUES (1, 2); | v SELECT * FROM t; empty set COMMIT; SELECT * FROM t; empty set COMMIT; SELECT * FROM t; --------------------- | 1 | 2 | ---------------------
READ
COMMITTED
SELECT * FROM t FOR SHARE;
READ COMMITTED
SELECT
DROP
TABLE
ALTER TABLE
ER_TABLE_DEF_CHANGED
INSERT INTO ...
SELECT
UPDATE
... (SELECT)
CREATE TABLE ...
SELECT
FOR SHARE
InnoDB
SELECT
READ COMMITTED
READ
UNCOMMITTED
READ
COMMITTED
REPEATABLE
READ
SERIALIZABLE
SELECT
SELECT ... FOR SHARE
LOCK IN SHARE MODE
OF
table_name
SKIP
LOCKED
UPDATE
FOR SHARE
START
TRANSACTION
autocommit
t2
SELECT * FROM t1 WHERE c1 = (SELECT c1 FROM t2) FOR UPDATE;
t2
SELECT * FROM t1 WHERE c1 = (SELECT c1 FROM t2 FOR UPDATE) FOR UPDATE;
child
PARENT
SELECT
SELECT
SELECT * FROM parent WHERE NAME = 'Jones' FOR SHARE;
FOR SHARE
CHILD
CHILD_CODES
CHILD
FOR SHARE
FOR
UPDATE
SELECT counter_field FROM child_codes FOR UPDATE;UPDATE child_codes SET counter_field = counter_field + 1;
SELECT ... FOR
UPDATE
UPDATE
SELECT ... FOR
UPDATE
UPDATE child_codes SET counter_field = LAST_INSERT_ID(counter_field + 1);SELECT LAST_INSERT_ID();
SELECT
SELECT ... FOR
UPDATE
NO WAIT
SELECT ... FOR
UPDATE
NOWAIT
NOWAIT
SKIP LOCKED
SKIP LOCKED
SKIP LOCKED
NO WAIT
NO WAIT
NOWAIT
NOWAIT
# Session 1: mysql>CREATE TABLE t (i INT, PRIMARY KEY (i)) ENGINE = InnoDB;
mysql>INSERT INTO t (i) VALUES(1),(2),(3);
mysql>START TRANSACTION;
mysql>SELECT * FROM t WHERE i = 2 FOR UPDATE;
+---+ | i | +---+ | 2 | +---+ # Session 2: mysql>START TRANSACTION;
mysql>SELECT * FROM t WHERE i = 2 FOR UPDATE NOWAIT;
ERROR 3572 (HY000): Do not wait for lock. # Session 3: mysql>START TRANSACTION;
mysql>SELECT * FROM t FOR UPDATE SKIP LOCKED;
+---+ | i | +---+ | 1 | | 3 | +---+
UPDATE
DELETE
InnoDB
InnoDB
InnoDB
SELECT ...
FROM
SERIALIZABLE
SERIALIZABLE
SELECT ... FOR
UPDATE
SELECT ... FOR
SHARE
UNION
SELECT
FOR SHARE
UPDATE
DELETE
InnoDB
InnoDB
SELECT ... FOR
UPDATE
SELECT ... FOR
SHARE
UPDATE ... WHERE
...
UPDATE
UPDATE
DELETE FROM ... WHERE
...
INSERT
InnoDB
CREATE TABLE t1 (i INT, PRIMARY KEY (i)) ENGINE = InnoDB;
START TRANSACTION; INSERT INTO t1 VALUES(1);
START TRANSACTION; INSERT INTO t1 VALUES(1);
START TRANSACTION; INSERT INTO t1 VALUES(1);
ROLLBACK;
START TRANSACTION; DELETE FROM t1 WHERE i = 1;
START TRANSACTION; INSERT INTO t1 VALUES(1);
START TRANSACTION; INSERT INTO t1 VALUES(1);
COMMIT;
INSERT
... ON DUPLICATE KEY UPDATE
INSERT
INSERT INTO T SELECT ... FROM S WHERE ...
READ
COMMITTED
S
S
CREATE TABLE ...
SELECT ...
SELECT
INSERT ...
SELECT
SELECT
UPDATE t ... WHERE col IN (SELECT ... FROM s
...)
s
AUTO_INCREMENT
AUTO_INCREMENT
AUTO-INC
InnoDB
FOREIGN KEY
LOCK TABLES
InnoDB
innodb_table_locks = 1
autocommit = 0
InnoDB
SELECT
id
SELECT * FROM child WHERE id > 100 FOR UPDATE;
id
id
SELECT
InnoDB
InnoDB
R
InnoDB
InnoDB
UPDATE
SELECT ... FOR
UPDATE
LOCK TABLES
SELECT ... FOR
UPDATE
SELECT ...
FOR UPDATE
UPDATE ... WHERE
InnoDB
innodb_deadlock_detect
innodb_lock_wait_timeout
SHOW ENGINE INNODB
STATUS
innodb_print_all_deadlocks
S
MySQL的> CREATE TABLE t (i INT) ENGINE = InnoDB;
查询行,0行受影响(1.07秒)MySQL > INSERT INTO t (i) VALUES(1);
查询行,1行的影响(0.09秒)MySQL > START TRANSACTION;
查询行,0行受影响(0秒)MySQL > SELECT * FROM t WHERE i = 1 FOR SHARE;
------ |)| | 1 |??????
mysql>START TRANSACTION;
Query OK, 0 rows affected (0.00 sec) mysql>DELETE FROM t WHERE i = 1;
X
S
mysql> DELETE FROM t WHERE i = 1;
ERROR 1213 (40001): Deadlock found when trying to get lock;
try restarting transaction
X
X
S
S
X
X
ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction
InnoDB
InnoDB
InnoDB
innodb_table_locks = 1
autocommit = 0
LOCK TABLES
innodb_lock_wait_timeout
InnoDB
SELECT
ROLLBACK
LATEST DETECTED DEADLOCK
innodb_lock_wait_timeout
innodb_deadlock_detect
InnoDB
SHOW ENGINE
INNODB STATUS
innodb_print_all_deadlocks
SELECT
... FOR UPDATE
READ COMMITTED
INSERT
DELETE
EXPLAIN
SELECT
SELECT
FOR SHARE
READ COMMITTED
LOCK TABLES
SET
autocommit = 0
START
TRANSACTION
LOCK
TABLES
UNLOCK
TABLES
t2
SET autocommit=0;LOCK TABLES t1 WRITE, t2 READ, ...;... do something with tables t1 and t2 here ...
打开表提交;
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
mysqld-auto.cnf
--defaults-file
mysqld --defaults-file=path_to_configuration_file
InnoDB
C:\Program Files\MySQL\MySQL Server
8.0\bin
C:\> "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld" --console
bin
内核> bin/mysqld --user=mysql &
InnoDB
InnoDB
*.ibd
InnoDB
InnoDB
fsync()
InnoDB
hdparm -W0
/dev/hda
InnoDB
innodb_doublewrite=ON
innodb_doublewrite
InnoDB
innodb_data_file_path
innodb_data_file_path
;
innodb_data_file_path=datafile_spec1
【; datafile_spec2
]…
ibdata1
[mysqld] innodb_data_file_path=ibdata1:12M:autoextend
K
G
innodb_page_size
innodb_page_size
innodb_page_size
ibdata1
[mysqld] innodb_data_file_path=ibdata1:50M;ibdata2:50M:autoextend
autoextend
file_name
:file_size
[:autoextend[:max:max_file_size
]]
autoextend
innodb_data_file_path
autoextend
autoextend
innodb_autoextend_increment
InnoDB
autoextend
ibdata1
[mysqld]innodb_data_file_path=ibdata1:12M:autoextend:max:500M
InnoDB
datadir
innodb_data_home_dir
ibdata2
InnoDB
[mysqld]innodb_data_home_dir = /path/to/myibdata/innodb_data_file_path=ibdata1:50M;ibdata2:50M:autoextend
innodb_data_home_dir
InnoDB
mkdir
InnoDB
innodb_data_home_dir
innodb_data_home_dir
./
innodb_data_home_dir
innodb_data_file_path
[mysqld]innodb_data_home_dir =innodb_data_file_path=/path/to/myibdata/ibdata1:50M;/path/to/myibdata/ibdata2:50M:autoextend
InnoDB
datadir
ib_logfile1
innodb_log_group_home_dir
InnoDB
datadir
InnoDB
[mysqld] innodb_log_group_home_dir = /dr3/iblogs
InnoDB
innodb_log_files_in_group
innodb_log_file_size
innodb_log_file_size
innodb_log_files_in_group
innodb_undo_directory
innodb_undo_directory
datadir
innodb_undo_directory
innodb_undo_tablespaces
InnoDB
innodb_data_home_dir
innodb_temp_data_file_path
innodb_temp_data_file_path
innodb_data_home_dir
innodb_temp_data_file_path
innodb_data_home_dir
datadir
innodb_temp_data_file_path
innodb_page_size
InnoDB
InnoDB
key_buffer_size
InnoDB
innodb_buffer_pool_size
innodb_buffer_pool_size
InnoDB
innodb_buffer_pool_instances
innodb_log_buffer_size
innodb_log_buffer_size
glibc
innodb_buffer_pool_size + key_buffer_size + max_connections*(sort_buffer_size+read_buffer_size+binlog_cache_size) + max_connections*2MB
sort_buffer_size +
read_buffer_size
InnoDB
InnoDB
--innodb-read-only
innodb_change_buffering=0
/var
--pid-file=
path_on_writeable_media
--event-scheduler=disabled
--innodb_temp_data_file_path
ibtmp1:12M:autoextend
innodb_temp_data_file_path
--innodb_temp_data_file_path=../../../tmp/ibtmp1:12M:autoextend
innodb_read_only
InnoDB
innodb_read_only
ANALYZE
TABLE
ALTER TABLE
tbl_name
ENGINE=engine_name
mysql
CREATE USER
GRANT
REVOKE
INSTALL PLUGIN
--innodb-read-only
innodb_change_buffering=0
innodb_log_file_size
SHOW ENGINE
INNODB STATUS
innodb_undo_tablespaces
innodb_undo_directory
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
SELECT
InnoDB
InnoDB
InnoDB
innodb_buffer_pool_size
innodb_buffer_pool_chunk_size
InnoDB
innodb_buffer_pool_size
innodb_buffer_pool_instances
innodb_buffer_pool_size
InnoDB
innodb_old_blocks_time
innodb_old_blocks_time
innodb_old_blocks_time
SET GLOBAL innodb_old_blocks_time = 1000;... perform queries that scan tables ...
SET GLOBAL innodb_old_blocks_time = 0;
innodb_old_blocks_time
innodb_random_read_ahead
page_cleaner
innodb_max_dirty_pages_pct_lwm
innodb_buffer_pool_dump_at_shutdown
innodb_buffer_pool_dump_now
innodb_buffer_pool_dump_at_shutdown
innodb_buffer_pool_load_at_startup
innodb_buffer_pool_dump_at_shutdown
innodb_buffer_pool_dump_now
innodb_buffer_pool_load_at_startup
innodb_buffer_pool_load_now
InnoDB
innodb_buffer_pool_size
innodb_buffer_pool_chunk_size
innodb_buffer_pool_chunk_size
innodb_buffer_pool_instances
innodb_buffer_pool_size
innodb_buffer_pool_chunk_size
innodb_buffer_pool_instances
innodb_buffer_pool_chunk_size
innodb_buffer_pool_instances
innodb_buffer_pool_size
innodb_buffer_pool_instances
innodb_buffer_pool_chunk_size
8G
innodb_buffer_pool_size
innodb_buffer_pool_instances=16
innodb_buffer_pool_chunk_size=128M
shell> mysqld --innodb_buffer_pool_size=8G --innodb_buffer_pool_instances=16
MySQL的> SELECT @@innodb_buffer_pool_size/1024/1024/1024;
在这里,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,这是什么?
innodb_buffer_pool_size
innodb_buffer_pool_instances
innodb_buffer_pool_chunk_size
9G
innodb_buffer_pool_instances=16
innodb_buffer_pool_chunk_size=128M
innodb_buffer_pool_size
innodb_buffer_pool_chunk_size
innodb_buffer_pool_instances
内核> mysqld --innodb_buffer_pool_size=9G --innodb_buffer_pool_instances=16
MySQL的> SELECT @@innodb_buffer_pool_size/1024/1024/1024;
------------------------------------------ | @ _ InnoDB缓冲池_ _ 1024 1024 1024大小/ / / | ------------------------------------------ | 10.000000000000 | ------------------------------------------
innodb_buffer_pool_chunk_size
shell> mysqld --innodb_buffer_pool_chunk_size=134217728
[mysqld] innodb_buffer_pool_chunk_size=134217728
innodb_buffer_pool_chunk_size
innodb_buffer_pool_chunk_size
innodb_buffer_pool_instances
innodb_buffer_pool_chunk_size
innodb_buffer_pool_size
innodb_buffer_pool_instances
2GB
1GB
innodb_buffer_pool_size
innodb_buffer_pool_instances
内核> mysqld --innodb_buffer_pool_size=2147483648 --innodb_buffer_pool_instances=4
--innodb_buffer_pool_chunk_size=1073741824;
MySQL的> SELECT @@innodb_buffer_pool_size;
--------------------------- | @ @ InnoDB缓冲池的大小_ _ _ | --------------------------- | 2147483648 | > --------------------------- MySQL SELECT @@innodb_buffer_pool_instances;
-------------------------------- | @ @ innodb_buffer_pool_instances | -------------------------------- | 4 | -------------------------------- #块大小被设置为1GB(1073741824字节)启动但#截断innodb_buffer_pool_size / innodb_buffer_pool_instancesmysql > SELECT @@innodb_buffer_pool_chunk_size;
--------------------------------- | @ @ innodb_buffer_pool_chunk_size | --------------------------------- | 536870912 | ---------------------------------
innodb_buffer_pool_chunk_size
innodb_buffer_pool_instances
innodb_buffer_pool_chunk_size
innodb_buffer_pool_size
innodb_buffer_pool_chunk_size
innodb_buffer_pool_instances
#缓冲池有128MB默认大小(134217728字节)MySQL > SELECT @@innodb_buffer_pool_size;
--------------------------- | @ @ innodb_buffer_pool_size | --------------------------- | 134217728 | --------------------------- #块大小也128mb(134217728字节)MySQL > SELECT @@innodb_buffer_pool_chunk_size;
--------------------------------- | @ @ innodb_buffer_pool_chunk_size | --------------------------------- | 134217728 | --------------------------------- #有一个单独的缓冲池instancemysql > SELECT @@innodb_buffer_pool_instances;
+--------------------------------+| @@innodb_buffer_pool_instances |+--------------------------------+| 1 |+--------------------------------+# Chunk size is decreased by 1MB (1048576 bytes) at startup# (134217728 - 1048576 = 133169152):shell>mysqld --innodb_buffer_pool_chunk_size=133169152
MySQL的> SELECT @@innodb_buffer_pool_chunk_size;
--------------------------------- | @ @ innodb_buffer_pool_chunk_size | --------------------------------- | 133169152 | --------------------------------- #缓冲池的大小从134217728增加到266338304 #缓冲池大小自动调整到一个值,等于#或多个innodb_buffer_pool_chunk_size * innodb_buffer_pool_instancesmysql > SELECT @@innodb_buffer_pool_size;
--------------------------- | @ @ InnoDB缓冲池的大小_ _ _ | --------------------------- | 266338304 | ---------------------------
# The buffer pool has a default size of 2GB (2147483648 bytes) mysql>SELECT @@innodb_buffer_pool_size;
+---------------------------+ | @@innodb_buffer_pool_size | +---------------------------+ | 2147483648 | +---------------------------+ # The chunk size is .5 GB (536870912 bytes) mysql>SELECT @@innodb_buffer_pool_chunk_size;
+---------------------------------+ | @@innodb_buffer_pool_chunk_size | +---------------------------------+ | 536870912 | +---------------------------------+ # There are 4 buffer pool instances mysql>SELECT @@innodb_buffer_pool_instances;
+--------------------------------+ | @@innodb_buffer_pool_instances | +--------------------------------+ | 4 | +--------------------------------+ # Chunk size is decreased by 1MB (1048576 bytes) at startup # (536870912 - 1048576 = 535822336): shell>mysqld --innodb_buffer_pool_chunk_size=535822336
mysql>SELECT @@innodb_buffer_pool_chunk_size;
+---------------------------------+ | @@innodb_buffer_pool_chunk_size | +---------------------------------+ | 535822336 | +---------------------------------+ # Buffer pool size increases from 2147483648 to 4286578688 # Buffer pool size is automatically adjusted to a value that is equal to # or a multiple of innodb_buffer_pool_chunk_size * innodb_buffer_pool_instances mysql>SELECT @@innodb_buffer_pool_size;
+---------------------------+ | @@innodb_buffer_pool_size | +---------------------------+ | 4286578688 | +---------------------------+
innodb_buffer_pool_chunk_size
innodb_buffer_pool_chunk_size
innodb_buffer_pool_size
innodb_buffer_pool_size
innodb_buffer_pool_chunk_size
innodb_buffer_pool_size
SET
MySQL的> SET GLOBAL innodb_buffer_pool_size=402653184;
InnoDB
Innodb_buffer_pool_resize_status
MySQL的> SHOW STATUS WHERE Variable_name='InnoDB_buffer_pool_resize_status';
---------------------------------- name变量值_ ---------------------------------- | | | ---------------------------------- ---------------------------------- | InnoDB缓冲池_ _ _ _缩放调整状态| also other哈希表。一个多月以前评论
[Note] InnoDB: Resizing buffer pool from 134217728 to 4294967296. (unit=134217728) [Note] InnoDB: disabled adaptive hash index. [Note] InnoDB: buffer pool 0 : 31 chunks (253952 blocks) was added. [Note] InnoDB: buffer pool 0 : hash tables were resized. [Note] InnoDB: Resized hash tables at lock_sys, adaptive hash index, dictionary. [Note] InnoDB: completed to resize buffer pool from 134217728 to 4294967296. [Note] InnoDB: re-enabled adaptive hash index.
[Note] InnoDB: Resizing buffer pool from 4294967296 to 134217728. (unit=134217728) [Note] InnoDB: disabled adaptive hash index. [Note] InnoDB: buffer pool 0 : start to withdraw the last 253952 blocks. [Note] InnoDB: buffer pool 0 : withdrew 253952 blocks from free list. tried to relocate 0 pages. (253952/253952) [Note] InnoDB: buffer pool 0 : withdrawn target 253952 blocks. [Note] InnoDB: buffer pool 0 : 31 chunks (253952 blocks) was freed. [Note] InnoDB: buffer pool 0 : hash tables were resized. [Note] InnoDB: Resized hash tables at lock_sys, adaptive hash index, dictionary. [Note] InnoDB: completed to resize buffer pool from 4294967296 to 134217728. [Note] InnoDB: re-enabled adaptive hash index.
chunks
innodb_buffer_pool_chunk_size
chunks
innodb_buffer_pool_chunk_size
innodb_buffer_pool_instances
innodb_buffer_pool_size
InnoDB
innodb_buffer_pool_instances
innodb_buffer_pool_instances
innodb_buffer_pool_size
InnoDB
InnoDB
3/8
InnoDB
InnoDB
innodb_old_blocks_pct
innodb_old_blocks_pct
5
innodb_old_blocks_time
innodb_old_blocks_time
innodb_old_blocks_pct
innodb_old_blocks_time
my.ini
SYSTEM_VARIABLES_ADMIN
SHOW ENGINE INNODB STATUS
innodb_old_blocks_time
innodb_old_blocks_pct
innodb_old_blocks_pct=5
innodb_old_blocks_pct
innodb_old_blocks_pct=50
innodb_old_blocks_time
innodb_old_blocks_pct
innodb_old_blocks_pct
InnoDB
InnoDB
innodb_read_ahead_threshold
innodb_read_ahead_threshold
innodb_read_ahead_threshold
innodb_read_ahead_threshold
InnoDB
SET
GLOBAL
SYSTEM_VARIABLES_ADMIN
InnoDB
innodb_random_read_ahead
SHOW ENGINE INNODB STATUS
innodb_random_read_ahead
InnoDB
InnoDB
innodb_max_dirty_pages_pct_lwm
innodb_max_dirty_pages_pct
innodb_max_dirty_pages_pct
InnoDB
InnoDB
innodb_max_dirty_pages_pct
InnoDB
innodb_adaptive_flushing
innodb_adaptive_flushing
my.cnf
SET GLOBAL
SYSTEM_VARIABLES_ADMIN
InnoDB
InnoDB
innodb_flush_neighbors
innodb_lru_scan_depth
InnoDB
InnoDB
innodb_adaptive_flushing
innodb_adaptive_flushing
innodb_io_capacity
innodb_max_dirty_pages_pct
InnoDB
innodb_adaptive_flushing_lwm
InnoDB
innodb_adaptive_flushing
InnoDB
innodb_io_capacity
innodb_io_capacity_max
InnoDB
innodb_max_dirty_pages_pct
innodb_max_dirty_pages_pct
innodb_max_dirty_pages_pct
innodb_max_dirty_pages_pct_lwm
innodb_max_dirty_pages_pct
innodb_max_dirty_pages_pct_lwm=0
innodb_flushing_avg_loops
innodb_flushing_avg_loops
InnoDB
innodb_max_dirty_pages_pct
innodb_log_file_size
innodb_flushing_avg_loops
innodb_flushing_avg_loops
InnoDB
innodb_buffer_pool_dump_pct
InnoDB
INNODB_BUFFER_PAGE_LRU
ib_buffer_pool
innodb_buffer_pool_filename
innodb_buffer_pool_dump_pct
SET GLOBAL innodb_buffer_pool_dump_pct=40;
innodb_buffer_pool_dump_pct
[mysqld]innodb_buffer_pool_dump_pct=40
innodb_buffer_pool_dump_pct
SET GLOBAL innodb_buffer_pool_dump_at_shutdown=ON;
innodb_buffer_pool_dump_at_shutdown
--innodb_buffer_pool_load_at_startup
mysqld --innodb_buffer_pool_load_at_startup=ON;
SET GLOBAL innodb_buffer_pool_dump_now=ON;
SET GLOBAL innodb_buffer_pool_load_now=ON;
SHOW STATUS LIKE 'Innodb_buffer_pool_dump_status';
SHOW STATUS LIKE 'Innodb_buffer_pool_load_status';
stage/innodb/buffer pool load
stage/innodb/buffer pool
load
MySQL的> UPDATE performance_schema.setup_instruments SET ENABLED = 'YES'
WHERE NAME LIKE 'stage/innodb/buffer%';
events_stages_current
events_stages_history
events_stages_history_long
MySQL的> UPDATE performance_schema.setup_consumers SET ENABLED = 'YES'
WHERE NAME LIKE '%stages%';
innodb_buffer_pool_dump_now
MySQL的> SET GLOBAL innodb_buffer_pool_dump_now=ON;
mysql> SHOW STATUS LIKE 'Innodb_buffer_pool_dump_status'\G
*************************** 1. row ***************************
Variable_name: Innodb_buffer_pool_dump_status
Value: Buffer pool(s) dump completed at 150202 16:38:58
innodb_buffer_pool_load_now
MySQL的> SET GLOBAL innodb_buffer_pool_load_now=ON;
events_stages_current
WORK_ESTIMATED
MySQL的> SELECT EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED
FROM performance_schema.events_stages_current;
------------------------------- ---------------- ---------------- | event_name | work_completed | work_estimated | ------------------------------- ---------------- ---------------- |阶段/ InnoDB /缓冲池的负荷| 5353 | 7167 | ------------------------------- ---------------- ----------------
events_stages_current
events_stages_history
MySQL的> SELECT EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED
FROM performance_schema.events_stages_history;
------------------------------- ---------------- ---------------- | event_name | work_completed | work_estimated | ------------------------------- ---------------- ---------------- |阶段/ InnoDB /缓冲池的负荷| 7167 | 7167 | ------------------------------- ---------------- ----------------
innodb_buffer_pool_load_at_startup
InnoDB
SHOW
ENGINE INNODB STATUS
BUFFER POOL AND
MEMORY
---------------------- BUFFER POOL AND MEMORY ---------------------- Total large memory allocated 2198863872 Dictionary memory allocated 776332 Buffer pool size 131072 Free buffers 124908 Database pages 5720 Old database pages 2071 Modified db pages 910 Pending reads 0 Pending writes: LRU 0, flush list 0, single page 0 Pages made young 4, not young 0 0.10 youngs/s, 0.00 non-youngs/s Pages read 197, created 5523, written 5060 0.00 reads/s, 190.89 creates/s, 244.94 writes/s Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000 Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s LRU len: 5720, unzip_LRU len: 0 I/O sum[0]:cur[0], unzip sum[0]:cur[0]
InnoDB
InnoDB
InnoDB | |
youngs/s
non-youngs/s
youngs/s
young-making
not
not (young-making rate)
innodb_old_blocks_time
InnoDB
INNODB_BUFFER_POOL_STATS
INNODB_BUFFER_POOL_STATS
INSERT
UPDATE
DELETE
InnoDB
InnoDB
innodb_change_buffering
innodb_change_buffering
innodb_change_buffering
all
none
inserts
deletes
changes
purges
innodb_change_buffering
my.ini
SET GLOBAL
SYSTEM_VARIABLES_ADMIN
innodb_change_buffer_max_size
innodb_change_buffer_max_size
innodb_change_buffer_max_size
innodb_change_buffer_max_size
innodb_change_buffer_max_size
InnoDB
InnoDB
InnoDB
innodb_thread_concurrency
innodb_thread_sleep_delay
innodb_adaptive_max_sleep_delay
innodb_thread_sleep_delay
innodb_thread_sleep_delay
innodb_thread_concurrency
innodb_thread_concurrency
InnoDB
innodb_thread_concurrency
innodb_thread_sleep_delay
innodb_thread_concurrency
InnoDB
innodb_thread_concurrency
InnoDB
innodb_thread_concurrency
InnoDB
innodb_thread_concurrency
innodb_concurrency_tickets
InnoDB
innodb_adaptive_hash_index
InnoDB
innodb_read_io_threads
innodb_write_io_threads
my.ini
1-64
InnoDB
InnoDB
innodb_read_io_threads
innodb_read_io_threads
InnoDB
InnoDB
InnoDB
innodb_use_native_aio
InnoDB
InnoDB
n
n
InnoDB
innodb_read_io_threads
innodb_write_io_threads
InnoDB
SHOW ENGINE INNODB STATUS\G
InnoDB
innodb_use_native_aio=0
tmpdir
tmpfs
innodb_io_capacity
innodb_io_capacity
innodb_io_capacity
innodb_io_capacity
innodb_io_capacity
innodb_io_capacity
my.cnf
SET GLOBAL
SYSTEM_VARIABLES_ADMIN
innodb_flush_sync
innodb_io_capacity
innodb_flush_sync
InnoDB
innodb_purge_threads
innodb_spin_wait_delay
innodb_spin_wait_delay=0
innodb_spin_wait_delay
my.cnf
SET GLOBAL
innodb_spin_wait_delay=
delay
delay
SYSTEM_VARIABLES_ADMIN
innodb_purge_threads
innodb_purge_threads
innodb_purge_batch_size
InnoDB
innodb_stats_auto_recalc
STATS_PERSISTENT
STATS_SAMPLE_PAGES
CREATE TABLE
ALTER TABLE
mysql.innodb_table_stats
last_update
mysql.innodb_index_stats
mysql.innodb_table_stats
innodb_stats_persistent=ON
ANALYZE TABLE
ANALYZE TABLE
innodb_stats_persistent=ON
STATS_PERSISTENT=1
innodb_stats_persistent
mysql.innodb_table_stats
ALTER TABLE
tbl_name
STATS_PERSISTENT=0
innodb_stats_auto_recalc
CREATE TABLE
ALTER TABLE
innodb_stats_auto_recalc
innodb_stats_auto_recalc
ANALYZE TABLE
innodb_stats_auto_recalc
ANALYZE TABLE
innodb_stats_auto_recalc
innodb_stats_auto_recalc
ANALYZE TABLE
innodb_stats_persistent
innodb_stats_auto_recalc
innodb_stats_persistent_sample_pages
STATS_AUTO_RECALC
CREATE TABLE
ALTER TABLE
STATS_PERSISTENT
InnoDB
innodb_stats_persistent
0
ALTER TABLE
ANALYZE
TABLE
STATS_AUTO_RECALC
InnoDB
innodb_stats_auto_recalc
0
ANALYZE
TABLE
STATS_SAMPLE_PAGES
ANALYZE
TABLE
CREATE TABLE
CREATE TABLE `t1` (`id` int(8) NOT NULL auto_increment,`data` varchar(255),`date` datetime,PRIMARY KEY (`id`),INDEX `DATE_IX` (`date`)) ENGINE=InnoDB, STATS_PERSISTENT=1, STATS_AUTO_RECALC=1, STATS_SAMPLE_PAGES=25;
ANALYZE
TABLE
innodb_stats_persistent_sample_pages
innodb_stats_persistent_sample_pages
EXPLAIN
SELECT
DISTINCT
innodb_stats_persistent_sample_pages
innodb_stats_persistent_sample_pages
ANALYZE TABLE
ANALYZE TABLE
innodb_stats_persistent_sample_pages
ANALYZE
TABLE
ANALYZE
TABLE
ANALYZE TABLE
InnoDB
READ UNCOMMITTED
innodb_stats_include_delete_marked
innodb_stats_include_delete_marked
ANALYZE TABLE
innodb_stats_include_delete_marked
mysql
innodb_index_stats
database_name | |
table_name | |
last_update | InnoDB |
n_rows | |
clustered_index_size | |
sum_of_other_index_sizes |
database_name | |
table_name | |
index_name | |
last_update | InnoDB |
stat_name | stat_value |
stat_value | stat_name |
sample_size | stat_value |
stat_description | stat_name |
innodb_table_stats
last_update
mysql> SELECT * FROM innodb_table_stats \G
*************************** 1. row ***************************
database_name: sakila
table_name: actor
last_update: 2014-05-28 16:16:44
n_rows: 200
clustered_index_size: 1
sum_of_other_index_sizes: 1
...
MySQL的> SELECT * FROM innodb_index_stats \G
*************************** 1。行*************************** database_name:sakila table_name:演员index_name:主要last_update:2014-05-28 16:16:44 stat_name:n_diff_pfx01 stat_value:200 sample_size:1…
innodb_table_stats
FLUSH TABLE
tbl_name
innodb_table_stats
ANALYZE TABLE
innodb_table_stats
t1
b
d
f
CREATE TABLE t1 (a INT, b INT, c INT, d INT, e INT, f INT,PRIMARY KEY (a, b), KEY i1 (c, d), UNIQUE KEY i2uniq (e, f)) ENGINE=INNODB;
mysql> SELECT * FROM t1;
+---+---+------+------+------+------+
| a | b | c | d | e | f |
+---+---+------+------+------+------+
| 1 | 1 | 10 | 11 | 100 | 101 |
| 1 | 2 | 10 | 11 | 200 | 102 |
| 1 | 3 | 10 | 11 | 100 | 103 |
| 1 | 4 | 10 | 12 | 200 | 104 |
| 1 | 5 | 10 | 12 | 100 | 105 |
+---+---+------+------+------+------+
ANALYZE TABLE
innodb_stats_auto_recalc
MySQL的> ANALYZE TABLE t1;
--------- --------- ---------- ---------- |表| OP | msg_type | msg_text | --------- --------- ---------- ---------- | test.t1 |分析|状态|好| --------- --------- ---------- ----------
t1
2014-03-14 14:36:34
1
mysql> SELECT * FROM mysql.innodb_table_stats WHERE table_name like 't1'\G
*************************** 1. row ***************************
database_name: test
table_name: t1
last_update: 2014-03-14 14:36:34
n_rows: 5
clustered_index_size: 1
sum_of_other_index_sizes: 2
innodb_index_stats
stat_name
mysql>SELECT index_name, stat_name, stat_value, stat_description
FROM mysql.innodb_index_stats WHERE table_name like 't1';
+------------+--------------+------------+-----------------------------------+ | index_name | stat_name | stat_value | stat_description | +------------+--------------+------------+-----------------------------------+ | PRIMARY | n_diff_pfx01 | 1 | a | | PRIMARY | n_diff_pfx02 | 5 | a,b | | PRIMARY | n_leaf_pages | 1 | Number of leaf pages in the index | | PRIMARY | size | 1 | Number of pages in the index | | i1 | n_diff_pfx01 | 1 | c | | i1 | n_diff_pfx02 | 2 | c,d | | i1 | n_diff_pfx03 | 2 | c,d,a | | i1 | n_diff_pfx04 | 5 | c,d,a,b | | i1 | n_leaf_pages | 1 | Number of leaf pages in the index | | i1 | size | 1 | Number of pages in the index | | i2uniq | n_diff_pfx01 | 2 | e | | i2uniq | n_diff_pfx02 | 5 | e,f | | i2uniq | n_leaf_pages | 1 | Number of leaf pages in the index | | i2uniq | size | 1 | Number of pages in the index | +------------+--------------+------------+-----------------------------------+
stat_name
size
=size
n_leaf_pages
=n_leaf_pages
n_diff_pfx
NN
=n_diff_pfx01
stat_name
=stat_value
=n_diff_pfx
NN
n_diff_pfx
NN
t1
b
d
f
CREATE TABLE t1 ( a INT, b INT, c INT, d INT, e INT, f INT, PRIMARY KEY (a, b), KEY i1 (c, d), UNIQUE KEY i2uniq (e, f)) ENGINE=INNODB;
mysql> SELECT * FROM t1;
+---+---+------+------+------+------+
| a | b | c | d | e | f |
+---+---+------+------+------+------+
| 1 | 1 | 10 | 11 | 100 | 101 |
| 1 | 2 | 10 | 11 | 200 | 102 |
| 1 | 3 | 10 | 11 | 100 | 103 |
| 1 | 4 | 10 | 12 | 200 | 104 |
| 1 | 5 | 10 | 12 | 100 | 105 |
+---+---+------+------+------+------+
index_name
stat_value
stat_name LIKE 'n_diff%'
MySQL的> SELECT index_name, stat_name, stat_value, stat_description
FROM mysql.innodb_index_stats
WHERE table_name like 't1' AND stat_name LIKE 'n_diff%';
————| ----------------- Enbrel ------- ----------------- Enbrel -------指标_ name name | _ |状态状态状态_价值| _描述| ----------------- Enbrel -------——----------------- Enbrel -------将|小学| N _差异_ pfx01 | | A 1 N | |小学| _差异_ pfx02 | 5 | A,B | | |(N _差异_ pfx01 | 1 | | | | C(n _差异_ pfx02 | 2 | C,D(N | | | _差异_ pfx03 | 2 | C,D,A(N | | | _差异_ pfx04 | 5 | C,D,A,B | | i2uniq | N _差异_ pfx01 | 2 |电子| | i2uniq | N _差异_ pfx02 | 5 | E、F——----------------- Enbrel -------将| ----------------- Enbrel -------
PRIMARY
InnoDB
index_name
=stat_name
=stat_value
a
a
1
stat_description
index_name
=stat_name
=stat_value
a,b
b
b
1,1
1,3
1,5
stat_description
i1
c,d
InnoDB
c,d
index_name
=stat_name
=stat_value
c
c
10
stat_description
index_name
=stat_name
=stat_value
c,d
d
d
10,11
c,d
index_name
=stat_name
=stat_value
c,d,a
d
c
a
10,11,1
c,d,a
index_name
=stat_name
=stat_value
c,d,a,b
d
b
d
b
10,11,1,1
10,11,1,3
10,12,1,5
stat_description
i2uniq
index_name
=stat_name
=stat_value
e
e
100
e
index_name
=stat_name
=stat_value
e,f
f
f
100,101
100,103
100,105
stat_description
innodb_index_stats
t1
mysql>SELECT SUM(stat_value) pages, index_name,
SUM(stat_value)*@@innodb_page_size size
FROM mysql.innodb_index_stats WHERE table_name='t1'
AND stat_name = 'size' GROUP BY index_name;
+-------+------------+-------+ | pages | index_name | size | +-------+------------+-------+ | 1 | PRIMARY | 16384 | | 1 | i1 | 16384 | | 1 | i2uniq | 16384 | +-------+------------+-------+
WHERE
mysql>SELECT SUM(stat_value) pages, index_name,
SUM(stat_value)*@@innodb_page_size size
FROM mysql.innodb_index_stats WHERE table_name like 't1#P%'
AND stat_name = 'size' GROUP BY index_name;
innodb_stats_persistent=OFF
STATS_PERSISTENT=0
innodb_stats_persistent
SHOW TABLE STATUS
SHOW INDEX
INFORMATION_SCHEMA.TABLES
INFORMATION_SCHEMA.STATISTICS
innodb_stats_on_metadata
innodb_stats_on_metadata
innodb_stats_on_metadata
innodb_stats_on_metadata
SET
SET GLOBAL innodb_stats_on_metadata=ON
innodb_stats_on_metadata
innodb_stats_persistent
--auto-rehash
auto-rehash
auto-rehash
--disable-auto-rehash
auto-rehash
InnoDB
InnoDB
innodb_stats_transient_sample_pages
innodb_stats_transient_sample_pages
innodb_stats_transient_sample_pages
innodb_stats_persistent=0
innodb_stats_transient_sample_pages
innodb_stats_transient_sample_pages
ANALYZE TABLE
ANALYZE TABLE
innodb_stats_transient_sample_pages
ANALYZE TABLE
innodb_stats_persistent_sample_pages
ANALYZE TABLE
innodb_stats_persistent_sample_pages
ANALYZE TABLE
innodb_stats_persistent_sample_pages
CREATE TABLE
ALTER TABLE
innodb_stats_persistent=OFF
innodb_stats_transient_sample_pages
ANALYZE
TABLE
ANALYZE TABLE
或(n _样品×(n _ cols _在_唯一_ N _ cols _ _ _唯一不在N中_ _ cols _ _ PK(1×N _ _唯一不_)×N _兼职)
n_sample
innodb_stats_persistent_sample_pages
n_cols_in_uniq_i
n_cols_in_non_uniq_i
n_cols_in_pk
n_non_uniq_i
n_part
t
创建表(一个int,int b INT,C,D E F int,int,int,int,int g,h,主键(A,B),(C,D i1uniq独特的关键),关键i2nonuniq(E,F),关键i3nonuniq(G,H));
mysql.innodb_index_stats
n_diff_pfx%
b
InnoDB
mysql>SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats WHERE
database_name='test' AND
table_name='t' AND
stat_name like 'n_diff_pfx%';
+------------+--------------+------------------+ | index_name | stat_name | stat_description | +------------+--------------+------------------+ | PRIMARY | n_diff_pfx01 | a | | PRIMARY | n_diff_pfx02 | a,b | | i1uniq | n_diff_pfx01 | c | | i1uniq | n_diff_pfx02 | c,d | | i2nonuniq | n_diff_pfx01 | e | | i2nonuniq | n_diff_pfx02 | e,f | | i2nonuniq | n_diff_pfx03 | e,f,a | | i2nonuniq | n_diff_pfx04 | e,f,a,b | | i3nonuniq | n_diff_pfx01 | g | | i3nonuniq | n_diff_pfx02 | g,h | | i3nonuniq | n_diff_pfx03 | g,h,a | | i3nonuniq | n_diff_pfx04 | g,h,a,b | +------------+--------------+------------------+
n_cols_in_uniq_i
d
n_cols_in_non_uniq_i
f
h
n_cols_in_pk
b
n_non_uniq_i
i3nonuniq
n_part
innodb_stats_persistent_sample_pages
20
innodb_page_size
=16384), you can then estimate that 20 * 12 * 16384t
MiB
MERGE_THRESHOLD
MERGE_THRESHOLD
UPDATE
MERGE_THRESHOLD
MERGE_THRESHOLD
MERGE_THRESHOLD
MERGE_THRESHOLD
MERGE_THRESHOLD
MERGE_THRESHOLD
table_option
CREATE TABLE
CREATE TABLE t1 ( id INT, KEY id_index (id)) COMMENT='MERGE_THRESHOLD=45';
MERGE_THRESHOLD
table_option
ALTER TABLE
CREATE TABLE t1 ( id INT, KEY id_index (id));ALTER TABLE t1 COMMENT='MERGE_THRESHOLD=40';
MERGE_THRESHOLD
index_option
CREATE TABLE
ALTER TABLE
CREATE INDEX
MERGE_THRESHOLD
CREATE TABLE
CREATE TABLE t1 ( id INT, KEY id_index (id) COMMENT 'MERGE_THRESHOLD=40');
MERGE_THRESHOLD
ALTER TABLE
CREATE TABLE t1 ( id INT, KEY id_index (id));ALTER TABLE t1 DROP KEY id_index;ALTER TABLE t1 ADD KEY id_index (id) COMMENT 'MERGE_THRESHOLD=40';
MERGE_THRESHOLD
CREATE INDEX
CREATE TABLE t1 (id INT);CREATE INDEX id_index ON t1 (id) COMMENT 'MERGE_THRESHOLD=40';
MERGE_THRESHOLD
InnoDB
MERGE_THRESHOLD
MERGE_THRESHOLD
MERGE_THRESHOLD
INNODB_INDEXES
MySQL的> SELECT * FROM INFORMATION_SCHEMA.INNODB_INDEXES WHERE NAME='id_index' \G
*************************** 1。行*************************** index_id:91名称:id_index table_id:68型:0:1:4 n_fields page_no空间:57merge_threshold:40
SHOW CREATE TABLE
table_option
mysql> SHOW CREATE TABLE t2 \G
*************************** 1. row ***************************
Table: t2
Create Table: CREATE TABLE `t2` (
`id` int(11) DEFAULT NULL,
KEY `id_index` (`id`) COMMENT 'MERGE_THRESHOLD=40'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
MERGE_THRESHOLD
MERGE_THRESHOLD
MERGE_THRESHOLD=50
SHOW INDEX
index_option
mysql> SHOW INDEX FROM t2 \G
*************************** 1. row ***************************
Table: t2
Non_unique: 1
Key_name: id_index
Seq_in_index: 1
Column_name: id
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null: YES
Index_type: BTREE
Comment:
Index_comment: MERGE_THRESHOLD=40
INNODB_METRICS
mysql>SELECT NAME, COMMENT FROM INFORMATION_SCHEMA.INNODB_METRICS
WHERE NAME like '%index_page_merge%';
+-----------------------------+----------------------------------------+ | NAME | COMMENT | +-----------------------------+----------------------------------------+ | index_page_merge_attempts | Number of index page merge attempts | | index_page_merge_successful | Number of successful index page merges | +-----------------------------+----------------------------------------+
MERGE_THRESHOLD
MERGE_THRESHOLD
INNODB_METRICS
innodb_dedicated_server
< 1G | innodb_buffer_pool_size |
<= 4G | |
< 1GB | innodb_log_file_size |
<= 4GB | |
<= 8GB | |
<= 16GB | |
O_DIRECT_NO_FSYNC
innodb_dedicated_server
innodb_flush_method
stderr
[Warning] [000000] InnoDB: Option innodb_dedicated_server is ignored for innodb_buffer_pool_size because innodb_buffer_pool_size=134217728 is specified explicitly.
innodb_dedicated_server
innodb_buffer_pool_size
innodb_log_file_size
innodb_flush_method
InnoDB
InnoDB
InnoDB
InnoDB
innodb_autoextend_increment
autoextend
, change its definition to use a fixed size, based on how large it has actually grown. Check the size of the data file, round it down to the closest multiple of 1024 × 1024 bytes (= 1MB), and specify this rounded size explicitly ininnodb_data_file_path
innodb_data_file_path
innodb_data_file_path
ibdata1
innodb_data_home_dir =innodb_data_file_path = /ibdata/ibdata1:10M:autoextend
innodb_data_home_dir = innodb_data_file_path = /ibdata/ibdata1:988M;/disk2/ibdata2:50M:autoextend
InnoDB
InnoDB
mysql> SELECT TABLE_NAME from INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='mysql' and ENGINE='InnoDB';
+---------------------------+
| TABLE_NAME |
+---------------------------+
| columns_priv |
| component |
| db |
| default_roles |
| engine_cost |
| func |
| global_grants |
| gtid_executed |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| innodb_dynamic_metadata |
| innodb_index_stats |
| innodb_table_stats |
| plugin |
| procs_priv |
| proxies_priv |
| role_edges |
| server_cost |
| servers |
| slave_master_info |
| slave_relay_log_info |
| slave_worker_info |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
*.ibd
ib_log
InnoDB
InnoDB
InnoDB
my.cnf
innodb_log_file_size
innodb_log_files_in_group
InnoDB
innodb_log_file_size
InnoDB
mysql
--memlock
root
newraw
innodb_data_file_path
[mysqld] innodb_data_home_dir= innodb_data_file_path=/dev/hdd1:3Gnewraw;/dev/hdd2:2Gnewraw
InnoDB
InnoDB
InnoDB
InnoDB
raw
[mysqld]innodb_data_home_dir=innodb_data_file_path=/dev/hdd1:3Graw;/dev/hdd2:2Graw
InnoDB
innodb_data_file_path
newraw
innodb_data_file_path
[mysqld]innodb_data_home_dir=innodb_data_file_path=//./D::10Gnewraw
//./
D:
InnoDB
InnoDB
raw
[mysqld]innodb_data_home_dir=innodb_data_file_path=//./D::10Graw
InnoDB
InnoDB
InnoDB
InnoDB
.ibd
.ibd
innodb_file_per_table
InnoDB
ALTER
TABLE
ALTER TABLE
TRUNCATE TABLE
CREATE TABLE ... DATA DIRECTORY =
absolute_path_to_directory
OPTIMIZE TABLE
OPTIMIZE TABLE
.ibd
.ibd
OPTIMIZE
TABLE
InnoDB
InnoDB
BLOB
InnoDB
innodb_flush_method
innodb_flush_method
InnoDB
fsync
InnoDB
innodb_file_per_table
innodb_file_per_table
ALTER TABLE
.ibd
ALTER TABLE
ALGORITHM=COPY
InnoDB
innodb_file_per_table
innodb_file_per_table
CREATE TABLE ...
TABLESPACE
ALTER TABLE ...
TABLESPACE
innodb_file_per_table
DROP
TABLE
innodb_autoextend_increment
innodb_autoextend_increment
innodb_file_per_table
innodb_file_per_table
--innodb_file_per_table
my.cnf
[mysqld]innodb_file_per_table=1
innodb_file_per_table
MySQL的> SET GLOBAL innodb_file_per_table=1;
innodb_file_per_table
tbl_name
.ibdtbl_name
.MYDtbl_name
.ibd
innodb_file_per_table
InnoDB
CREATE TABLE ...
TABLESPACE
InnoDB
innodb_file_per_table
MySQL的> SET GLOBAL innodb_file_per_table=1;
MySQL的> ALTER TABLE
table_name
ENGINE=InnoDB;
CREATE TABLE ...
TABLESPACE
ALTER TABLE ...
TABLESPACE
innodb_file_per_table
ALTER TABLE ...
TABLESPACE
InnoDB
.ibd
.ibd
InnoDB
innodb_file_per_table
CREATE TABLE ...
TABLESPACE
ALTER TABLE ...
TABLESPACE
innodb_file_per_table
DATA DIRECTORY =
absolute_path_to_directory
CREATE TABLE
DATA DIRECTORY
ALTER TABLE
.ibd
MySQL的> USE test;
数据库changedmysql > SHOW VARIABLES LIKE 'innodb_file_per_table';
----------------------- ------- | variable_name |价值| ----------------------- ------- | innodb_file_per_table |在| ----------------------- ------- MySQL > CREATE TABLE t1 (c1 INT PRIMARY KEY) DATA DIRECTORY = '
/alternative/directory
';# MySQL创建。在子目录对应的数据库# namedb_user @ Ubuntu新表的IBD文件:~ /替代/目录/试验 ls
t1.ibd
InnoDB
innodb_directories
innodb_directories
CREATE TABLE ...
TABLESPACE
innodb_file_per_table
MySQL的> CREATE TABLE t2 (c1 INT PRIMARY KEY) TABLESPACE = innodb_file_per_table
DATA DIRECTORY = '/alternative/directory';
innodb_file_per_table
.ibd
.ibd
.ibd
FLUSH
TABLES ... FOR EXPORT
DATA DIRECTORY
InnoDB
InnoDB
InnoDB
InnoDB
innodb_file_per_table
ALTER TABLE ...
DISCARD TABLESPACE
ALTER TABLE ...
DISCARD PARTITION ... TABLESPACE
DISCARD TABLESPACE
foreign_key_checks
foreign_key_checks=0
ALTER TABLE ...
IMPORT TABLESPACE
ALTER TABLE ...
IMPORT TABLESPACE
ALTER TABLE ...
IMPORT PARTITION ... TABLESPACE
.cfg
信息:InnoDB:IO读取错误:(2,没有这样的文件或目录)打开错误”。\检验\ t.cfg ',将试图进口无图式核对行集(0秒)
.cfg
.ibd
.cfg
SELECT MAX(ai_col) FROM
table_name
FOR UPDATE.cfg
.cfg
ALTER TABLE ...
DISCARD PARTITION ... TABLESPACE
ALTER TABLE ...
IMPORT PARTITION ... TABLESPACE
innodb_file_per_table
InnoDB
my.cnf
[mysqld] lower_case_table_names=1
lower_case_table_names
ALTER TABLE ...
DISCARD TABLESPACE
ALTER TABLE
...IMPORT TABLESPACE
CREATE TABLESPACE
InnoDB
innodb_default_row_format
ROW_FORMAT=DEFAULT
innodb_default_row_format
InnoDB
.cfp
.cfp
ALTER TABLE ...
IMPORT TABLESPACE
InnoDB
FLUSH
TABLES ... FOR EXPORT
OPTIMIZE TABLE
FULLTEXT
InnoDB
InnoDB
mysql>USE test;
mysql>CREATE TABLE t(c1 INT) ENGINE=InnoDB;
mysql>USE test;
mysql>CREATE TABLE t(c1 INT) ENGINE=InnoDB;
InnoDB
MySQL的> ALTER TABLE t DISCARD TABLESPACE;
FLUSH
TABLES ... FOR EXPORT
mysql>USE test;
mysql>FLUSH TABLES t FOR EXPORT;
.cfg
FLUSH
TABLES ... FOR EXPORT
FLUSH
TABLES ... FOR EXPORT
.cfg
.ibd
shell> scp /path/to/datadir
/test/t.{ibd,cfg} destination-server:/path/to/datadir
/test
.ibd
UNLOCK
TABLES
FLUSH
TABLES ... FOR EXPORT
MySQL的> USE test;
MySQL的> UNLOCK TABLES;
mysql>USE test;
mysql>ALTER TABLE t IMPORT TABLESPACE;
ALTER
TABLE ... IMPORT TABLESPACE
InnoDB
mysql>USE test;
mysql>CREATE TABLE t1 (i int) ENGINE = InnoDB PARTITION BY KEY (i) PARTITIONS 3;
/
datadir
/test
mysql> \! ls /path/to/datadir
/test/
t1#P#p0.ibd t1#P#p1.ibd t1#P#p2.ibd
mysql>USE test;
mysql>CREATE TABLE t1 (i int) ENGINE = InnoDB PARTITION BY KEY (i) PARTITIONS 3;
/
datadir
/test
mysql> \! ls /path/to/datadir
/test/
t1#P#p0.ibd t1#P#p1.ibd t1#P#p2.ibd
mysql> ALTER TABLE t1 DISCARD TABLESPACE;
.ibd
datadir
FLUSH
TABLES ... FOR EXPORT
mysql>USE test;
mysql>FLUSH TABLES t1 FOR EXPORT;
.cfg
/
datadir
/test
MySQL的> \! ls
/path/to/datadir
/test/# p0.ibd T1 T1 # P P P # # # p1.ibd T1 T1 # p0.cfg # p2.ibdt1 # P P P T1的# # p1.cfg # # p2.cfg
FLUSH
TABLES ... FOR EXPORT
FLUSH
TABLES ... FOR EXPORT
.cfg
FLUSH
TABLES ... FOR EXPORT
.ibd
shell>scp /path/to/datadir
/test/t1*.{ibd,cfg} destination-server:/path/to/datadir
/test
.ibd
UNLOCK
TABLES
FLUSH
TABLES ... FOR EXPORT
MySQL的> USE test;
MySQL的> UNLOCK TABLES;
mysql>USE test;
mysql>ALTER TABLE t1 IMPORT TABLESPACE;
InnoDB
mysql>USE test;
mysql>CREATE TABLE t1 (i int) ENGINE = InnoDB PARTITION BY KEY (i) PARTITIONS 4;
/
datadir
/test
mysql> \! ls /path/to/datadir
/test/
t1#P#p0.ibd t1#P#p1.ibd t1#P#p2.ibd t1#P#p3.ibd
mysql>USE test;
mysql>CREATE TABLE t1 (i int) ENGINE = InnoDB PARTITION BY KEY (i) PARTITIONS 4;
/
datadir
/test
mysql> \! ls /path/to/datadir
/test/
t1#P#p0.ibd t1#P#p1.ibd t1#P#p2.ibd t1#P#p3.ibd
mysql> ALTER TABLE t1 DISCARD PARTITION p2, p3 TABLESPACE;
.ibd
datadir
MySQL的> \! ls
/path/to/datadir
/test/# p0.ibd T1 T1 # P P # p1.ibd #
ALTER
TABLE ... DISCARD PARTITION ... TABLESPACE
FLUSH
TABLES ... FOR EXPORT
mysql>USE test;
mysql>FLUSH TABLES t1 FOR EXPORT;
.cfg
datadir
.ibd
MySQL的> \! ls
/path/to/datadir
/test/T1 # P # p0.ibd T1 # P # p1.ibd T1 # P # p2.ibd T1 # P # P3。ibdt1 # P # p0.cfg T1 # P # p1.cfg T1 # P # p2.cfg T1 # P # p3.cfg
FLUSH
TABLES ... FOR EXPORT
FLUSH
TABLES ... FOR EXPORT
.cfg
FLUSH
TABLES ... FOR EXPORT
.ibd
.ibd
data
内核> scp t1#P#p2.ibd t1#P#p2.cfg t1#P#p3.ibd t1#P#p3.cfg destination-server:
/path/to/datadir
/test
.ibd
UNLOCK
TABLES
FLUSH
TABLES ... FOR EXPORT
MySQL的> USE test;
MySQL的> UNLOCK TABLES;
mysql>USE test;
mysql>ALTER TABLE t1 IMPORT PARTITION p2, p3 TABLESPACE;
ALTER
TABLE ... IMPORT PARTITION ... TABLESPACE
InnoDB
ALTER TABLE
... DISCARD TABLESPACE
FLUSH
TABLES ... FOR EXPORT
.cfg
2013-09-24T13:10:19.903526Z 2 [Note] InnoDB: Sync to disk of '"test"."t"' started. 2013-09-24T13:10:19.903586Z 2 [Note] InnoDB: Stopping purge 2013-09-24T13:10:19.903725Z 2 [Note] InnoDB: Writing table metadata to './test/t.cfg' 2013-09-24T13:10:19.904014Z 2 [Note] InnoDB: Table '"test"."t"' flushed to disk
UNLOCK
TABLES
2013-09-24T13:10:21.181104Z 2 [Note] InnoDB: Deleting the meta-data file './test/t.cfg' 2013-09-24T13:10:21.181180Z 2 [Note] InnoDB: Resuming purge
ALTER TABLE
... IMPORT TABLESPACE
2013-07-18 15:15:01 34960 [Note] InnoDB: Importing tablespace for table 'test/t' that was exported from host 'ubuntu' 2013-07-18 15:15:01 34960 [Note] InnoDB: Phase I - Update all pages 2013-07-18 15:15:01 34960 [Note] InnoDB: Sync to disk 2013-07-18 15:15:01 34960 [Note] InnoDB: Sync to disk - done! 2013-07-18 15:15:01 34960 [Note] InnoDB: Phase III - Flush changes to disk 2013-07-18 15:15:01 34960 [Note] InnoDB: Phase IV - Flush complete
.ibd
2013-07-18 15:14:38 34960 [警告] InnoDB:表“测试”,“T”表空间设置为discarded.2013-07-18 15:14:38 7f34d9a37700 InnoDB:无法计算表的“测试”的统计,“T”因为IBD文件丢失。的帮助,请参阅tohttp://dev.mysql.com/doc/refman/8.0/en/innodb-troubleshooting.html
innodb_directories
innodb_data_home_dir
innodb_undo_directory
datadir
innodb_directories
innodb_directories
innodb_directories
--datadir
innodb_directories
mysqld --innodb-directories="directory_path_1
;directory_path_2
"
[mysqld] innodb_directories="directory_path_1
;directory_path_2
"
InnoDB
innodb_directories
innodb_data_home_dir
innodb_undo_directory
datadir
innodb_directories
actor
actor.ibd
innodb_data_home_dir
innodb_undo_directory
datadir
innodb_directories
innodb_directories
innodb_directories
InnoDB
innodb_directories
CREATE
TABLE ... DATA DIRECTORY
CREATE
TABLESPACE ... ADD DATAFILE
innodb_directories
CREATE TABLE ...
DATA DIRECTORY
CREATE
TABLESPACE ... ADD DATAFILE
CREATE
TABLESPACE ... ADD DATAFILE
INFORMATION_SCHEMA.FILES
MySQL的> SELECT TABLESPACE_NAME, FILE_NAME FROM INFORMATION_SCHEMA.FILES \G
CREATE
TABLESPACE ... ADD DATAFILE
innodb_directories
innodb_undo_tablespaces
innodb_undo_tablespaces
innodb_undo_tablespaces
innodb_undo_tablespaces
innodb_undo_tablespaces
innodb_undo_directory
datadir
innodb_undo_directory
undo_
NNN
NNN
undo space number = 0xFFFFFFF0 - undo space ID
undo space ID = 0xFFFFFFF0 - undo space number
innodb_rollback_segments
innodb_rollback_segments
innodb_rollback_segments
innodb_undo_tablespaces
innodb_undo_tablespaces
MySQL的> SELECT @@innodb_undo_tablespaces;
Taballacco,Annod,Annod Change,Annod Change,Annod Change,Annod Change,Annod Change,Annod Change,Annod Change,Annod Change,Annod Can,Annodb Conseiller,Taballages Industry
innodb_undo_tablespaces
innodb_undo_log_truncate
MySQL的> SET GLOBAL innodb_undo_log_truncate=ON;
innodb_undo_log_truncate
innodb_max_undo_log_size
innodb_max_undo_log_size
MySQL的> SELECT @@innodb_max_undo_log_size;
第二次世界大战期间发生的事件
innodb_max_undo_log_size
mysql> SET GLOBAL innodb_max_undo_log_size=2147483648;
innodb_undo_log_truncate
innodb_max_undo_log_size
innodb_page_size
innodb_undo_directory
InnoDB
MySQL的> SELECT @@innodb_undo_directory;
见到| @ @ InnoDB _ Undo _ |见到|目录。|见到
innodb_purge_rseg_truncate_frequency
innodb_purge_rseg_truncate_frequency
MySQL的> SELECT @@innodb_purge_rseg_truncate_frequency;
---------------------------------------- | @ @ InnoDB _ _ truncate _频电磁_ rseg | ---------------------------------------- | | ---------------------------------------- 128
innodb_purge_rseg_truncate_frequency
MySQL的> SET GLOBAL innodb_purge_rseg_truncate_frequency=32;
InnoDB
CREATE
TABLESPACE
innodb_file_format
innodb_file_per_table
TABLESPACE
CREATE TABLE
TABLESPACE
ALTER TABLE
CREATE TABLESPACE
CREATE TABLESPACE tablespace_name ADD DATAFILE 'file_name' [FILE_BLOCK_SIZE = value] [ENGINE [=] engine_name]
InnoDB
innodb_directories
innodb_directories
mysql> CREATE TABLESPACE `ts1` ADD DATAFILE 'ts1.ibd' Engine=InnoDB;
mysql> CREATE TABLESPACE `ts1` ADD DATAFILE '/my/tablespace/directory/ts1.ibd' Engine=InnoDB;
my_tablespace
MySQL的> CREATE TABLESPACE `ts1` ADD DATAFILE '../my_tablespace/ts1.ibd' Engine=InnoDB;
ENGINE = InnoDB
CREATE
TABLESPACE
default_storage_engine=InnoDB
InnoDB
CREATE
TABLE
tbl_name
... TABLESPACE [=]
tablespace_name
ALTER TABLE
tbl_name
TABLESPACE [=]
tablespace_name
MySQL的> CREATE TABLE t1 (c1 INT PRIMARY KEY) TABLESPACE ts1 ROW_FORMAT=COMPACT;
MySQL的> ALTER TABLE t2 TABLESPACE ts1;
CREATE
TABLE
ALTER TABLE
REDUNDANT
DYNAMIC
ROW_FORMAT=COMPRESSED
FILE_BLOCK_SIZE
innodb_page_size
FILE_BLOCK_SIZE/1024
innodb_page_size=16K
FILE_BLOCK_SIZE=8K
KEY_BLOCK_SIZE
innodb_page_size
KEY_BLOCK_SIZE
KEY_BLOCK_SIZE
FILE_BLOCK_SIZE
KEY_BLOCK_SIZE
CREATE TABLE
innodb_page_size
| ||
innodb_page_size
| ||
innodb_page_size
| ||
innodb_page_size
KEY_BLOCK_SIZE
MySQL的> CREATE TABLESPACE `ts2` ADD DATAFILE 'ts2.ibd' FILE_BLOCK_SIZE = 8192 Engine=InnoDB;
MySQL的> CREATE TABLE t4 (c1 INT PRIMARY KEY) TABLESPACE ts2 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
FILE_BLOCK_SIZE
innodb_page_size
innodb_page_size
REDUNDANT
ALTER TABLE
InnoDB
CREATE TABLESPACE
ALTER TABLE tbl_name TABLESPACE [=]tablespace_name
innodb_system
ALTER TABLE tbl_name ... TABLESPACE [=] innodb_system
innodb_file_per_table
ALTER TABLE tbl_name ... TABLESPACE [=] innodb_file_per_table
ALTER TABLE ... TABLESPACE
ALTER TABLE ... TABLESPACE
DATA DIRECTORY
CREATE TABLE ... TABLESPACE=innodb_file_per_table
TABLESPACE
TABLESPACE
mysql>CREATE TABLESPACE `ts1` ADD DATAFILE 'ts1.ibd' Engine=InnoDB;
mysql>CREATE TABLESPACE `ts2` ADD DATAFILE 'ts2.ibd' Engine=InnoDB;
mysql>CREATE TABLE t1 (a INT, b INT) ENGINE = InnoDB
PARTITION BY RANGE(a) SUBPARTITION BY KEY(b) (
PARTITION p1 VALUES LESS THAN (100) TABLESPACE=`ts1`,
PARTITION p2 VALUES LESS THAN (1000) TABLESPACE=`ts2`,
PARTITION p3 VALUES LESS THAN (10000) TABLESPACE `innodb_file_per_table`,
PARTITION p4 VALUES LESS THAN (100000) TABLESPACE `innodb_system`);
mysql>CREATE TABLE t2 (a INT, b INT) ENGINE = InnoDB
PARTITION BY RANGE(a) SUBPARTITION BY KEY(b) (
PARTITION p1 VALUES LESS THAN (100) TABLESPACE=`ts1`
(SUBPARTITION sp1,
SUBPARTITION sp2),
PARTITION p2 VALUES LESS THAN (1000)
(SUBPARTITION sp3,
SUBPARTITION sp4 TABLESPACE=`ts2`),
PARTITION p3 VALUES LESS THAN (10000)
(SUBPARTITION sp5 TABLESPACE `innodb_system`,
SUBPARTITION sp6 TABLESPACE `innodb_file_per_table`));
TABLESPACE
ALTER TABLE
MySQL的> ALTER TABLE t1 ADD PARTITION (PARTITION p5 VALUES LESS THAN (1000000) TABLESPACE = `ts1`);
TABLESPACE =
tablespace_name
ALTER TABLE ...
ADD PARTITION
CREATE TABLE
ALTER TABLE
ALTER TABLE
tbl_name
TABLESPACE [=]
tablespace_name
ALTER TABLE
ALGORITHM=COPY
TABLESPACE [=]
tablespace_name
INFORMATION_SCHEMA.INNODB_TABLES
MySQL的> SELECT NAME, SPACE, SPACE_TYPE FROM INFORMATION_SCHEMA.INNODB_TABLES
WHERE NAME LIKE '%t1%';
----------------------- ------- ------------ |名字|空间| space_type | ----------------------- ------- ------------ |测试/ T1 # P # P1 # SP # p1sp0 | 57 |一般| |测试/ T1 # P # P2 # SP # p2sp0 | 58 |一般| |测试/ T1 # P # P3 # SP # p3sp0 | 59 |单| |测试/ T1 # P # P4 # SP # p4sp0 | 0 |系统| |测试/ T1 # P # P5 # SP # p5sp0 | 57 |一般| ----------------------- ------- ------------ MySQL > SELECT NAME, SPACE, SPACE_TYPE FROM INFORMATION_SCHEMA.INNODB_TABLES
WHERE NAME LIKE '%t2%';
--------------------- ------- ------------ |名字|空间| space_type | --------------------- ------- ------------ |测试/ T2 # P # P1 # SP # SP1 | 57 |一般| |测试/ T2 # P # P1 # SP # SP2 | 57 |一般| |测试/ T2 # P # P2 # SP # SP3 | 60 |单| |测试/ T2 # P # P2 # SP # SP4 | 58 |一般| |测试/ T2 # P # P3 # SP # SP5 | 0 |系统| |测试/ T2 # P # P3 # SP # SP6 | 61 |单| --------------------- ------- ------------
ALTER TABLE
tbl_name
REORGANIZE
PARTITION
INFORMATION_SCHEMA.INNODB_TABLES
INFORMATION_SCHEMA.INNODB_TABLESPACES
TABLESPACE =
tablespace_name
InnoDB
t1
ts1
ALTER TABLE t1
REORGANIZE PARTITION
ALTER TABLE
ALGORITHM=COPY
TABLESPACE [=]
tablespace_name
MySQL的> CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd';
MySQL的> CREATE TABLESPACE ts2 ADD DATAFILE 'ts2.ibd';
MySQL的> CREATE TABLE t1 ( a INT NOT NULL, PRIMARY KEY (a))
ENGINE=InnoDB TABLESPACE ts1
PARTITION BY RANGE (a) PARTITIONS 3 (
PARTITION P1 VALUES LESS THAN (2),
PARTITION P2 VALUES LESS THAN (4) TABLESPACE `innodb_file_per_table`,
PARTITION P3 VALUES LESS THAN (6) TABLESPACE `innodb_system`);
MySQL的> SELECT A.NAME as partition_name, A.SPACE_TYPE as space_type, B.NAME as space_name
FROM INFORMATION_SCHEMA.INNODB_TABLES A
LEFT JOIN INFORMATION_SCHEMA.INNODB_TABLESPACES B
ON A.SPACE = B.SPACE WHERE A.NAME LIKE '%t1%' ORDER BY A.NAME;
|分区---------------- ----------------- Enbrel -------——_ name |太空_型|太空_ name | ----------------- Enbrel ------- |;T1——试验/ # P # P1 |将军| TS1 | |测试/ # P2 P T1 # |单|测试/ # # P2 P T1 T1 | |测试/ # P3 P # |系统|空| MySQL ----------------- Enbrel -------——>; ALTER TABLE t1 REORGANIZE PARTITION P1
INTO (PARTITION P1 VALUES LESS THAN (2) TABLESPACE = `ts2`);
MySQL的> ALTER TABLE t1 REORGANIZE PARTITION P2
INTO (PARTITION P2 VALUES LESS THAN (4) TABLESPACE = `ts2`);
MySQL的> ALTER TABLE t1 REORGANIZE PARTITION P3
INTO (PARTITION P3 VALUES LESS THAN (6));
MySQL的> SELECT A.NAME AS partition_name, A.SPACE_TYPE AS space_type, B.NAME AS space_name
FROM INFORMATION_SCHEMA.INNODB_TABLES A
LEFT JOIN INFORMATION_SCHEMA.INNODB_TABLESPACES B
ON A.SPACE = B.SPACE WHERE A.NAME LIKE '%t1%' ORDER BY A.NAME;
|分区---------------- ----------------- Enbrel ------- ----------------- Enbrel ------- _ name |太空_型|太空_ name | ---------------- ----------------- Enbrel ------- ----------------- Enbrel ------- |测试/ P T1 # # P1 |将军| ts2 | |测试/ # P2 P T1 # |将军| ts2 | |测试/ P T1 # # P3 |将军| TS1 | ---------------- ----------------- Enbrel ------- ----------------- Enbrel -------
ALTER
TABLESPACE ... RENAME TO
修改表空间重命名S2 S1;
CREATE TABLESPACE
RENAME TO
autocommit
autocommit
RENAME TO
LOCK TABLES
FLUSH TABLES WITH READ
LOCK
DROP TABLESPACE
DROP TABLESPACE
DROP
TABLESPACE
InnoDB
DROP TABLESPACE
tablespace_name
DROP DATABASE
DROP
DATABASE
DROP
TABLESPACE
tablespace_name
InnoDB
DROP TABLE
InnoDB
mysql>CREATE TABLESPACE `ts1` ADD DATAFILE 'ts1.ibd' Engine=InnoDB;
mysql>CREATE TABLE t1 (c1 INT PRIMARY KEY) TABLESPACE ts10 Engine=InnoDB;
mysql>DROP TABLE t1;
mysql>DROP TABLESPACE ts1;
tablespace_name
InnoDB
ALTER
TABLE
ALTER TABLE
ALTER TABLE ...
DISCARD TABLESPACE
ALTER TABLE
...IMPORT TABLESPACE
InnoDB
InnoDB
keyring_file
keyring_encrypted_file
keyring_okv
keyring_aws
keyring_file
early-plugin-load
early-plugin-load
InnoDB
SHOW PLUGINS
INFORMATION_SCHEMA.PLUGINS
MySQL的> SELECT PLUGIN_NAME, PLUGIN_STATUS
FROM INFORMATION_SCHEMA.PLUGINS
WHERE PLUGIN_NAME LIKE 'keyring%';
-------------- --------------- | plugin_name | plugin_status | -------------- --------------- | keyring_file |主动| -------------- ---------------
innodb_file_per_table
TABLESPACE='innodb_file_per_table'
InnoDB
keyring_file
keyring_file
keyring_file_data
keyring_encrypted_file_data
keyring_aws
InnoDB
CREATE TABLE
MySQL的> CREATE TABLE t1 (c1 INT) ENCRYPTION='Y';
InnoDB
ALTER TABLE
MySQL的> ALTER TABLE t1 ENCRYPTION='Y';
InnoDB
ENCRYPTION='N'
ALTER TABLE
MySQL的> ALTER TABLE t1 ENCRYPTION='N';
ENCRYPTION
ALTER TABLE ...
ENCRYPTION
ALGORITHM=COPY
ALGORITHM=INPLACE
innodb_redo_log_encrypt
innodb_redo_log_encrypt
innodb_redo_log_encrypt
ib_logfile0
InnoDB
innodb_undo_log_encrypt
innodb_undo_log_encrypt
innodb_undo_log_encrypt
undo
N
.ibdN
InnoDB
ENCRYPTION_KEY_ADMIN
SUPER
mysql> ALTER INSTANCE ROTATE INNODB MASTER KEY;
ALTER INSTANCE
ROTATE INNODB MASTER KEY
CREATE TABLE ...
ENCRYPTED
ALTER TABLE ...
ENCRYPTED
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
tablespace_name
.cfptablespace_name
.cfp
ALTER
INSTANCE ROTATE INNODB MASTER KEY
ALTER
INSTANCE ROTATE INNODB MASTER KEY
ALTER
INSTANCE ROTATE INNODB MASTER KEY
ALTER
INSTANCE ROTATE INNODB MASTER KEY
keyring_file
ALTER
INSTANCE ROTATE INNODB MASTER KEY
ALTER
INSTANCE ROTATE INNODB MASTER KEY
ENCRYPTION
CREATE TABLE
ALTER TABLE
INFORMATION_SCHEMA.TABLES
MySQL的> SELECT TABLE_SCHEMA, TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES
WHERE CREATE_OPTIONS LIKE '%ENCRYPTION="Y"%';
+--------------+------------+----------------+| TABLE_SCHEMA | TABLE_NAME | CREATE_OPTIONS |+--------------+------------+----------------+| test | t1 | ENCRYPTION="Y" |+--------------+------------+----------------+
ALTER TABLE
tbl_name
ENCRYPTIONALGORITHM=COPY
COMPRESSION
ENCRYPTION
keyring_file_data
keyring_encrypted_file_data
ALTER
INSTANCE ROTATE INNODB MASTER KEY
keyring_file
keyring_file_data
keyring_encrypted_file_data
InnoDB
ENCRYPTION
ALGORITHM=COPY
ALGORITHM=INPLACE
innodb_redo_log_encrypt
innodb_undo_log_encrypt
InnoDB
InnoDB
InnoDB
CREATE TABLE
CREATE TABLE t1 (a INT, b CHAR (20), PRIMARY KEY (a)) ENGINE=InnoDB;
ENGINE=InnoDB
mysql> SELECT @@default_storage_engine;
+--------------------------+
| @@default_storage_engine |
+--------------------------+
| InnoDB |
+--------------------------+
ENGINE=InnoDB
CREATE TABLE
InnoDB
innodb_file_per_table
innodb_file_per_table
InnoDB
CREATE TABLE ...
TABLESPACE
InnoDB
InnoDB
test
t1
InnoDB
innodb_default_row_format
Dynamic
InnoDB
innodb_file_per_table
SET GLOBAL innodb_file_per_table=1;CREATE TABLE t3 (a INT, b CHAR (20), PRIMARY KEY (a)) ROW_FORMAT=DYNAMIC;CREATE TABLE t4 (a INT, b CHAR (20), PRIMARY KEY (a)) ROW_FORMAT=COMPRESSED;
CREATE TABLE ...
TABLESPACE
CREATE TABLE t1 (c1 INT PRIMARY KEY) TABLESPACE ts1 ROW_FORMAT=DYNAMIC;
CREATE TABLE ...
TABLESPACE
Dynamic
Redundant
CREATE TABLE t1 (c1 INT PRIMARY KEY) TABLESPACE = innodb_system ROW_FORMAT=DYNAMIC;
InnoDB
InnoDB
InnoDB
(firstname,
lastname)
# The value of ID can act like a pointer between related items in different tables. CREATE TABLE t5 (id INT AUTO_INCREMENT, b CHAR (20), PRIMARY KEY (id)); # The primary key can consist of more than one column. Any autoinc column must come first. CREATE TABLE t6 (id INT AUTO_INCREMENT, a INT, b CHAR (20), PRIMARY KEY (id,a));
CREATE
TABLE
ALTER TABLE
InnoDB
SHOW TABLE STATUS
MySQL的> SHOW TABLE STATUS FROM test LIKE 't%' \G;
*************************** 1。行***************************名称:T1发动机:InnoDB版本:十row_format:紧凑的行数:0:0 avg_row_length data_length:16384max_data_length:0:0 0 index_length data_free:auto_increment:空create_time:2015-03-16 15:13:31 update_time:空check_time:空整理:utf8mb4_0900_ai_ci校验:空create_options:评论:
SHOW TABLE
STATUS
InnoDB
mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLES WHERE NAME='test/t1' \G
*************************** 1. row ***************************
TABLE_ID: 45
NAME: test/t1
FLAG: 1
N_COLS: 5
SPACE: 35
ROW_FORMAT: Compact
ZIP_PAGE_SIZE: 0
SPACE_TYPE: Single
InnoDB
innodb_default_row_format
InnoDB
InnoDB
InnoDB
SHOW TABLE
STATUS
MySQL的> SHOW TABLE STATUS IN test1\G
*************************** 1。行***************************名称:T1发动机:InnoDB版本:10 row_format:动态的行:0 avg_row_length:0 data_length:16384max_data_length:0 index_length:16384:0:1 data_free auto_increment create_time:2016-09-14 16:29:38 update_time:空check_time:空整理:utf8mb4_0900_ai_ci校验:空create_options:评论:
InnoDB
INFORMATION_SCHEMA.INNODB_TABLES
MySQL的> SELECT NAME, ROW_FORMAT FROM INFORMATION_SCHEMA.INNODB_TABLES WHERE NAME='test1/t1';
---------- ------------ |名字| row_format | ---------- ------------ | test1/T1 |动态| ---------- ------------
REDUNDANT
InnoDB
InnoDB
utf8mb4
NULL
NULL
NULL
COMPACT
COMPACT
InnoDB
NULL
N
N
NULL
NULL
NULL
InnoDB
CHAR(10)
InnoDB
VARCHAR
utf8mb3
InnoDB
CHAR(
N
)N
CHAR(
N
)N
CHAR(
N
)N
InnoDB
N
CHAR(
N
)N
ROW_FORMAT=REDUNDANT
CHAR(
N
)N
InnoDB
utf8mb4
ROW_FORMAT=DYNAMIC
ROW_FORMAT=COMPRESSED
CHAR
ROW_FORMAT=COMPACT
InnoDB
InnoDB
my.cnf
[mysqld] lower_case_table_names=1
lower_case_table_names
InnoDB
FLUSH
TABLES ... FOR EXPORT
InnoDB
innodb_file_per_table
InnoDB
InnoDB
InnoDB
FLOAT
DOUBLE
.ibd
.ibd
RENAME
TABLE
重命名表 db1.tbl_name
以 db2.tbl_name
;
.ibd
.ibd
ALTER TABLE
ALTER TABLE tbl_name
DISCARD TABLESPACE;
.ibd
ALTER TABLE
.ibd
修改表 tbl_name
导入表;
ALTER TABLE
... IMPORT TABLESPACE
.ibd
.ibd
.ibd
.ibd
.ibd
.ibd
SHOW
ENGINE INNODB STATUS
Waiting for server
activity
.ibd
InnoDB
.ibd
MyISAM
InnoDB
MyISAM
MyISAM
key_buffer_size
innodb_buffer_pool_size
InnoDB
MyISAM
autocommit
COMMIT
ROLLBACK
COMMIT
ROLLBACK
ROLLBACK
INSERT
UPDATE
DELETE
COMMIT
INSERT
COMMIT
TRUNCATE
TABLE
ROLLBACK
COMMIT
InnoDB
autocommit=0
INSERT
UPDATE
DELETE
ROLLBACK
autocommit=1
COMMIT
ROLLBACK
COMMIT
COMMIT
INSERT
COMMIT
INSERT
COMMIT
SELECT
COMMIT
SHOW ENGINE INNODB
STATUS
InnoDB
innodb_deadlock_detect
innodb_lock_wait_timeout
innodb_print_all_deadlocks
SHOW ENGINE INNODB
STATUS
InnoDB
MyISAM
innodb_file_per_table
innodb_page_size
ROW_FORMAT
CREATE TABLE
innodb_file_per_table
InnoDB
InnoDB
InnoDB
ALTER
TABLE
InnoDB
table_name
CREATE TABLE
ENGINE=INNODB
InnoDB
innodb_table
myisam_table
primary_key_columns
InnoDB
UNIQUE
SET unique_checks=0;... import operation ...
SET unique_checks=1;
InnoDB
unique_checks
INSERT INTO newtable SELECT * FROM oldtable WHERE yourkey >something
AND yourkey <=somethingelse
;
InnoDB
InnoDB
innodb_file_per_table
MyISAM
InnoDB
ALTER TABLE
PRIMARY KEY
PRIMARY KEY
PRIMARY KEY
CREATE TABLE
ALTER TABLE
VARCHAR
UNIQUE NOT NULL
PRIMARY KEY
InnoDB
INT
InnoDB
AUTO_INCREMENT
AUTO_INCREMENT
ai_col
AUTO_INCREMENT
InnoDB
AUTO_INCREMENT
innodb_autoinc_lock_mode
innodb_autoinc_lock_mode
INSERT
INSERT
INSERT ...
SELECT
REPLACE
REPLACE ...
SELECT
LOAD
DATA
INSERT
REPLACE
INSERT
... ON DUPLICATE KEY UPDATE
INSERT ...
SELECT
REPLACE ...
SELECT
LOAD
DATA
InnoDB
c1
t1
插入T1(C1,C2)values(1,a),(a ' a),(Null,b),(5 ' c),(Null,d ');
INSERT
... ON DUPLICATE KEY UPDATE
INSERT
UPDATE
innodb_autoinc_lock_mode
innodb_autoinc_lock_mode=2
innodb_autoinc_lock_mode=1
innodb_autoinc_lock_mode = 0
innodb_autoinc_lock_mode
AUTO-INC
INSERT
INSERT
INSERT
INSERT
CREATE TABLE t1 ( c1 INT(11) NOT NULL AUTO_INCREMENT, c2 VARCHAR(10) DEFAULT NULL, PRIMARY KEY (c1) ) ENGINE=InnoDB;
AUTO_INCREMENT
INSERT ...
SELECT
INSERT
TX1:插入T1(C2)选择1000行与另一个表中插入…2:T1(C2)值('xxx”);
InnoDB
SELECT
INSERT
INSERT
INSERT ...
SELECT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
InnoDB
AUTO-INC
innodb_autoinc_lock_mode = 1
AUTO-INC
INSERT ...
SELECT
REPLACE ...
SELECT
LOAD
DATA
AUTO-INC
AUTO-INC
AUTO-INC
AUTO-INC
AUTO-INC
INSERT
INSERT
AUTO_INCREMENT
InnoDB
innodb_autoinc_lock_mode = 2
INSERT
INSERT
innodb_autoinc_lock_mode
innodb_autoinc_lock_mode
= 2 (
INSERT
AUTO_INCREMENT
AUTO_INCREMENT
INSERT
AUTO_INCREMENT
AUTO_INCREMENT
AUTO_INCREMENT
innodb_autoinc_lock_mode
AUTO-INC
innodb_autoinc_lock_mode
INSERT
c1
t1
MySQL的> CREATE TABLE t1 (
-> c1 INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
-> c2 CHAR(1)
-> ) ENGINE = INNODB;
mysql> INSERT INTO t1 (c1,c2) VALUES (1,'a'), (NULL,'b'), (5,'c'), (NULL,'d');
innodb_autoinc_lock_mode
mysql> SELECT c1, c2 FROM t1 ORDER BY c2;
+-----+------+
| c1 | c2 |
+-----+------+
| 1 | a |
| 101 | b |
| 5 | c |
| 102 | d |
+-----+------+
INSERT
innodb_autoinc_lock_mode
mysql> SELECT c1, c2 FROM t1 ORDER BY c2;
+-----+------+
| c1 | c2 |
+-----+------+
| 1 | a |
| 101 | b |
| 5 | c |
| 102 | d |
+-----+------+
INSERT
innodb_autoinc_lock_mode
mysql>SELECT c1, c2 FROM t1 ORDER BY c2;
+-----+------+ | c1 | c2 | +-----+------+ | 1 | a | |x
| b | | 5 | c | |y
| d | +-----+------+
x
y
x
y
mysql> INSERT INTO t1 (c1,c2) VALUES (1,'a'), (NULL,'b'), (101,'c'), (NULL,'d');
innodb_autoinc_lock_mode
(NULL, 'b')
AUTO_INCREMENT
INSERT
AUTO_INCREMENT
INSERT
UPDATE
INSERT
AUTO_INCREMENT
INSERT
MySQL的> CREATE TABLE t1 (
-> c1 INT NOT NULL AUTO_INCREMENT,
-> PRIMARY KEY (c1)
-> ) ENGINE = InnoDB;
MySQL的> INSERT INTO t1 VALUES(0), (0), (3);
MySQL的> SELECT c1 FROM t1;
噢,| C1 | - | | | 1 2 3 | | | - MySQL > UPDATE t1 SET c1 = 4 WHERE c1 = 1;
MySQL的> SELECT c1 FROM t1;
噢,| C1 | - | | | 2 3 4 | | | - MySQL > INSERT INTO t1 VALUES(0);
MySQL的> SELECT c1 FROM t1;
- | C1 | - | | | 2 3 4 5 | | | | | -
InnoDB
AUTO_INCREMENT
InnoDB
SELECT MAX(ai_col) FROM table_name
FOR UPDATE;
InnoDB
InnoDB
INSERT
UPDATE
InnoDB
table_name
.cfg
AUTO_INCREMENT = N
ALTER TABLE
AUTO_INCREMENT = N
ALTER TABLE ...
AUTO_INCREMENT = N
ROLLBACK
SHOW TABLE STATUS
InnoDB
InnoDB
InnoDB
auto_increment_offset
auto_increment_increment
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
SET DEFAULT
CREATE
TABLE
ALTER
TABLE
InnoDB
InnoDB
InnoDB
ON UPDATE CASCADE
RESTRICT
ON UPDATE SET NULL
ON DELETE CASCADE
InnoDB
FOREIGN
KEY
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
COMPRESSED
InnoDB
COMPACT
TEXT
utf8mb4
InnoDB
innodb_page_size
ERROR 1070 (42000): Too many key parts specified; max 16 parts allowed
VARBINARY
VARCHAR
BLOB
TEXT
innodb_page_size
LONGBLOB
LONGTEXT
BLOB
TEXT
InnoDB
MySQL的> CREATE TABLE t (a VARCHAR(8000), b VARCHAR(10000),
-> c VARCHAR(10000), d VARCHAR(10000), e VARCHAR(10000),
-> f VARCHAR(10000), g VARCHAR(10000)) ENGINE=InnoDB;
(4):错误1118排尺寸太大。对于二手台式的行大小的最大值,不可计数的斑点,是65536。你必须改变带来的一些列的文本或斑点
InnoDB
InnoDB
InnoDB
InnoDB
innodb_page_size
ROW_FORMAT=COMPRESSED
innodb_page_size=32k
innodb_page_size=64k
InnoDB
ANALYZE TABLE
SHOW INDEX
ANALYZE
TABLE
ANALYZE TABLE
ANALYZE TABLE
innodb_stats_persistent
ANALYZE TABLE
innodb_stats_persistent_sample_pages
innodb_stats_transient_sample_pages
ANALYZE TABLE
ANALYZE
TABLE
max_seeks_for_key
ANALYZE TABLE
ANALYZE TABLE
ANALYZE TABLE
ANALYZE TABLE
ANALYZE TABLE
ANALYZE TABLE
SHOW TABLE STATUS
InnoDB
SELECT COUNT(*)
InnoDB
COUNT()
InnoDB
AUTO_INCREMENT
ai_col
ai_col
InnoDB
AUTO_INCREMENT
innodb_autoinc_lock_mode=0
AUTO-INC
innodb_autoinc_lock_mode=1
innodb_autoinc_lock_mode=2
AUTO_INCREMENT
DELETE FROM
tbl_name
InnoDB
DB_TRX_ID
DB_MIX_ID
MySQL的> CREATE TABLE t1 (c1 INT, db_row_id INT) ENGINE=INNODB;
结论:正确错误(4)列名“db_row_id”
LOCK TABLES
innodb_table_locks=1
InnoDB
innodb_table_locks=0
LOCK TABLES
innodb_table_locks=0
LOCK TABLES
... WRITE
LOCK TABLES
... WRITE
LOCK TABLES
... READ
InnoDB
LOCK TABLES
autocommit=1
LOCK
TABLES
COMMIT
UNLOCK
TABLES
InnoDB
InnoDB
InnoDB
PRIMARY KEY
PRIMARY KEY
NOT NULL
PRIMARY KEY
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
innodb_fill_factor
innodb_fill_factor
InnoDB
InnoDB
InnoDB
innodb_page_size
32k
8k
InnoDB
InnoDB
innodb_fill_factor
innodb_fill_factor
TEXT
BLOB
innodb_fill_factor
FULLTEXT
CHAR
VARCHAR
TEXT
FULLTEXT
CREATE TABLE
ALTER
TABLE
CREATE INDEX
MATCH()
... AGAINST
InnoDB
InnoDB
mysql>CREATE TABLE opening_lines (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
opening_line TEXT(500),
author VARCHAR(200),
title VARCHAR(200),
FULLTEXT idx (opening_line)
) ENGINE=InnoDB;
mysql>SELECT table_id, name, space from INFORMATION_SCHEMA.INNODB_TABLES
WHERE name LIKE 'test/%';
+----------+----------------------------------------------------+-------+ | table_id | name | space | +----------+----------------------------------------------------+-------+ | 333 | test/fts_0000000000000147_00000000000001c9_index_1 | 289 | | 334 | test/fts_0000000000000147_00000000000001c9_index_2 | 290 | | 335 | test/fts_0000000000000147_00000000000001c9_index_3 | 291 | | 336 | test/fts_0000000000000147_00000000000001c9_index_4 | 292 | | 337 | test/fts_0000000000000147_00000000000001c9_index_5 | 293 | | 338 | test/fts_0000000000000147_00000000000001c9_index_6 | 294 | | 330 | test/fts_0000000000000147_being_deleted | 286 | | 331 | test/fts_0000000000000147_being_deleted_cache | 287 | | 332 | test/fts_0000000000000147_config | 288 | | 328 | test/fts_0000000000000147_deleted | 284 | | 329 | test/fts_0000000000000147_deleted_cache | 285 | | 327 | test/opening_lines | 283 | +----------+----------------------------------------------------+-------+
DOC_ID
innodb_ft_sort_pll_degree
fts_
table_id
test/opening_lines
test/opening_lines
index_id
test/fts_0000000000000147_00000000000001c9_index_1
opening_lines
INFORMATION_SCHEMA.INNODB_INDEXES
MySQL的> SELECT index_id, name, table_id, space from INFORMATION_SCHEMA.INNODB_INDEXES
WHERE index_id=457;
我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,我的意思是,
FULLTEXT
FTS_DOC_ID
FTS_DOC_ID
fts_*_deleted
fts_*_deleted_cache
fts_*_being_deleted
fts_*_being_deleted_cache
fts_*_config
FULLTEXT
FTS_SYNCED_DOC_ID
INFORMATION_SCHEMA.INNODB_FT_CONFIG
FULLTEXT
FULLTEXT
INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE
innodb_ft_cache_size
innodb_ft_total_cache_size
InnoDB
FTS_DOC_ID
InnoDB
FTS_DOC_ID
MySQL的> CREATE TABLE opening_lines (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
opening_line TEXT(500),
author VARCHAR(200),
title VARCHAR(200)
) ENGINE=InnoDB;
CREATE FULLTEXT INDEX
FTS_DOC_ID
MySQL的> CREATE FULLTEXT INDEX idx ON opening_lines(opening_line);
查询好,0行受影响,警告(0.19秒)记录:0 0副本:警告:1mysql > SHOW WARNINGS;
--------- ------ -------------------------------------------------- |水平|代码|消息| --------- ------ -------------------------------------------------- |警告| 124 | InnoDB表添加列fts_doc_id重建| --------- ------ --------------------------------------------------
ALTER TABLE
CREATE TABLE
InnoDB
FTS_DOC_ID
CREATE TABLE
CREATE FULLTEXT
INDEX
InnoDB
FTS_DOC_ID
FTS_DOC_ID
BIGINT UNSIGNED NOT NULL
FTS_DOC_ID
AUTO_INCREMENT
MySQL的> CREATE TABLE opening_lines (
FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
opening_line TEXT(500),
author VARCHAR(200),
title VARCHAR(200)
) ENGINE=InnoDB;
FTS_DOC_ID
FTS_DOC_ID
FTS_DOC_ID_INDEX
mysql> CREATE UNIQUE INDEX FTS_DOC_ID_INDEX on opening_lines(FTS_DOC_ID);
FTS_DOC_ID_INDEX
FTS_DOC_ID_INDEX
FTS_DOC_ID
FTS_DOC_ID
DOC_ID
FTS_*_DELETED
innodb_optimize_fulltext_only=ON
InnoDB
FULLTEXT
FULLTEXT
MySQL的> CREATE TABLE opening_lines (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
opening_line TEXT(500),
author VARCHAR(200),
title VARCHAR(200),
FULLTEXT idx (opening_line)
) ENGINE=InnoDB;
MySQL的> BEGIN;
MySQL的> INSERT INTO opening_lines(opening_line,author,title) VALUES
('Call me Ishmael.','Herman Melville','Moby-Dick'),
('A screaming comes across the sky.','Thomas Pynchon','Gravity\'s Rainbow'),
('I am an invisible man.','Ralph Ellison','Invisible Man'),
('Where now? Who now? When now?','Samuel Beckett','The Unnamable'),
('It was love at first sight.','Joseph Heller','Catch-22'),
('All this happened, more or less.','Kurt Vonnegut','Slaughterhouse-Five'),
('Mrs. Dalloway said she would buy the flowers herself.','Virginia Woolf','Mrs. Dalloway'),
('It was a pleasure to burn.','Ray Bradbury','Fahrenheit 451');
MySQL的> SELECT COUNT(*) FROM opening_lines WHERE MATCH(opening_line) AGAINST('Ishmael');
---------- |计数(*)| ---------- | 0 | ---------- MySQL > COMMIT;
MySQL的> SELECT COUNT(*) FROM opening_lines WHERE MATCH(opening_line) AGAINST('Ishmael');
---------- |计数(*)| ---------- | 1 | ----------
InnoDB
INFORMATION_SCHEMA
FULLTEXT
INNODB_INDEXES
INNODB_TABLES
InnoDB
InnoDB
InnoDB
ROW_FORMAT=COMPRESSED
CREATE TABLE
ALTER TABLE
InnoDB
ROW_FORMAT=COMPRESSED
innodb_page_size
CREATE TABLE
ALTER TABLE
KEY_BLOCK_SIZE
KEY_BLOCK_SIZE
CREATE TABLE
ALTER TABLE
KEY_BLOCK_SIZE
innodb_file_per_table
my.ini
SET
innodb_file_per_table
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE
CREATE TABLE
ALTER TABLE
SET GLOBAL innodb_file_per_table=1; CREATE TABLE t1 (c1 INT PRIMARY KEY) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
FILE_BLOCK_SIZE
innodb_page_size
CREATE TABLE
ALTER TABLE
FILE_BLOCK_SIZE/1024
innodb_page_size=16384
FILE_BLOCK_SIZE=8192
KEY_BLOCK_SIZE
innodb_page_size
KEY_BLOCK_SIZE
MySQL的> CREATE TABLESPACE `ts2` ADD DATAFILE 'ts2.ibd' FILE_BLOCK_SIZE = 8192 Engine=InnoDB;
MySQL的> CREATE TABLE t4 (c1 INT PRIMARY KEY) TABLESPACE ts2 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
InnoDB
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE
innodb_page_size
KEY_BLOCK_SIZE
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE,
.ibd
KEY_BLOCK_SIZE
KEY_BLOCK_SIZE
innodb_page_size
innodb_page_size
innodb_page_size
innodb_strict_mode=ON
KEY_BLOCK_SIZE
FILE_BLOCK_SIZE
InnoDB
innodb_page_size
InnoDB
.ibd
KEY_BLOCK_SIZE
KEY_BLOCK_SIZE=16
BLOB
VARCHAR
TEXT
KEY_BLOCK_SIZE
CREATE TABLE
ROW_FORMAT
CREATE INDEX
SHOW CREATE
TABLE
InnoDB
ROW_FORMAT
InnoDB
innodb_strict_mode
CREATE
TEMPORARY TABLE
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE
innodb_strict_mode
ALTER
TABLE
CHAR
TEXT
gzip
.ibd
USE test;SET GLOBAL innodb_file_per_table=1;SET GLOBAL autocommit=0;-- Create an uncompressed table with a million or two rows.CREATE TABLE big_table AS SELECT * FROM information_schema.columns;INSERT INTO big_table SELECT * FROM big_table;INSERT INTO big_table SELECT * FROM big_table;INSERT INTO big_table SELECT * FROM big_table;INSERT INTO big_table SELECT * FROM big_table;INSERT INTO big_table SELECT * FROM big_table;INSERT INTO big_table SELECT * FROM big_table;INSERT INTO big_table SELECT * FROM big_table;INSERT INTO big_table SELECT * FROM big_table;INSERT INTO big_table SELECT * FROM big_table;INSERT INTO big_table SELECT * FROM big_table;COMMIT;ALTER TABLE big_table ADD id int unsigned NOT NULL PRIMARY KEY auto_increment;SHOW CREATE TABLE big_table\Gselect count(id) from big_table;-- Check how much space is needed for the uncompressed table.\! ls -l data/test/big_table.ibdCREATE TABLE key_block_size_4 LIKE big_table;ALTER TABLE key_block_size_4 key_block_size=4 row_format=compressed;INSERT INTO key_block_size_4 SELECT * FROM big_table;commit;-- Check how much space is needed for a compressed table-- with particular compression settings.\! ls -l data/test/key_block_size_4.ibd
-rw-rw---- 1 cirrus staff 310378496 Jan 9 13:44 data/test/big_table.ibd -rw-rw---- 1 cirrus staff 83886080 Jan 9 15:10 data/test/key_block_size_4.ibd
INFORMATION_SCHEMA.INNODB_CMP
INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX
innodb_cmp_per_index_enabled
INFORMATION_SCHEMA.INNODB_CMP
INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX
COMPRESS_OPS_OK
innodb_compression_level
innodb_compression_failure_threshold_pct
innodb_compression_pad_pct_max
LIKE
BLOB
INSERT
DELETE
KEY_BLOCK_SIZE=8
INNODB_CMP
INNODB_CMP_PER_INDEX
INNODB_CMP_PER_INDEX
innodb_cmp_per_index_enabled
INNODB_CMP_PER_INDEX
INNODB_CMP
INNODB_CMP_PER_INDEX
INSERT
DELETE
COMPRESS_OPS_OK
KEY_BLOCK_SIZE
InnoDB
.idb
innodb_compression_level
VARCHAR
TEXT
innodb_compression_failure_threshold_pct
innodb_compression_pad_pct_max
innodb_strict_mode
CREATE TABLE
CREATE INDEX
innodb_strict_mode
UPDATE
ALTER TABLE
ROW_FORMAT=DYNAMIC
ROW_FORMAT=COMPACT
innodb_strict_mode
innodb_strict_mode
BLOB
VARCHAR
TEXT
ROW_FORMAT=DYNAMIC
ROW_FORMAT=COMPRESSED
BLOB
TEXT
VARCHAR
ROW_FORMAT=REDUNDANT
ROW_FORMAT=COMPACT
BLOB
VARCHAR
TEXT
COMPRESSED
BLOB
VARCHAR
BLOB
VARCHAR
TEXT
InnoDB
innodb_page_size
InnoDB
zlib
innodb_file_per_table
innodb_file_per_table
InnoDB
OLTP
INSERT
UPDATE
DELETE
innodb_compression_level
innodb_compression_failure_threshold_pct
innodb_compression_pad_pct_max
innodb_compression_pad_pct_max
innodb_log_compressed_pages
zlib
innodb_log_compressed_pages
innodb_buffer_pool_size
innodb_strict_mode
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE
CREATE
TABLE
ALTER TABLE
innodb_file_per_table
错误1031(hy000):“T1”不表的存储引擎有这个选项
innodb_strict_mode
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE
CREATE
TABLE
ALTER TABLE
innodb_file_per_table
MySQL的> SHOW WARNINGS;
+---------+------+---------------------------------------------------------------+| Level | Code | Message |+---------+------+---------------------------------------------------------------+| Warning | 1478 | InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. || Warning | 1478 | InnoDB: ignoring KEY_BLOCK_SIZE=4. || Warning | 1478 | InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table. || Warning | 1478 | InnoDB: assuming ROW_FORMAT=DYNAMIC. |+---------+------+---------------------------------------------------------------+
mysqldump
ROW_FORMAT=DYNAMIC
innodb_file_per_table
KEY_BLOCK_SIZE
COMPRESSED
ROW_FORMAT
KEY_BLOCK_SIZE
InnoDB: ignoring KEY_BLOCK_SIZE= |
innodb_strict_mode
ROW_FORMAT
ROW_FORMAT
CREATE TABLE
ALTER TABLE
ROW_FORMAT=?REDUNDANT | ROW_FORMAT=COMPACT | |
ROW_FORMAT=?COMPACT | ||
ROW_FORMAT=?DYNAMIC | ||
ROW_FORMAT=?COMPRESSED | ||
KEY_BLOCK_?SIZE= | ROW_FORMAT=COMPRESSED
InnoDB |
CREATE TABLE
ALTER TABLE
innodb_strict_mode
innodb_strict_mode
SHOW ERRORS
MySQL的> CREATE TABLE x (id INT PRIMARY KEY, c INT)
-> ENGINE=INNODB KEY_BLOCK_SIZE=33333;
错误1005(hy000):无法创建表测试。X”(错误:1478)MySQL > SHOW ERRORS;
+-------+------+-------------------------------------------+| Level | Code | Message |+-------+------+-------------------------------------------+| Error | 1478 | InnoDB: invalid KEY_BLOCK_SIZE=33333. || Error | 1005 | Can't create table 'test.x' (errno: 1478) |+-------+------+-------------------------------------------+
ROW_FORMAT
| ||
---|---|---|
ROW_FORMAT=REDUNDANT | REDUNDANT | |
ROW_FORMAT=COMPACT | COMPACT | |
ROW_FORMAT=COMPRESSED ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE | innodb_file_per_table | the default row format for file-per-table tablespaces; the
specified row format for general tablespaces |
KEY_BLOCK_SIZE | KEY_BLOCK_SIZE | |
ROW_FORMAT=COMPRESSED
| KEY_BLOCK_SIZE | COMPRESSED |
KEY_BLOCK_SIZE
COMPACT
| KEY_BLOCK_SIZE | REDUNDANT
DYNAMIC |
ROW_FORMAT
COMPACT
COMPRESSED |
innodb_strict_mode
ROW_FORMAT
ON
OFF
KEY_BLOCK_SIZE
SHOW CREATE
TABLE
FILE_BLOCK_SIZE
MySQL的> CREATE TABLESPACE `ts1` ADD DATAFILE 'ts1.ibd' Engine=InnoDB;
MySQL的> CREATE TABLE t1 (c1 INT PRIMARY KEY) TABLESPACE ts1 ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=8;
错误1478(hy000):InnoDB表空间TS1:` `不能包含一个压缩的表
KEY_BLOCK_SIZE
MySQL的> CREATE TABLESPACE `ts2` ADD DATAFILE 'ts2.ibd' FILE_BLOCK_SIZE = 8192 Engine=InnoDB;
MySQL的> CREATE TABLE t2 (c1 INT PRIMARY KEY) TABLESPACE ts2 ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=4;
错误1478(hy000):InnoDB:表空间` TS2 `采用块大小为8192 cannotcontain物理页面大小4096桌
KEY_BLOCK_SIZE
FILE_BLOCK_SIZE
mysql>CREATE TABLESPACE `ts3` ADD DATAFILE 'ts3.ibd' FILE_BLOCK_SIZE = 8192 Engine=InnoDB;
mysql>CREATE TABLE t3 (c1 INT PRIMARY KEY) TABLESPACE ts3 ROW_FORMAT=COMPACT;
ERROR 1478 (HY000): InnoDB: Tablespace `ts3` uses block size 8192 and cannot contain a table with physical page size 16384
innodb_strict_mode
innodb_strict_mode
InnoDB
COMPRESSION
CREATE TABLE
ALTER TABLE
LZ4
InnoDB
innodb_page_size=16K
InnoDB
innodb_page_size
innodb_page_size
innodb_page_size
COMPRESSION
CREATE TABLE
CREATE TABLE t1 (c1 INT) COMPRESSION="zlib";
ALTER TABLE
ALTER TABLE ...
COMPRESSION
OPTIMIZE TABLE
ALTER TABLE t1 COMPRESSION="zlib";OPTIMIZE TABLE t1;
COMPRESSION=None
ALTER TABLE
COMPRESSION=None
OPTIMIZE TABLE
COMPRESSION=None
ALTER TABLE t1 COMPRESSION="None"; OPTIMIZE TABLE t1;
INFORMATION_SCHEMA.INNODB_TABLESPACES
FS_BLOCK_SIZE
FILE_SIZE
ALLOCATED_SIZE
ls -l
tablespace_name.ibd
ALLOCATED_SIZE
du --block-size=1
tablespace_name.ibd
--block-size=1
ls -l
SHOW CREATE TABLE
Lz4
INFORMATION_SCHEMA.INNODB_TABLESPACES
# Create the employees table with Zlib page compressionCREATE TABLE employees ( emp_no INT NOT NULL, birth_date DATE NOT NULL, first_name VARCHAR(14) NOT NULL, last_name VARCHAR(16) NOT NULL, gender ENUM ('M','F') NOT NULL, hire_date DATE NOT NULL, PRIMARY KEY (emp_no)) COMPRESSION="zlib";# Insert data (not shown) # Query page compression metadata in INFORMATION_SCHEMA.INNODB_TABLESPACES mysql>SELECT SPACE, NAME, FS_BLOCK_SIZE, FILE_SIZE, ALLOCATED_SIZE FROM
INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME='employees/employees'\G
*************************** 1。行***************************空间:45name:员工/ employeesfs_block_size:4096file_size:23068672allocated_size:19415040
innodb_page_size
ROW_FORMAT=COMPRESSED
ALTER TABLE ...
COMPRESSION=None
OPTIMIZE
TABLE
InnoDB
InnoDB
BLOB
InnoDB
innodb_default_row_format
ROW_FORMAT
ROW_FORMAT=DEFAULT
ROW_FORMAT
CREATE TABLE
ALTER TABLE
CREATE TABLE t1 (c1 INT) ROW_FORMAT=DYNAMIC;
ROW_FORMAT
ROW_FORMAT=DEFAULT
innodb_default_row_format
MySQL的> SET GLOBAL innodb_default_row_format=DYNAMIC;
innodb_default_row_format
COMPACT
COMPRESSED
CREATE TABLE
ALTER TABLE
innodb_default_row_format
mysql> SET GLOBAL innodb_default_row_format=COMPRESSED;
ERROR 1231 (42000): Variable 'innodb_default_row_format'
can't be set to the value of 'COMPRESSED'
innodb_default_row_format
ROW_FORMAT=DEFAULT
CREATE TABLE
innodb_default_row_format
创建表T1(C1型);
CREATE TABLE t2 (c1 INT) ROW_FORMAT=DEFAULT;
ROW_FORMAT
ROW_FORMAT=DEFAULT
innodb_default_row_format
ALTER
TABLE
ALGORITHM=COPY
ALTER
TABLE
ALGORITHM=INPLACE
OPTIMIZE TABLE
mysql>SELECT @@innodb_default_row_format;
+-----------------------------+ | @@innodb_default_row_format | +-----------------------------+ | dynamic | +-----------------------------+ mysql>CREATE TABLE t1 (c1 INT);
mysql>SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLES WHERE NAME LIKE 'test/t1' \G
*************************** 1. row *************************** TABLE_ID: 54 NAME: test/t1 FLAG: 33 N_COLS: 4 SPACE: 35 ROW_FORMAT: Dynamic ZIP_PAGE_SIZE: 0 SPACE_TYPE: Single mysql>SET GLOBAL innodb_default_row_format=COMPACT;
mysql>ALTER TABLE t1 ADD COLUMN (c2 INT);
mysql>SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLES WHERE NAME LIKE 'test/t1' \G
*************************** 1. row *************************** TABLE_ID: 55 NAME: test/t1 FLAG: 1 N_COLS: 5 SPACE: 36 ROW_FORMAT: Compact ZIP_PAGE_SIZE: 0 SPACE_TYPE: Single
REDUNDANT
DYNAMIC
REDUNDANT
DYNAMIC
innodb_default_row_format
COMPACT
创建表T1(C1主关键字,C2 varchar(5000),关键I1(C2(3070)));
innodb_default_row_format
SHOW TABLE STATUS
INFORMATION_SCHEMA.TABLES
SELECT * FROM information_schema.innodb_tables,名字像“试验/T1的G
InnoDB
ROW_FORMAT=DYNAMIC
ROW_FORMAT=COMPRESSED
InnoDB
VARCHAR
VARBINARY
BLOB
TEXT
CHAR(255)
InnoDB
TEXT
BLOB
DYNAMIC
REDUNDANT
DYNAMIC
COMPRESSED
COMPRESSED
COMPRESSED
DYNAMIC
COMPRESSED
COMPRESSED
innodb_file_per_table
innodb_file_per_table
DYNAMIC
innodb_file_per_table
ALTER
TABLE
TABLESPACE [=] innodb_system
CREATE
TABLE
innodb_file_per_table
innodb_file_per_table
TABLESPACE [=] innodb_system
DYNAMIC
InnoDB
innodb_strict_mode
CREATE TEMPORARY
TABLE
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE
innodb_strict_mode
DYNAMIC
COMPACT
CHAR
InnoDB
REDUNDANT
VARCHAR
VARBINARY
BLOB
TEXT
InnoDB
utf8mb4
COMPACT
BLOB
DYNAMIC
innodb_default_row_format
REDUNDANT
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
innodb_doublewrite=ON
InnoDB
InnoDB
innodb_flush_method
innodb_data_file_path
InnoDB
innodb_file_per_table
CREATE TABLESPACE
innodb_page_size
innodb_page_size
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
SHOW TABLE STATUS
InnoDB
InnoDB
innodb_page_size
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
SELECT COUNT(*) FROM t WHERE non_indexed_column
<> 12345;
ALTER TABLE
修改表 tbl_name
ENGINE=INNODB
ALTER TABLE
tbl_name
FORCE
ALTER TABLE
tbl_name
ENGINE=INNODBALTER TABLE
tbl_name
FORCE
InnoDB
InnoDB
innodb_file_per_table
TRUNCATE TABLE
.ibd
InnoDB
innodb_file_per_table=OFF
InnoDB
innodb_file_per_table=OFF
LOCK
ALGORITHM=INSTANT
ALGORITHM
ALTER TABLE
修改表 tbl_name
添加主键( column
), ALGORITHM=INPLACE, LOCK=NONE;
LOCK
LOCK=DEFAULT
ALGORITHM
ALTER
TABLE
ALTER TABLE
LOCK=NONE
LOCK=SHARED
ALGORITHM=INSTANT
ALGORITHM=INPLACE
ALGORITHM=COPY
old_alter_table
ALGORITHM=COPY
ALTER
TABLE
ALGORITHM=INSTANT
ALGORITHM=INPLACE
FULLTEXT | |||||
SPATIAL | |||||
CREATE INDEXname
ONtable
(col_list
);
修改表 tbl_name
添加索引 name
( col_list
);
CREATE INDEX
CREATE INDEX
ALTER TABLE
DROP INDEXname
ONtable
;
修改表 tbl_name
删除索引 name
;
DROP INDEX
ALTER TABLEtbl_name
RENAME INDEXold_index_name
TOnew_index_name
, ALGORITHM=INPLACE, LOCK=NONE;
FULLTEXT
【解释】:Create FullText Index name
在表( column
);
FULLTEXT
FULLTEXT
SPATIAL
CREATE TABLE geom (g GEOMETRY NOT NULL);ALTER TABLE geom ADD SPATIAL INDEX(g), ALGORITHM=INPLACE, LOCK=SHARED;
FULLTEXT
FULLTEXT
USING {BTREE |
HASH}
修改表 tbl_name
索引I1,添加索引I1( key_part,...
) USING BTREE, ALGORITHM=INSTANT;
ALTER TABLEtbl_name
ADD PRIMARY KEY (column
), ALGORITHM=INPLACE, LOCK=NONE;
ALGORITHM=INPLACE
ALTER TABLE ... ADD PRIMARY KEY
UNIQUE
UNIQUE
PRIMARY KEY
ALGORITHM=COPY
DATETIME
ALGORITHM=INPLACE
SQL_MODE
strict_all_tables
ALGORITHM=INPLACE
ALGORITHM=INPLACE
InnoDB
NOT NULL
CREATE TABLE
ALGORITHM=INPLACE
ALGORITHM=COPY
ALGORITHM=INPLACE
ALGORITHM=COPY
ALTER TABLE tbl_name
DROP PRIMARY KEY, ALGORITHM=COPY;
ALGORITHM=COPY
ALTER TABLEtbl_name
DROP PRIMARY KEY, ADD PRIMARY KEY (column
), ALGORITHM=INPLACE, LOCK=NONE;
VARCHAR | |||||
NULL | |||||
NOT NULL | |||||
ENUM
|
ALTER TABLEtbl_name
ADD COLUMNcolumn_name
column_definition
, ALGORITHM=INSTANT;
ALGORITHM=INPLACE, LOCK=SHARED
INSTANT
ALTER TABLE
ALGORITHM=INSTANT
ROW_FORMAT=COMPRESSED
FULLTEXT
ALGORITHM=COPY
ALTER TABLE
ALTER TABLE t1 ADD COLUMN c2 INT, ADD COLUMN c3 INT, ALGORITHM=INSTANT;
INFORMATION_SCHEMA.INNODB_TABLES
INFORMATION_SCHEMA.INNODB_COLUMNS
INFORMATION_SCHEMA.INNODB_COLUMNS.HAS_DEFAULT
ALTER TABLEtbl_name
DROP COLUMNcolumn_name
, ALGORITHM=INPLACE, LOCK=NONE;
ALTER TABLEtbl
CHANGEold_col_name
new_col_name
data_type
, ALGORITHM=INPLACE, LOCK=NONE;
[NOT]
NULL
ALGORITHM=INPLACE
ALGORITHM=COPY
ALGORITHM=COPY
ALGORITHM=INPLACE
FIRST
CHANGE
ALTER TABLEtbl_name
MODIFY COLUMNcol_name
column_definition
FIRST, ALGORITHM=INPLACE, LOCK=NONE;
ALTER TABLE tbl_name
CHANGE c1 c1 BIGINT, ALGORITHM=COPY;
ALGORITHM=COPY
VARCHAR
修改表 tbl_name
CHANGE COLUMN c1 c1 VARCHAR(255), ALGORITHM=INPLACE, LOCK=NONE;
VARCHAR
VARCHAR
VARCHAR
ALTER
TABLE
VARCHAR
ALTER TABLE
VARCHAR
ALGORITHM=COPY
VARCHAR
ALTER
TABLE
修改表 tbl_name
ALGORITHM=INPLACE, CHANGE COLUMN c1 c1 VARCHAR(256);ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot changecolumn type INPLACE. Try ALGORITHM=COPY.
VARCHAR
VARCHAR
ALTER TABLE
VARCHAR
ALGORITHM=COPY
ALTER TABLEtbl_name
ALTER COLUMNcol
SET DEFAULTliteral
, ALGORITHM=INSTANT;
ALTER TABLEtbl
ALTER COLUMNcol
DROP DEFAULT, ALGORITHM=INSTANT;
ALTER TABLEtable
AUTO_INCREMENT=next_value
, ALGORITHM=INPLACE, LOCK=NONE;
NULL
修改表tbl_name修改列 column_name
data_type
NULL, ALGORITHM=INPLACE, LOCK=NONE;
NOT NULL
修改表 tbl_name
修改列 column_name
data_type
NOT NULL, ALGORITHM=INPLACE, LOCK=NONE;
STRICT_ALL_TABLES
SQL_MODE
ENUM
CREATE TABLE t1 (c1 ENUM('a', 'b', 'c')); ALTER TABLE t1 MODIFY COLUMN c1 ENUM('a', 'b', 'c', 'd'), ALGORITHM=INSTANT;
ENUM
SET
SET
STORED | |||||
STORED | |||||
STORED | |||||
VIRTUAL | |||||
VIRTUAL | |||||
VIRTUAL |
STORED
ALTER TABLE t1 ADD COLUMN (c2 INT GENERATED ALWAYS AS (c1 + 1) STORED), ALGORITHM=COPY;
ADD COLUMN
STORED
ALTER TABLE t1 MODIFY COLUMN c2 INT GENERATED ALWAYS AS (c1 + 1) STORED FIRST, ALGORITHM=COPY;
STORED
ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INPLACE, LOCK=NONE;
VIRTUAL
ALTER TABLE t1 ADD COLUMN (c2 INT GENERATED ALWAYS AS (c1 + 1) VIRTUAL), ALGORITHM=INSTANT;
VIRTUAL
VIRTUAL
ALTER TABLE t1 MODIFY COLUMN c2 INT GENERATED ALWAYS AS (c1 + 1) VIRTUAL FIRST, ALGORITHM=COPY;
VIRTUAL
ALTER TABLE t1 DROP COLUMN c2, ALGORITHM=INSTANT;
VIRTUAL
INPLACE
foreign_key_checks
ALTER TABLEtbl1
ADD CONSTRAINTfk_name
FOREIGN KEYindex
(col1
) REFERENCEStbl2
(col2
)referential_actions
;
ALTER TABLEtbl
DROP FOREIGN KEYfk_name
;
foreign_key_checks
CONSTRAINT
显示创建表 table
G
INFORMATION_SCHEMA.TABLE_CONSTRAINTS
CONSTRAINT_TYPE
ALTER TABLEtable
DROP FOREIGN KEYconstraint
, DROP INDEXindex
;
FOREIGN KEY ... REFERENCE
ALTER TABLE
ON DELETE
SET NULL
FOREIGN KEY
ALTER TABLE
INSERT
UPDATE
DELETE
ON
DELETE
ROW_FORMAT | |||||
KEY_BLOCK_SIZE | |||||
FORCE | |||||
ROW_FORMAT
修改表 tbl_name
ROW_FORMAT =row_format
, ALGORITHM=INPLACE, LOCK=NONE;
ROW_FORMAT
KEY_BLOCK_SIZE
修改表 tbl_name
KEY_BLOCK_SIZE =value
, ALGORITHM=INPLACE, LOCK=NONE;
KEY_BLOCK_SIZE
ALTER TABLE tbl_name
STATS_PERSISTENT=0, STATS_SAMPLE_PAGES=20, STATS_AUTO_RECALC=1, ALGORITHM=INPLACE, LOCK=NONE;
STATS_PERSISTENT
STATS_SAMPLE_PAGES
ALTER TABLEtbl_name
CHARACTER SET =charset_name
, ALGORITHM=INPLACE, LOCK=NONE;
ALTER TABLEtbl_name
CONVERT TO CHARACTER SETcharset_name
, ALGORITHM=COPY;
OPTIMIZE TABLE tbl_name
;
FULLTEXT
ALGORITHM
ALTER TABLE tbl_name
ENCRYPTION='Y', ALGORITHM=COPY;
FULLTEXT
LOCK
FORCE
修改表 tbl_name
FORCE, ALGORITHM=INPLACE, LOCK=NONE;
ALGORITHM=INPLACE
ALGORITHM=INPLACE
ALTER TABLE tbl_name
ENGINE=InnoDB, ALGORITHM=INPLACE, LOCK=NONE;
ALGORITHM=INPLACE
ALGORITHM=INPLACE
FULLTEXT
ALTER TABLEold_tbl_name
RENAME TOnew_tbl_name
, ALGORITHM=INSTANT;
tbl_name
RENAME
TABLE
ALTER
TABLE
InnoDB
ALTER TABLE
ALTER
TABLE
ALTER TABLE
ALTER TABLE
ALGORITHM=COPY
ALGORITHM=DEFAULT,
LOCK=DEFAULT
ALTER TABLE
PARTITION BY | ALGORITHM=COPY LOCK={DEFAULT|SHARED|EXCLUSIVE} | |||
ADD PARTITION | ALGORITHM=INPLACE,
LOCK={DEFAULT|NONE|SHARED|EXCLUSISVE}
LIST ALGORITHM=INPLACE, LOCK={DEFAULT|SHARED|EXCLUSISVE} HASH
ALGORITHM=COPY,
LOCK={SHARED|EXCLUSIVE}
LIST ALGORITHM=COPY HASH
| |||
DROP PARTITION |
| |||
DISCARD PARTITION | ALGORITHM=DEFAULT LOCK=DEFAULT | |||
IMPORT PARTITION | ALGORITHM=DEFAULT LOCK=DEFAULT | |||
TRUNCATE
PARTITION | ||||
COALESCE
PARTITION | ALGORITHM=INPLACE, LOCK={DEFAULT|SHARED|EXCLUSIVE} | |||
REORGANIZE
PARTITION | ALGORITHM=INPLACE, LOCK={DEFAULT|SHARED|EXCLUSIVE} | |||
EXCHANGE
PARTITION | ||||
ANALYZE PARTITION | ||||
CHECK PARTITION | ||||
OPTIMIZE
PARTITION | ALGORITHM
| |||
REBUILD PARTITION | ALGORITHM=INPLACE, LOCK={DEFAULT|SHARED|EXCLUSIVE} | |||
REPAIR PARTITION | ||||
REMOVE
PARTITIONING | ALGORITHM=COPY LOCK={DEFAULT|SHARED|EXCLUSIVE} |
ALTER
TABLE
ALTER TABLE
ALTER
TABLE
LOCK
LOCK
LOCK=NONE
LOCK=SHARED
LOCK=DEFAULT
LOCK
LOCK=DEFAULT
LOCK=EXCLUSIVE
ALGORITHM
mysql> CREATE TABLE t1 (c1 INT) ENGINE=InnoDB; mysql> START TRANSACTION; mysql> SELECT * FROM t1;
SELECT
mysql> ALTER TABLE t1 ADD COLUMN x INT, ALGORITHM=INPLACE, LOCK=NONE;
mysql> SELECT * FROM t1;
SELECT
ALTER TABLE
SHOW FULL
PROCESSLIST
MySQL的> SHOW FULL PROCESSLIST\G
...*************************** 2. row *************************** Id: 5 User: root Host: localhost db: testCommand: Query Time: 44 State: Waiting for table metadata lock Info: ALTER TABLE t1 ADD COLUMN x INT, ALGORITHM=INPLACE, LOCK=NONE...*************************** 4. row *************************** Id: 7 User: root Host: localhost db: testCommand: Query Time: 5 State: Waiting for table metadata lock Info: SELECT * FROM t14 rows in set (0.00 sec)
metadata_locks
ALGORITHM=INSTANT
ALGORITHM=INPLACE
ALGORITHM=COPY
old_alter_table
ALGORITHM=COPY
Query OK, 0 rows affected (0.07 sec)
0 rows
affected
查询行,0行受影响(21.42秒)
Query OK, 1671168 rows affected (1 min 35.54 sec)
INFORMATION_SCHEMA
ALTER TABLE
innodb_sort_buffer_size
innodb_online_alter_log_max_size
innodb_online_alter_log_max_size
innodb_online_alter_log_max_size
$TMPDIR
--tmpdir
tmpdir
innodb_tmpdir
#sql-ib
innodb_tmpdir
ALTER TABLE
ALTER TABLE
ALTER
TABLE
ALTER TABLE
修改表T1添加索引I1(C1),添加唯一索引I2(C2),改变c4_old_name c4_new_name整数的符号;
ALTER TABLE t1 ADD INDEX i1(c1); ALTER TABLE t1 ADD UNIQUE INDEX i2(c2); ALTER TABLE t1 CHANGE c4_old_name c4_new_name INTEGER UNSIGNED NOT NULL;
ALTER
TABLE
LOCK
ALGORITHM=COPY
old_alter_table=1
ALGORITHM
LOCK
NONE
tmpdir
innodb_tmpdir
innodb_online_alter_log_max_size
NULL
ALTER TABLE
TEMPORARY TABLE
ALTER TABLE
LOCK=NONE
ON...CASCADE
ALTER TABLE
InnoDB
OPTIMIZE TABLE
ALTER TABLE
OPTIMIZE TABLE
DATE
DATETIME
TIMESTAMP
ALGORITHM=COPY
ALGORITHM=INPLACE
ALTER TABLE ...
ALGORITHM=INPLACE
ERROR 1846 (0A000): ALGORITHM=INPLACE is not supported.Reason: Cannot change column type INPLACE. Try ALGORITHM=COPY.
--skip-
--innodb_adaptive_hash_index
--skip-innodb_adaptive_hash_index
innodb_adaptive_hash_index
--
var_name
=value
var_name
=value
GLOBAL
SET
InnoDB
InnoDB
--ignore-builtin-innodb | |
ignore_builtin_innodb | |
InnoDB
InnoDB
--innodb[=value] | |
ON | |
|
InnoDB
OFF
FORCE
InnoDB
--innodb=OFF
--skip-innodb
InnoDB
--default-storage-engine
--default-tmp-storage-engine
InnoDB
--innodb=OFF
--skip-innodb
--innodb-status-file | |
OFF |
InnoDB
pid
SHOW ENGINE
INNODB STATUS
--innodb-status-file=1
InnoDB
--innodb
daemon_memcached_enable_binlog
--daemon-memcached-enable-binlog=# | |
daemon_memcached_enable_binlog | |
false |
InnoDB
daemon_memcached
--log-bin
daemon_memcached_engine_lib_name
--daemon-memcached-engine-lib-name=library | |
daemon_memcached_engine_lib_name | |
innodb_engine.so |
InnoDB
daemon_memcached_engine_lib_path
--daemon-memcached-engine-lib-path=directory | |
daemon_memcached_engine_lib_path | |
NULL |
InnoDB
memcached
--daemon-memcached-option=options | |
daemon_memcached_option | |
|
--daemon-memcached-r-batch-size=# | |
daemon_memcached_r_batch_size | |
1 |
get
COMMIT
daemon_memcached_w_batch_size
--daemon-memcached-w-batch-size=# | |
daemon_memcached_w_batch_size | |
1 |
add
incr
COMMIT
daemon_memcached_r_batch_size
N
--ignore-builtin-innodb | |
ignore_builtin_innodb | |
--ignore-builtin-innodb
--innodb-adaptive-flushing=# | |
innodb_adaptive_flushing | |
ON |
InnoDB
--innodb-adaptive-flushing-lwm=# | |
innodb_adaptive_flushing_lwm | |
10 | |
0 | |
70 |
--innodb-adaptive-hash-index=# | |
innodb_adaptive_hash_index | |
ON |
InnoDB
SET GLOBAL
SYSTEM_VARIABLES_ADMIN
--skip-innodb_adaptive_hash_index
innodb_adaptive_hash_index_parts
--innodb-adaptive-hash-index-parts=# | |
innodb_adaptive_hash_index_parts | |
8 | |
1 | |
512 |
innodb_adaptive_max_sleep_delay
--innodb-adaptive-max-sleep-delay=# | |
innodb_adaptive_max_sleep_delay | |
150000 | |
0 | |
1000000 |
InnoDB
innodb_thread_sleep_delay
innodb_adaptive_max_sleep_delay
--innodb-api-bk-commit-interval=# | |
innodb_api_bk_commit_interval | |
5 | |
1 | |
1073741824 |
InnoDB
--innodb-api-disable-rowlock=# | |
innodb_api_disable_rowlock | |
OFF |
InnoDB
innodb_api_disable_rowlock
get
innodb_api_disable_rowlock
innodb_api_disable_rowlock
--innodb-api-enable-binlog=# | |
innodb_api_enable_binlog | |
OFF |
InnoDB
--innodb-api-enable-mdl=# | |
innodb_api_enable_mdl | |
OFF |
InnoDB
--innodb-api-trx-level=# | |
innodb_api_trx_level | |
0 |
--innodb-autoextend-increment=# | |
innodb_autoextend_increment | |
64 | |
1 | |
1000 |
InnoDB
innodb_autoextend_increment
innodb_autoextend_increment
--innodb-autoinc-lock-mode=# | |
innodb_autoinc_lock_mode | |
2 | |
1 | |
|
innodb_background_drop_list_empty
--innodb-background-drop-list-empty=# | |
innodb_background_drop_list_empty | |
OFF |
innodb_background_drop_list_empty
t1
--innodb-buffer-pool-chunk-size | |
innodb_buffer_pool_chunk_size | |
134217728 | |
1048576 | |
innodb_buffer_pool_size / innodb_buffer_pool_instances |
innodb_buffer_pool_chunk_size
innodb_buffer_pool_size
innodb_buffer_pool_chunk_size
innodb_page_size
innodb_buffer_pool_chunk_size
innodb_buffer_pool_chunk_size
innodb_buffer_pool_instances
innodb_buffer_pool_chunk_size
innodb_buffer_pool_size
innodb_buffer_pool_instances
innodb_buffer_pool_chunk_size
innodb_buffer_pool_instances
innodb_buffer_pool_chunk_size
innodb_buffer_pool_size
innodb_buffer_pool_chunk_size
innodb_buffer_pool_instances
innodb_buffer_pool_chunk_size
innodb_buffer_pool_chunk_size
innodb_buffer_pool_size
innodb_buffer_pool_size
innodb_buffer_pool_chunk_size
--innodb-buffer-pool-debug=# | |
innodb_buffer_pool_debug | |
OFF |
innodb_buffer_pool_instances
WITH_DEBUG
innodb_buffer_pool_dump_at_shutdown
--innodb-buffer-pool-dump-at-shutdown=# | |
innodb_buffer_pool_dump_at_shutdown | |
ON |
InnoDB
innodb_buffer_pool_load_at_startup
innodb_buffer_pool_dump_pct
innodb_buffer_pool_dump_at_shutdown
--innodb-buffer-pool-dump-now=# | |
innodb_buffer_pool_dump_now | |
OFF |
InnoDB
innodb_buffer_pool_load_now
--innodb-buffer-pool-dump-pct=# | |
innodb_buffer_pool_dump_pct | |
25 | |
1 | |
100 |
innodb_buffer_pool_dump_pct
--innodb-buffer-pool-filename=file | |
innodb_buffer_pool_filename | |
ib_buffer_pool |
innodb_buffer_pool_dump_at_shutdown
innodb_buffer_pool_dump_now
ib_buffer_pool
SET
SET GLOBAL innodb_buffer_pool_filename='file_name'
;
InnoDB
--innodb-buffer-pool-instances=# | |
innodb_buffer_pool_instances | |
8 (or 1 if innodb_buffer_pool_size < 1GB | |
(autosized) | |
1 | |
64 |
InnoDB
innodb_buffer_pool_size
innodb_buffer_pool_instances
innodb_buffer_pool_size
innodb_buffer_pool_size
innodb_buffer_pool_size
innodb_buffer_pool_instances
innodb_buffer_pool_size
innodb_buffer_pool_size
--innodb-buffer-pool-load-abort=# | |
innodb_buffer_pool_load_abort | |
OFF |
InnoDB
innodb_buffer_pool_load_at_startup
innodb_buffer_pool_load_now
innodb_buffer_pool_load_at_startup
--innodb-buffer-pool-load-at-startup=# | |
innodb_buffer_pool_load_at_startup | |
ON |
InnoDB
innodb_buffer_pool_dump_at_shutdown
innodb_buffer_pool_dump_at_shutdown
--innodb-buffer-pool-load-now=# | |
innodb_buffer_pool_load_now | |
OFF |
InnoDB
--innodb-buffer-pool-size=# | |
innodb_buffer_pool_size | |
134217728 | |
5242880 | |
2**64-1 | |
2**32-1 |
InnoDB
innodb_buffer_pool_instances
InnoDB
innodb_buffer_pool_chunk_size
innodb_buffer_pool_chunk_size
innodb_buffer_pool_instances
innodb_buffer_pool_chunk_size
innodb_buffer_pool_instances
innodb_buffer_pool_chunk_size
innodb_buffer_pool_instances
innodb_buffer_pool_size
Innodb_buffer_pool_resize_status
innodb_dedicated_server
innodb_buffer_pool_size
--innodb-change-buffer-max-size=# | |
innodb_change_buffer_max_size | |
25 | |
0 | |
50 |
InnoDB
--innodb-change-buffering=# | |
innodb_change_buffering | |
all | |
|
InnoDB
none | 0 | |
inserts | 1 | |
deletes | 2 | |
changes | 3 | |
purges | 4 | |
all | 5 |
--innodb-change-buffering-debug=# | |
innodb_change_buffering_debug | |
0 | |
2 |
InnoDB
WITH_DEBUG
--innodb-checkpoint-disabled=# | |
innodb_checkpoint_disabled | |
OFF |
InnoDB
WITH_DEBUG
--innodb-checksum-algorithm=# | |
innodb_checksum_algorithm | |
crc32 | |
|
InnoDB
innodb_checksum_algorithm
innodb
innodb
crc32
none
crc32
innodb
InnoDB
none
crc32 | ||
InnoDB | none
crc32 | |
crc32 | none
crc32 | |
none
crc32
| ||
InnoDB | none
crc32
| |
crc32 | none
crc32
|
--innodb-cmp-per-index-enabled=# | |
innodb_cmp_per_index_enabled | |
OFF | |
|
INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX
--innodb-commit-concurrency=# | |
innodb_commit_concurrency | |
0 | |
0 | |
1000 |
innodb_commit_concurrency
--innodb-compress-debug=# | |
innodb_compress_debug | |
none | |
|
COMPRESSION
WITH_DEBUG
innodb_compression_failure_threshold_pct
--innodb-compression-failure-threshold-pct=# | |
innodb_compression_failure_threshold_pct | |
5 | |
0 | |
100 |
innodb_compression_pad_pct_max
--innodb-compression-level=# | |
innodb_compression_level | |
6 | |
0 | |
9 |
InnoDB
innodb_compression_pad_pct_max
--innodb-compression-pad-pct-max=# | |
innodb_compression_pad_pct_max | |
50 | |
0 | |
75 |
innodb_compression_failure_threshold_pct
--innodb-concurrency-tickets=# | |
innodb_concurrency_tickets | |
5000 | |
1 | |
4294967295 |
InnoDB
InnoDB
innodb_concurrency_tickets
InnoDB
innodb_concurrency_tickets
innodb_concurrency_tickets
innodb_thread_concurrency
innodb_thread_concurrency
SHOW ENGINE INNODB STATUS
INFORMATION_SCHEMA.INNODB_TRX
--innodb-data-file-path=name | |
innodb_data_file_path | |
ibdata1:12M:autoextend |
InnoDB
innodb_data_file_path
autoextend
file_name
:file_size
[:autoextend[:max:max_file_size
]]
K
G
innodb_page_size
innodb_page_size
innodb_page_size
autoextend
innodb_data_file_path
[mysqld]innodb_data_file_path=ibdata1:50M;ibdata2:12M:autoextend:max:500MB
autoextend
autoextend
innodb_autoextend_increment
innodb_data_home_dir
--innodb-data-home-dir=dir_name | |
innodb_data_home_dir | |
InnoDB
innodb_file_per_table
innodb_data_file_path
innodb_data_home_dir
[mysqld]innodb_data_home_dir = /path/to/myibdata/
innodb_ddl_log_crash_reset_debug
--innodb-ddl-log-crash-reset-debug=# | |
innodb_ddl_log_crash_reset_debug | |
False |
WITH_DEBUG
--innodb-deadlock-detect | |
innodb_deadlock_detect | |
ON |
innodb_lock_wait_timeout
--innodb-dedicated-server=# | |
innodb_dedicated_server | |
OFF |
innodb_dedicated_server
--innodb-default-row-format=# | |
innodb_default_row_format | |
DYNAMIC | |
|
innodb_default_row_format
DYNAMIC
REDUNDANT
innodb_default_row_format
ROW_FORMAT=DEFAULT
ROW_FORMAT
ROW_FORMAT=DEFAULT
innodb_default_row_format
InnoDB
innodb_default_row_format
--innodb-directories=# | |
innodb_directories | |
innodb_data_home_dir
innodb_undo_directory
datadir
innodb_directories
innodb_directories
innodb_directories
mysqld --innodb-directories="directory_path_1
;directory_path_2
"
[mysqld] innodb_directories="directory_path_1
;directory_path_2
"
innodb_directories
innodb_disable_sort_file_cache
--innodb-disable-sort-file-cache=# | |
innodb_disable_sort_file_cache | |
OFF |
O_DIRECT
--innodb-doublewrite | |
innodb_doublewrite | |
ON |
InnoDB
--skip-innodb_doublewrite
ibdata*
innodb_flush_method
--innodb-fast-shutdown[=#] | |
innodb_fast_shutdown | |
1 | |
|
InnoDB
InnoDB
InnoDB
InnoDB
innodb_fast_shutdown=2
innodb_fil_make_page_dirty_debug
--innodb-fil-make-page-dirty-debug=# | |
innodb_fil_make_page_dirty_debug | |
0 | |
2**32-1 |
innodb_fil_make_page_dirty_debug
innodb_saved_page_number_debug
innodb_fil_make_page_dirty_debug
WITH_DEBUG
--innodb-file-per-table | |
innodb_file_per_table | |
ON |
innodb_file_per_table
.ibd
innodb_file_per_table
ALTER TABLE
.ibd
ALTER TABLE
ALGORITHM=COPY
TABLESPACE=innodb_system
CREATE TABLE
ALTER TABLE
ALTER TABLE
... TABLESPACE=innodb_file_per_table
innodb_file_per_table
DROP TABLE
TRUNCATE TABLE
innodb_file_per_table
innodb_file_per_table
ALTER TABLE
InnoDB
innodb_file_per_table
OFF
my.cnf
SYSTEM_VARIABLES_ADMIN
innodb_file_per-table
InnoDB
--innodb-fill-factor=# | |
innodb_fill_factor | |
100 | |
10 | |
100 |
InnoDB
innodb_fill_factor
innodb_fill_factor
innodb_fill_factor
innodb_fill_factor
TEXT
BLOB
innodb_flush_log_at_timeout | |
1 | |
1 | |
2700 |
N
innodb_flush_log_at_timeout
innodb_flush_log_at_timeout
innodb_flush_log_at_trx_commit
--innodb-flush-log-at-trx-commit[=#] | |
innodb_flush_log_at_trx_commit | |
1 | |
|
InnoDB
InnoDB
InnoDB
innodb_flush_log_at_timeout
N
N
N
InnoDB
innodb_flush_log_at_trx_commit
InnoDB
innodb_flush_log_at_trx_commit
InnoDB
sync_binlog=1
innodb_flush_log_at_trx_commit=1
InnoDB
--innodb-flush-method=name | |
innodb_flush_method | |
unbuffered | |
fsync | |
| |
|
InnoDB
fsync
innodb_flush_method
innodb_flush_method
fsync
InnoDB
fsync
O_DSYNC
InnoDB
fsync()
O_DSYNC
littlesync
nosync
O_DIRECT
InnoDB
directio()
O_DIRECT_NO_FSYNC
InnoDB
fsync()
O_DIRECT
innodb_flush_method
unbuffered
InnoDB
normal
InnoDB
Innodb_data_fsyncs
O_DIRECT
InnoDB
SELECT
innodb_dedicated_server
innodb_flush_method
--innodb-flush-neighbors | |
innodb_flush_neighbors | |
0 | |
1 | |
|
InnoDB
innodb_flush_neighbors
--innodb-flush-sync=# | |
innodb_flush_sync | |
ON |
innodb_flush_sync
innodb_io_capacity
InnoDB
innodb_io_capacity
--innodb-flushing-avg-loops=# | |
innodb_flushing_avg_loops | |
30 | |
1 | |
1000 |
InnoDB
--innodb-force-load-corrupted | |
innodb_force_load_corrupted | |
OFF |
InnoDB
--innodb-force-recovery=# | |
innodb_force_recovery | |
0 | |
0 | |
6 |
innodb_force_recovery
--innodb-ft-aux-table=# | |
innodb_ft_aux_table | |
InnoDB
db_name
/table_name
INNODB_FT_INDEX_TABLE
INNODB_FT_INDEX_CACHE
INNODB_FT_CONFIG
INNODB_FT_DELETED
INNODB_FT_BEING_DELETED
--innodb-ft-cache-size=# | |
innodb_ft_cache_size | |
8000000 | |
1600000 | |
80000000 |
InnoDB
InnoDB
innodb_ft_cache_size
innodb_ft_total_cache_size
--innodb-ft-enable-diag-print=# | |
innodb_ft_enable_diag_print | |
OFF |
FTS SYNC for table test, deleted count: 100 size: 10000 bytes SYNC words: 100
FTS start optimize test FTS_OPTIMIZE: optimize "mysql" FTS_OPTIMIZE: processed "mysql"
Number of doc processed: 1000
FTS Search Processing time: 1 secs: 100 millisec: row(s) 10000 Full Search Memory: 245666 (bytes), Row: 10000
--innodb-ft-enable-stopword=# | |
innodb_ft_enable_stopword | |
ON |
InnoDB
innodb_ft_user_stopword_table
innodb_ft_server_stopword_table
--innodb-ft-max-token-size=# | |
innodb_ft_max_token_size | |
84 | |
10 | |
84 |
InnoDB
--innodb-ft-min-token-size=# | |
innodb_ft_min_token_size | |
3 | |
0 | |
16 |
InnoDB
--innodb-ft-num-word-optimize=# | |
innodb_ft_num_word_optimize | |
2000 |
OPTIMIZE TABLE
FULLTEXT
OPTIMIZE TABLE
--innodb-ft-result-cache-limit=# | |
innodb_ft_result_cache_limit | |
2000000000 | |
1000000 | |
2**32-1 |
InnoDB
innodb_ft_result_cache_limit
innodb_ft_result_cache_limit
innodb_ft_server_stopword_table
--innodb-ft-server-stopword-table=db_name/table_name | |
innodb_ft_server_stopword_table | |
NULL |
InnoDB
InnoDB
innodb_ft_user_stopword_table
innodb_ft_server_stopword_table
db_name
table_name
innodb_ft_server_stopword_table
innodb_ft_server_stopword_table
InnoDB
value
--innodb-ft-sort-pll-degree=# | |
innodb_ft_sort_pll_degree | |
2 | |
1 | |
32 |
InnoDB
--innodb-ft-total-cache-size=# | |
innodb_ft_total_cache_size | |
640000000 | |
32000000 | |
1600000000 |
InnoDB
innodb_ft_total_cache_size
--innodb-ft-user-stopword-table=db_name/table_name | |
innodb_ft_user_stopword_table | |
NULL |
InnoDB
InnoDB
innodb_ft_server_stopword_table
innodb_ft_user_stopword_table
db_name
table_name
innodb_ft_user_stopword_table
innodb_ft_user_stopword_table
InnoDB
value
--innodb-io-capacity=# | |
innodb_io_capacity | |
200 | |
100 | |
2**64-1 | |
2**32-1 |
innodb_io_capacity
innodb_io_capacity
innodb_io_capacity
InnoDB
100
innodb_io_capacity
innodb_io_capacity
innodb_io_capacity_max
my.cnf
SET GLOBAL
SYSTEM_VARIABLES_ADMIN
innodb_flush_sync
innodb_io_capacity
innodb_flush_sync
InnoDB
--innodb-io-capacity-max=# | |
innodb_io_capacity_max | |
see description | |
100 | |
2**32-1 | |
2**64-1 | |
2**32-1 |
InnoDB
innodb_io_capacity
InnoDB
innodb_io_capacity_max
innodb_io_capacity
innodb_io_capacity_max
innodb_io_capacity
innodb_io_capacity_max
innodb_io_capacity
innodb_io_capacity
innodb_io_capacity
innodb_io_capacity_max
innodb_io_capacity_max
innodb_io_capacity
innodb_io_capacity_max
SET
SET GLOBAL innodb_io_capacity_max=DEFAULT
innodb_io_capacity_max
innodb_limit_optimistic_insert_debug
--innodb-limit-optimistic-insert-debug=# | |
innodb_limit_optimistic_insert_debug | |
0 | |
0 | |
2**32-1 |
WITH_DEBUG
--innodb-lock-wait-timeout=# | |
innodb_lock_wait_timeout | |
50 | |
1 | |
1073741824 |
InnoDB
InnoDB
错误1205(hy000):锁等待超时超标;尝试重新启动交易
--innodb_rollback_on_timeout
innodb_lock_wait_timeout
InnoDB
innodb_deadlock_detect
innodb_deadlock_detect
innodb_lock_wait_timeout
innodb_lock_wait_timeout
SET SESSION
SYSTEM_VARIABLES_ADMIN
SESSION
innodb_lock_wait_timeout
--innodb-log-buffer-size=# | |
innodb_log_buffer_size | |
innodb_log_buffer_size | |
16777216 | |
1048576 | |
4294967295 |
InnoDB
--innodb-log-checksums=# | |
innodb_log_checksums | |
ON |
innodb_log_checksums=ON
innodb_log_checksums
--innodb-log-compressed-pages=# | |
innodb_log_compressed_pages | |
ON |
innodb_log_compressed_pages
zlib
innodb_log_compressed_pages
LOG
SHOW ENGINE
INNODB STATUS
Innodb_os_log_written
--innodb-log-file-size=# | |
innodb_log_file_size | |
50331648 | |
4194304 | |
512GB / innodb_log_files_in_group |
innodb_log_file_size
innodb_log_files_in_group
innodb_log_file_size
innodb_dedicated_server
innodb_log_file_size
--innodb-log-files-in-group=# | |
innodb_log_files_in_group | |
2 | |
2 | |
100 |
InnoDB
innodb_log_group_home_dir
innodb_log_file_size
--innodb-log-group-home-dir=dir_name | |
innodb_log_group_home_dir | |
InnoDB
innodb_log_files_in_group
ib_logfile0
innodb_log_file_size
--innodb-log-spin-cpu-abs-lwm=# | |
innodb_log_spin_cpu_abs_lwm | |
80 | |
0 | |
4294967295 |
--innodb-log-spin-cpu-pct-hwm=# | |
innodb_log_spin_cpu_pct_hwm | |
50 | |
0 | |
100 |
innodb_log_spin_cpu_pct_hwm
innodb_log_wait_for_flush_spin_hwm
--innodb-log-wait-for-flush-spin-hwm=# | |
innodb_log_wait_for_flush_spin_hwm | |
400 | |
0 | |
2**64-1 | |
2**32-1 |
--innodb-log-write-ahead-size=# | |
innodb_log_write_ahead_size | |
8192 | |
512 (log file block size) | |
Equal to innodb_page_size |
innodb_log_write_ahead_size
innodb_log_write_ahead_size
InnoDB
innodb_page_size
innodb_log_write_ahead_size
innodb_page_size
innodb_page_size
innodb_log_write_ahead_size
fsync
--innodb-lru-scan-depth=# | |
innodb_lru_scan_depth | |
1024 | |
100 | |
2**64-1 | |
2**32-1 |
InnoDB
innodb_lru_scan_depth
innodb_lru_scan_depth
innodb_buffer_pool_instances
--innodb-max-dirty-pages-pct=# | |
innodb_max_dirty_pages_pct | |
90 | |
75 | |
0 | |
99.99 |
innodb_max_dirty_pages_pct
innodb_max_dirty_pages_pct_lwm
--innodb-max-dirty-pages-pct-lwm=# | |
innodb_max_dirty_pages_pct_lwm | |
10 | |
0 | |
0 | |
99.99 |
--innodb-max-purge-lag=# | |
innodb_max_purge_lag | |
0 | |
0 | |
4294967295 |
INSERT
UPDATE
DELETE
InnoDB
UPDATE
DELETE
purge_lag
purge_lag
innodb_max_purge_lag
INSERT
UPDATE
DELETE
purge_lag
innodb_max_purge_lag_delay
InnoDB
TRANSACTIONS
------------ TRANSACTIONS ------------ Trx id counter 0 290328385 Purge done for trx's n:o < 0 290315608 undo n:o < 0 17 History list length 20
--innodb-max-purge-lag-delay=# | |
innodb_max_purge_lag_delay | |
0 | |
0 |
innodb_max_purge_lag
innodb_max_purge_lag
--innodb-max-undo-log-size=# | |
innodb_max_undo_log_size | |
1073741824 | |
10485760 | |
2**64-1 |
innodb_undo_log_truncate
innodb_merge_threshold_set_all_debug
--innodb-merge-threshold-set-all-debug=# | |
innodb_merge_threshold_set_all_debug | |
50 | |
1 | |
50 |
MERGE_THRESHOLD
WITH_DEBUG
--innodb-monitor-disable=[counter|module|pattern|all] | |
innodb_monitor_disable | |
InnoDB
INFORMATION_SCHEMA.INNODB_METRICS
innodb_monitor_disable='latch'
SHOW ENGINE
INNODB MUTEX
--innodb-monitor-enable=[counter|module|pattern|all] | |
innodb_monitor_enable | |
InnoDB
INFORMATION_SCHEMA.INNODB_METRICS
innodb_monitor_enable='latch'
SHOW ENGINE
INNODB MUTEX
--innodb-monitor-reset=[counter|module|pattern|all] | |
innodb_monitor_reset | |
InnoDB
INFORMATION_SCHEMA.INNODB_METRICS
innodb_monitor_reset='latch'
SHOW ENGINE
INNODB MUTEX
--innodb-monitor-reset-all=[counter|module|pattern|all] | |
innodb_monitor_reset_all | |
InnoDB
INFORMATION_SCHEMA.INNODB_METRICS
--innodb-numa-interleave=# | |
innodb_numa_interleave | |
OFF |
InnoDB
MPOL_INTERLEAVE
InnoDB
innodb_numa_interleave
WITH_NUMA
--innodb-old-blocks-pct=# | |
innodb_old_blocks_pct | |
37 | |
5 | |
95 |
InnoDB
innodb_old_blocks_time
--innodb-old-blocks-time=# | |
innodb_old_blocks_time | |
1000 | |
0 | |
2**32-1 |
innodb_old_blocks_pct
innodb_online_alter_log_max_size
--innodb-online-alter-log-max-size=# | |
innodb_online_alter_log_max_size | |
134217728 | |
65536 | |
2**64-1 |
InnoDB
innodb_sort_buffer_size
ALTER TABLE
--innodb-open-files=# | |
innodb_open_files | |
-1 | |
10 | |
4294967295 |
InnoDB
.ibd
innodb_file_per_table
table_open_cache
.ibd
--open-files-limit
--innodb-optimize-fulltext-only=# | |
innodb_optimize_fulltext_only | |
OFF |
OPTIMIZE TABLE
InnoDB
OPTIMIZE TABLE
OPTIMIZE TABLE
FULLTEXT
--innodb-page-cleaners=# | |
innodb_page_cleaners | |
4 | |
1 | |
64 |
innodb_page_cleaners
innodb_buffer_pool_instances
setpriority()
page_cleaner
setpriority()
[Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
/etc/security/limits.conf
mysql
/etc/security/limits.conf
MySQL硬好看的20mysql软好- 20
LimitNICE=-20
/etc/systemd/system/mysqld.service.d/override.conf
[Service]LimitNICE=-20
override.conf
systemctl守护reloadsystemctl重启mysqld #转platformssystemctl重启mysql # Debian平台
Nice
shell> cat /proc/mysqld_pid
/limits | grep nice
Max nice priority 18446744073709551596 18446744073709551596
--innodb-page-size=#k | |
innodb_page_size | |
16384 | |
|
InnoDB
16k
4k
innodb_page_size
ROW_FORMAT=COMPRESSED
innodb_page_size=32k
innodb_page_size=64k
innodb_log_buffer_size
InnoDB
ibdata1
innodb_page_size
innodb_data_file_path
--innodb-print-all-deadlocks=# | |
innodb_print_all_deadlocks | |
OFF |
InnoDB
SHOW ENGINE INNODB
STATUS
InnoDB
SELECT ... FOR
UPDATE
--innodb-print-ddl-logs=# | |
innodb_print_ddl_logs | |
OFF |
stderr
--innodb-purge-batch-size=# | |
innodb_purge_batch_size | |
300 | |
1 | |
5000 |
innodb_purge_batch_size
innodb_purge_threads
innodb_purge_batch_size
innodb_purge_threads
--innodb-purge-threads=# | |
innodb_purge_threads | |
4 | |
1 | |
32 |
InnoDB
InnoDB
innodb_purge_rseg_truncate_frequency
--innodb-purge-rseg-truncate-frequency=# | |
innodb_purge_rseg_truncate_frequency | |
128 | |
1 | |
128 |
innodb_purge_rseg_truncate_frequency
innodb_undo_log_truncate
--innodb-random-read-ahead=# | |
innodb_random_read_ahead | |
OFF |
InnoDB
--innodb-read-ahead-threshold=# | |
innodb_read_ahead_threshold | |
56 | |
0 | |
64 |
InnoDB
InnoDB
InnoDB
innodb_read_ahead_threshold
SHOW
ENGINE INNODB STATUS
Innodb_buffer_pool_read_ahead
Innodb_buffer_pool_read_ahead_evicted
SHOW ENGINE
INNODB STATUS
BUFFER POOL AND MEMORY
SHOW ENGINE
INNODB STATUS
--innodb-read-io-threads=# | |
innodb_read_io_threads | |
4 | |
1 | |
64 |
InnoDB
innodb_write_io_threads
innodb_read_io_threads
innodb_write_io_threads
aio-max-nr
--innodb-read-only=# | |
innodb_read_only | |
OFF |
InnoDB
innodb_read_only
innodb_read_only
InnoDB
innodb_read_only
innodb_read_only
ANALYZE
TABLE
ANALYZE TABLE
information_schema_stats_expiry=0
ALTER TABLE
tbl_name
ENGINE=engine_name
mysql
CREATE USER
GRANT
INSTALL PLUGIN
UNINSTALL PLUGIN
InnoDB
CREATE
FUNCTION
DROP
FUNCTION
InnoDB
--innodb-redo-log-encrypt=# | |
innodb_redo_log_encrypt | |
OFF |
InnoDB
--innodb-replication-delay=# | |
innodb_replication_delay | |
0 | |
0 | |
4294967295 |
innodb_thread_concurrency
--innodb-rollback-on-timeout | |
innodb_rollback_on_timeout | |
OFF |
InnoDB
--innodb_rollback_on_timeout
START
TRANSACTION
BEGIN
COMMIT
ROLLBACK
--innodb-rollback-segments=# | |
innodb_rollback_segments | |
128 | |
1 | |
128 |
innodb_rollback_segments
--innodb-scan-directories=# | |
innodb_scan_directories | |
NULL |
InnoDB
InnoDB
innodb_scan_directories
mysqld --innodb-scan-directories="directory_path_1
;directory_path_2
"
[mysqld] innodb_scan_directories="directory_path_1
;directory_path_2
"
innodb_saved_page_number_debug
--innodb-saved-page-number-debug=# | |
innodb_saved_page_number_debug | |
0 | |
2**23-1 |
innodb_fil_make_page_dirty_debug
innodb_saved_page_number_debug
WITH_DEBUG
--innodb-sort-buffer-size=# | |
innodb_sort_buffer_size | |
1048576 | |
65536 | |
67108864 |
InnoDB
ALTER TABLE
CREATE TABLE
(6 /*FTS_NUM_AUX_INDEX*/ * (3*@@global.innodb_sort_buffer_size) + 2 * number_of_partitions * number_of_secondary_indexes_created * (@@global.innodb_sort_buffer_size/dict_index_get_min_size(index)*/) * 8 /*64-bit sizeof *buf->tuples*/")
@@global.innodb_sort_buffer_size/dict_index_get_min_size(index)
innodb_ft_sort_pll_degree
(6 / * FTS Proceed.Num Num Course on the Effect Index * / * @ @ @ @ @ @ @ @ @ @ @ @
--innodb-spin-wait-delay=# | |
innodb_spin_wait_delay | |
6 | |
0 | |
2**64-1 | |
2**32-1 |
--innodb-stats-auto-recalc=# | |
innodb_stats_auto_recalc | |
ON |
InnoDB
innodb_stats_persistent
STATS_PERSISTENT=1
CREATE TABLE
ALTER TABLE
innodb_stats_persistent_sample_pages
innodb_stats_include_delete_marked
--innodb-stats-include-delete-marked=# | |
innodb_stats_include_delete_marked | |
OFF |
InnoDB
READ UNCOMMITTED
innodb_stats_include_delete_marked
innodb_stats_include_delete_marked
ANALYZE TABLE
innodb_stats_include_delete_marked
--innodb-stats-method=name | |
innodb_stats_method | |
nulls_equal | |
|
NULL
InnoDB
nulls_unequal
nulls_equal
NULL
NULL
nulls_ignored
--innodb-stats-on-metadata | |
innodb_stats_on_metadata | |
OFF |
innodb_stats_persistent
STATS_PERSISTENT=0
innodb_stats_on_metadata
SHOW TABLE
STATUS
INFORMATION_SCHEMA.TABLES
INFORMATION_SCHEMA.STATISTICS
ANALYZE TABLE
InnoDB
SET GLOBAL
innodb_stats_on_metadata=
mode
mode
OFF
0
SYSTEM_VARIABLES_ADMIN
--innodb-stats-persistent=setting | |
innodb_stats_persistent | |
ON | |
|
InnoDB
innodb_stats_persistent
CREATE TABLE
ALTER TABLE
innodb_stats_persistent_sample_pages
--innodb-stats-persistent-sample-pages=# | |
innodb_stats_persistent_sample_pages | |
20 |
ANALYZE TABLE
ANALYZE TABLE
innodb_stats_persistent_sample_pages
ANALYZE
TABLE
ANALYZE
TABLE
innodb_stats_persistent_sample_pages
innodb_stats_persistent
innodb_stats_persistent
innodb_stats_transient_sample_pages
innodb_stats_transient_sample_pages
--innodb-stats-transient-sample-pages=# | |
innodb_stats_transient_sample_pages | |
8 |
ANALYZE TABLE
InnoDB
innodb_stats_transient_sample_pages
ANALYZE
TABLE
ANALYZE
TABLE
innodb_stats_transient_sample_pages
innodb_stats_persistent
innodb_stats_persistent
innodb_stats_persistent_sample_pages
--innodb-status-output | |
innodb_status_output | |
OFF |
InnoDB
innodb_status_output_locks
--innodb-status-output-locks | |
innodb_status_output_locks | |
OFF |
InnoDB
SHOW ENGINE INNODB STATUS
InnoDB
InnoDB
--innodb-strict-mode=# | |
innodb_strict_mode | |
ON |
innodb_strict_mode
innodb_strict_mode
sql_mode
innodb_strict_mode
CREATE
TABLE
ALTER TABLE
CREATE INDEX
OPTIMIZE TABLE
INSERT
innodb_strict_mode
KEY_BLOCK_SIZE
CREATE TABLE
ALTER TABLE
CREATE INDEX
InnoDB
innodb_strict_mode
innodb_strict_mode
SET [GLOBAL|SESSION] innodb_strict_mode=
mode
mode
OFF
SYSTEM_VARIABLES_ADMIN
SESSION
innodb_strict_mode
innodb_strict_mode
--innodb-sync-array-size=# | |
innodb_sync_array_size | |
1 | |
1 | |
1024 |
--innodb-sync-spin-loops=# | |
innodb_sync_spin_loops | |
30 | |
0 | |
4294967295 |
InnoDB
--innodb-sync-debug=# | |
innodb_sync_debug | |
OFF |
InnoDB
WITH_DEBUG
--innodb-table-locks | |
innodb_table_locks | |
TRUE |
autocommit = 0
LOCK
TABLES
innodb_table_locks
LOCK TABLES
autocommit = 0
innodb_table_locks = 0
LOCK TABLES ...
WRITE
LOCK TABLES ...
WRITE
LOCK TABLES
... READ
--innodb-temp-data-file-path=file | |
innodb_temp_data_file_path | |
ibtmp1:12M:autoextend |
InnoDB
innodb_temp_data_file_path
autoextend
file_name
:file_size
[:autoextend[:max:max_file_size
]]
InnoDB
K
G
autoextend
innodb_temp_data_file_path
[mysqld]innodb_temp_data_file_path=ibtmp1:50M;ibtmp2:12M:autoextend:max:500MB
autoextend
autoextend
innodb_autoextend_increment
innodb_data_home_dir
innodb_temp_data_file_path
InnoDB
InnoDB
innodb_temp_data_file_path
--innodb_temp_data_file_path=../../../tmp/ibtmp1:12M:autoextend
InnoDB
INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO
--innodb-temp-tablespaces-dir=dir_name | |
innodb_temp_tablespaces_dir | |
.#innodb_temp |
InnoDB
internal_tmp_disk_storage_engine=InnoDB
--innodb-thread-concurrency=# | |
innodb_thread_concurrency | |
0 | |
0 | |
1000 |
InnoDB
InnoDB
InnoDB
queries in queue
counters
SHOW ENGINE INNODB STATUS
innodb_thread_concurrency
innodb_thread_concurrency=0
innodb_thread_concurrency=128
innodb_thread_concurrency=80
InnoDB
mysqld
mysqld
mysqld
innodb_thread_concurrency
innodb_thread_concurrency
innodb_thread_concurrency
--innodb-thread-sleep-delay=# | |
innodb_thread_sleep_delay | |
10000 | |
0 | |
1000000 |
InnoDB
innodb_adaptive_max_sleep_delay
InnoDB
--innodb-tmpdir=path | |
innodb_tmpdir | |
NULL |
ALTER
TABLE
ALTER TABLE
innodb_tmpdir
$TMPDIR
--tmpdir
SET
ALTER TABLE
innodb_tmpdir
tmpdir
ALTER TABLE
FILE
innodb_tmpdir
ALTER TABLE
innodb_tmpdir
ALTER TABLE
ALTER
TABLE
innodb_trx_purge_view_update_only_debug
--innodb-trx-purge-view-update-only-debug=# | |
innodb_trx_purge_view_update_only_debug | |
OFF |
WITH_DEBUG
--innodb-trx-rseg-n-slots-debug=# | |
innodb_trx_rseg_n_slots_debug | |
0 | |
1024 |
TRX_RSEG_N_SLOTS
WITH_DEBUG
--innodb-undo-directory=dir_name | |
innodb_undo_directory | |
InnoDB
innodb_rollback_segments
innodb_undo_tablespaces
datadir
--innodb-undo-log-encrypt=# | |
innodb_undo_log_encrypt | |
OFF |
InnoDB
--innodb-undo-log-truncate=# | |
innodb_undo_log_truncate | |
ON | |
OFF |
innodb_max_undo_log_size
innodb_purge_rseg_truncate_frequency
--innodb-undo-logs=# | |
innodb_undo_logs | |
128 | |
1 | |
128 |
innodb_undo_logs
innodb_undo_logs
innodb_rollback_segments
innodb_rollback_segments
--innodb-undo-tablespaces=# | |
innodb_undo_tablespaces | |
2 | |
0 | |
2 | |
0 | |
127 | |
95 |
InnoDB
innodb_undo_tablespaces
innodb_undo_tablespaces
innodb_undo_directory
NNN
NNN
innodb_page_size
innodb_undo_tablespaces
innodb_undo_tablespaces
innodb_undo_tablespaces
--innodb-use-native-aio=# | |
innodb_use_native_aio | |
ON |
InnoDB
InnoDB
EAGAIN:指定maxevents超过可用事件用户的限制。
/proc/sys/fs/aio-max-nr
InnoDB
innodb_use_native_aio=0
tmpdir
tmpfs
InnoDB
version
--innodb-write-io-threads=# | |
innodb_write_io_threads | |
4 | |
1 | |
64 |
InnoDB
innodb_read_io_threads
innodb_read_io_threads
aio-max-nr
sync_binlog
InnoDB
INFORMATION_SCHEMA
InnoDB
InnoDB
INFORMATION_SCHEMA
SHOW TABLES
mysql> SHOW TABLES FROM INFORMATION_SCHEMA LIKE 'INNODB%';
MySQL
InnoDB
INNODB_CMP
INNODB_CMP_RESET
INNODB_CMPMEM
INNODB_CMP_RESET
INNODB_CMP
INNODB_CMP_RESET
PAGE_SIZE
INNODB_CMP_RESET
INNODB_CMP_RESET
INNODB_CMP
INNODB_CMP_RESET
INNODB_CMPMEM
INNODB_CMPMEM_RESET
INNODB_CMP
INNODB_CMP_RESET
InnoDB
INNODB_CMPMEM
INNODB_CMPMEM_RESET
INNODB_CMPMEM_RESET
INNODB_CMPMEM_RESET
INNODB_CMPMEM_RESET
INNODB_CMPMEM
INNODB_CMP
INNODB_CMP_PER_INDEX
INNODB_CMPMEM
INFORMATION_SCHEMA.INNODB_CMP
COMPRESS_TIME
INNODB_CMPMEM
PAGE_SIZE
INNODB_CMPMEM
INFORMATION_SCHEMA.INNODB_CMPMEM
SUM(PAGE_SIZE*PAGES_FREE)=6784
(SUM(RELOCATION_TIME)=0)
data_locks
data_lock_waits
INNODB_LOCKS
INNODB_LOCK_WAITS
INFORMATION_SCHEMA
INNODB_TRX
InnoDB
data_locks
INNODB_TRX.TRX_STATE
LOCK WAIT
COMMITTING
INNODB_TRX.TRX_STATE
data_locks
data_lock_waits
BLOCKING_ENGINE_LOCK_ID
data_lock_waits
BLOCKING_ENGINE_LOCK_ID
data_locks
data_lock_waits
INNODB_LOCKS
INNODB_LOCK_WAITS
InnoDB
BEGIN; SELECT a FROM t FOR UPDATE; SELECT SLEEP(100);
SELECT b FROM t FOR UPDATE;
SELECT c FROM t FOR UPDATE;
SELECT r.trx_id waiting_trx_id, r.trx_mysql_thread_id waiting_thread, r.trx_query waiting_query, b.trx_id blocking_trx_id, b.trx_mysql_thread_id blocking_thread, b.trx_query blocking_query FROM performance_schema.data_lock_waits w INNER JOIN information_schema.innodb_trx b ON b.trx_id = w.blocking_engine_transaction_id INNER JOIN information_schema.innodb_trx r ON r.trx_id = w.requesting_engine_transaction_id;
sys
innodb_lock_waits
选择waiting_trx_id,waiting_pid,waiting_query,blocking_trx_id,blocking_pid,blocking_queryfrom sys.innodb_lock_waits;
A4 | 6 | SELECT b FROM t FOR UPDATE | A3 | 5 | SELECT SLEEP(100) |
A5 | 7 | SELECT c FROM t FOR UPDATE | A3 | 5 | SELECT SLEEP(100) |
A5 | 7 | SELECT c FROM t FOR UPDATE | A4 | 6 | SELECT b FROM t FOR UPDATE |
A4
A5
A3
INFORMATION_SCHEMA
INNODB_TRX
data_locks
data_lock_waits
INNODB_TRX
A3 | RUN-NING | 2008-01-15 16:44:54 | NULL | NULL | 2 | 5 | SELECT SLEEP(100) |
A4 | LOCK WAIT | 2008-01-15 16:45:09 | A4:1:3:2 | 2008-01-15 16:45:09 | 2 | 6 | SELECT b FROM t FOR UPDATE |
A5 | LOCK WAIT | 2008-01-15 16:45:14 | A5:1:3:2 | 2008-01-15 16:45:14 | 2 | 7 | SELECT c FROM t FOR UPDATE |
data_locks
A3:1:3:2 | A3 | X | RECORD | test | t | PRIMARY | 0x0200 |
A4:1:3:2 | A4 | X | RECORD | test | t | PRIMARY | 0x0200 |
A5:1:3:2 | A5 | X | RECORD | test | t | PRIMARY | 0x0200 |
data_lock_waits
sys.innodb_lock_waits
blocking_pid
threads
blocking_pid
SELECT THREAD_ID FROM performance_schema.threads WHERE PROCESSLIST_ID = 6;
THREAD_ID
events_statements_current
SELECT THREAD_ID, SQL_TEXT FROM performance_schema.events_statements_current WHERE THREAD_ID = 28\G
events_statements_history
SELECT THREAD_ID, SQL_TEXT FROM performance_schema.events_statements_history WHERE THREAD_ID = 28 ORDER BY EVENT_ID;
InnoDB
INFORMATION_SCHEMA
INNODB_TRX
data_locks
data_lock_waits
data_locks
data_lock_waits
INFORMATION_SCHEMA
PROCESSLIST
INNODB_TRX
PROCESSLIST
384 | root | localhost | test | Query | 10 | update | INSERT INTO t2 VALUES … |
257 | root | localhost | test | Query | 3 | update | INSERT INTO t2 VALUES … |
130 | root | localhost | test | Query | 0 | update | INSERT INTO t2 VALUES … |
61 | root | localhost | test | Query | 1 | update | INSERT INTO t2 VALUES … |
8 | root | localhost | test | Query | 1 | update | INSERT INTO t2 VALUES … |
4 | root | localhost | test | Query | 0 | preparing | SELECT * FROM PROCESSLIST |
2 | root | localhost | test | Sleep | 566 |
| NULL |
INNODB_TRX
77F | LOCK WAIT | 2008-01-15 13:10:16 | 77F | 2008-01-15 13:10:16 | 1 | 876 | INSERT INTO t09 (D, B, C) VALUES … |
77E | LOCK WAIT | 2008-01-15 13:10:16 | 77E | 2008-01-15 13:10:16 | 1 | 875 | INSERT INTO t09 (D, B, C) VALUES … |
77D | LOCK WAIT | 2008-01-15 13:10:16 | 77D | 2008-01-15 13:10:16 | 1 | 874 | INSERT INTO t09 (D, B, C) VALUES … |
77B | LOCK WAIT | 2008-01-15 13:10:16 | 77B:733:12:1 | 2008-01-15 13:10:16 | 4 | 873 | INSERT INTO t09 (D, B, C) VALUES … |
77A | RUN-NING | 2008-01-15 13:10:16 | NULL | NULL | 4 | 872 | SELECT b, c FROM t09 WHERE … |
E56 | LOCK WAIT | 2008-01-15 13:10:06 | E56:743:6:2 | 2008-01-15 13:10:06 | 5 | 384 | INSERT INTO t2 VALUES … |
E55 | LOCK WAIT | 2008-01-15 13:10:06 | E55:743:38:2 | 2008-01-15 13:10:13 | 965 | 257 | INSERT INTO t2 VALUES … |
19C | RUN-NING | 2008-01-15 13:09:10 | NULL | NULL | 2900 | 130 | INSERT INTO t2 VALUES … |
E15 | RUN-NING | 2008-01-15 13:08:59 | NULL | NULL | 5395 | 61 | INSERT INTO t2 VALUES … |
51D | RUN-NING | 2008-01-15 13:08:47 | NULL | NULL | 9807 | 8 | INSERT INTO t2 VALUES … |
data_lock_waits
77F | 77F:806 | 77E | 77E:806 |
77F | 77F:806 | 77D | 77D:806 |
77F | 77F:806 | 77B | 77B:806 |
77E | 77E:806 | 77D | 77D:806 |
77E | 77E:806 | 77B | 77B:806 |
77D | 77D:806 | 77B | 77B:806 |
77B | 77B:733:12:1 | 77A | 77A:733:12:1 |
E56 | E56:743:6:2 | E55 | E55:743:6:2 |
E55 | E55:743:38:2 | 19C | 19C:743:38:2 |
data_locks
77F:806 | 77F | AUTO_INC | TABLE | test | t09 | NULL | NULL |
77E:806 | 77E | AUTO_INC | TABLE | test | t09 | NULL | NULL |
77D:806 | 77D | AUTO_INC | TABLE | test | t09 | NULL | NULL |
77B:806 | 77B | AUTO_INC | TABLE | test | t09 | NULL | NULL |
77B:733:12:1 | 77B | X | RECORD | test | t09 | PRIMARY | supremum pseudo-record |
77A:733:12:1 | 77A | X | RECORD | test | t09 | PRIMARY | supremum pseudo-record |
E56:743:6:2 | E56 | S | RECORD | test | t2 | PRIMARY | 0, 0 |
E55:743:6:2 | E55 | X | RECORD | test | t2 | PRIMARY | 0, 0 |
E55:743:38:2 | E55 | S | RECORD | test | t2 | PRIMARY | 1922, 1922 |
19C:743:38:2 | 19C | X | RECORD | test | t2 | PRIMARY | 1922, 1922 |
data_locks
data_lock_waits
INNODB_LOCKS
INNODB_LOCK_WAITS
SELECT FOR UPDATE
InnoDB
RUNNING
INFORMATION_SCHEMA
INNODB_TRX
data_locks
data_lock_waits
data_locks
data_lock_waits
INNODB_LOCKS
INNODB_LOCK_WAITS
INFORMATION_SCHEMA
INNODB_TRX
data_locks
data_lock_waits
INNODB_TRX
data_locks
data_lock_waits
data_locks
data_lock_waits
INNODB_TRX
SELECT
data_locks
data_lock_waits
data_lock_waits
data_locks
INFORMATION_SCHEMA
PROCESSLIST
threads
InnoDB
PROCESSLIST
INNODB_TRX
PROCESSLIST
INNODB_TRX
PROCESSLIST
PROCESSLIST.INFO
InnoDB
INFORMATION_SCHEMA
InnoDB
SHOW ENGINE INNODB
STATUS
INFORMATION_SCHEMA
InnoDB
INNODB_DATAFILES INNODB_TABLESTATS INNODB_FOREIGN INNODB_COLUMNS INNODB_INDEXES INNODB_FIELDS INNODB_TABLESPACES INNODB_TABLESPACES_BRIEF INNODB_FOREIGN_COLS INNODB_TABLES
INNODB_TABLES
INNODB_COLUMNS
INNODB_INDEXES
INNODB_FIELDS
INNODB_TABLESTATS
INNODB_DATAFILES
INNODB_TABLESPACES
INNODB_TABLESPACES_BRIEF
INNODB_FOREIGN
INNODB_FOREIGN_COLS
InnoDB
TABLE_ID
SPACE
InnoDB
t1
InnoDB
t1
MySQL的> CREATE DATABASE test;
MySQL的> USE test;
MySQL的> CREATE TABLE t1 (
col1 INT,
col2 CHAR(10),
col3 VARCHAR(10))
ENGINE = InnoDB;
MySQL的> CREATE INDEX i1 ON t1(col1);
t1
INNODB_TABLES
mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLES WHERE NAME='test/t1' \G
*************************** 1. row ***************************
TABLE_ID: 71
NAME: test/t1
FLAG: 1
N_COLS: 6
SPACE: 57
ROW_FORMAT: Compact
ZIP_PAGE_SIZE: 0
INSTANT_COLS: 0
t1
FLAG
DB_ROW_ID
DB_ROLL_PTR
ROW_FORMAT
Compressed
ALTER
TABLE ... ADD COLUMN
ALGORITHM=INSTANT
TABLE_ID
INNODB_TABLES
INNODB_COLUMNS
MySQL的> SELECT * FROM INFORMATION_SCHEMA.INNODB_COLUMNS where TABLE_ID = 71\G
*************************** 1。行*************************** table_id:71名称:col1 POS:0 M型:6:1027:4 prtype Len has_default:0default_value:空*************************** 2。行*************************** table_id:71名称:COL2 POS:1米型:2:524542:10 prtype Len has_default:0default_value:空*************************** 3。行*************************** table_id:71名称:col3名次:2米型:1:524303:10 prtype Len has_default:0default_value:空
TABLE_ID
INNODB_COLUMNS
MTYPE
PRTYPE
LEN
DEFAULT_VALUE
ALGORITHM=INSTANT
TABLE_ID
INNODB_TABLES
INNODB_INDEXES
mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_INDEXES WHERE TABLE_ID = 71 \G
*************************** 1. row ***************************
INDEX_ID: 111
NAME: GEN_CLUST_INDEX
TABLE_ID: 71
TYPE: 1
N_FIELDS: 0
PAGE_NO: 3
SPACE: 57
MERGE_THRESHOLD: 50
*************************** 2. row ***************************
INDEX_ID: 112
NAME: i1
TABLE_ID: 71
TYPE: 0
N_FIELDS: 1
PAGE_NO: 4
SPACE: 57
MERGE_THRESHOLD: 50
INNODB_INDEXES
InnoDB
INDEX_ID
TYPE
value indicates the type of index (1 = Clustered Index, 0 = Secondary index). ThePAGE_NO
MERGE_THRESHOLD
INDEX_ID
INNODB_INDEXES
INNODB_FIELDS
mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_FIELDS where INDEX_ID = 112 \G
*************************** 1. row ***************************
INDEX_ID: 112
NAME: col1
POS: 0
INNODB_FIELDS
INNODB_FIELDS
SPACE
INNODB_TABLES
INNODB_TABLESPACES
MySQL的> SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE SPACE = 57 \G
*************************** 1。行***************************空间:57名:测试/ T1标志:16417 row_format:动态page_size:16384 zip_page_size:0 space_type:单fs_block_size:4096 file_size:114688allocated_size:98304server_version:8.0.4 space_version:1.
SPACE
INNODB_TABLESPACES
ROW_FORMAT
SPACE
INNODB_TABLES
INNODB_DATAFILES
MySQL的> SELECT * FROM INFORMATION_SCHEMA.INNODB_DATAFILES WHERE SPACE = 57 \G
*************************** 1。行***************************空间:57条路径:/测试/ t1.ibd。
test
DATA DIRECTORY
CREATE TABLE
t1
TABLE_ID = 71
INNODB_TABLESTATS
mysql>INSERT INTO t1 VALUES(5, 'abc', 'def');
Query OK, 1 row affected (0.06 sec) mysql>SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESTATS where TABLE_ID = 71 \G
*************************** 1. row *************************** TABLE_ID: 71 NAME: test/t1 STATS_INITIALIZED: Initialized NUM_ROWS: 1 CLUST_INDEX_SIZE: 1 OTHER_INDEX_SIZE: 0 MODIFIED_COUNTER: 1 AUTOINC: 0 REF_COUNT: 1
STATS_INITIALIZED
CLUST_INDEX_SIZE
MODIFIED_COUNTER
t1
INNODB_FOREIGN
INNODB_FOREIGN_COLS
INNODB_FOREIGN
INNODB_FOREIGN_COLS
mysql>CREATE DATABASE test;
mysql>USE test;
mysql>CREATE TABLE parent (id INT NOT NULL,
PRIMARY KEY (id)) ENGINE=INNODB;
mysql>CREATE TABLE child (id INT, parent_id INT,
INDEX par_ind (parent_id),
CONSTRAINT fk1
FOREIGN KEY (parent_id) REFERENCES parent(id)
ON DELETE CASCADE) ENGINE=INNODB;
INNODB_FOREIGN
test/parent
MySQL的> SELECT * FROM INFORMATION_SCHEMA.INNODB_FOREIGN \G
*************************** 1。行*************************** ID:测试/ fk1for_name:测试/ childref_name:测试/母n_cols:1型:1
ID
CONSTRAINT
REF_NAME
N_COLS
TYPE
INNODB_FOREIGN
ID
INNODB_FOREIGN_COLS
MySQL的> SELECT * FROM INFORMATION_SCHEMA.INNODB_FOREIGN_COLS WHERE ID = 'test/fk1' \G
*************************** 1。行*************************** ID:测试/ fk1for_col_name:parent_idref_col_name:ID名次:0
FOR_COL_NAME
POS
InnoDB
INNODB_TABLES
INNODB_TABLESPACES
INNODB_TABLESTATS
IF()
PAGE_SIZE
OTHER_INDEX_SIZE
ROUND()
MySQL的> SELECT a.NAME, a.ROW_FORMAT,
@page_size :=
IF(a.ROW_FORMAT='Compressed',
b.ZIP_PAGE_SIZE, b.PAGE_SIZE)
AS page_size,
ROUND((@page_size * c.CLUST_INDEX_SIZE)
/(1024*1024)) AS pk_mb,
ROUND((@page_size * c.OTHER_INDEX_SIZE)
/(1024*1024)) AS secidx_mb
FROM INFORMATION_SCHEMA.INNODB_TABLES a
INNER JOIN INFORMATION_SCHEMA.INNODB_TABLESPACES b on a.NAME = b.NAME
INNER JOIN INFORMATION_SCHEMA.INNODB_TABLESTATS c on b.NAME = c.NAME
WHERE a.NAME LIKE 'employees/%'
ORDER BY a.NAME DESC;
------------------------ ------------ ----------- ------- ----------- |名字| row_format | page_size | pk_mb | secidx_mb | ------------------------ ------------ ----------- ------- ----------- |员工/职称|动态| 16384 | 20 | 11 | |员工薪金|动态| 16384 | 93 | 34 | |员工/员工|动态| 16384 | 15 | 0 | |员工/ dept_manager |动态| 16384 | 0 0 | | |员工/ dept_emp |动态| 16384 | 12 |十| |员工/部门|动态| 16384 | 0 0 | | ------------------------ ------------ ----------- ------- -----------
FULLTEXT
MySQL的> SHOW TABLES FROM INFORMATION_SCHEMA LIKE 'INNODB_FT%';
表中的信息------------------------------------------- | _ _ _模式(FT | InnoDB _ %)------------------------------------------- | InnoDB _ FT _ InnoDB配置| | _ FT _被_消去| | InnoDB _ FT _消去| | InnoDB默认_ FT _ _ +屏蔽词| | InnoDB _ FT _指数_ | | InnoDB表_ FT _指数_ | -------------------------------------------缓存
INNODB_FT_CONFIG
InnoDB
INNODB_FT_BEING_DELETED
INNODB_FT_DELETED
OPTIMIZE
TABLE
OPTIMIZE TABLE
INNODB_FT_BEING_DELETED
INNODB_FT_DELETED
INNODB_FT_BEING_DELETED
OPTIMIZE TABLE
INNODB_FT_DELETED
InnoDB
FULLTEXT
OPTIMIZE TABLE
INNODB_FT_DEFAULT_STOPWORD
FULLTEXT
INNODB_FT_INDEX_TABLE
INNODB_FT_INDEX_CACHE
OPTIMIZE
TABLE
innodb_ft_cache_size
innodb_ft_total_cache_size
INNODB_FT_DEFAULT_STOPWORD
innodb_ft_aux_table
database_name
table_name
InnoDB
INFORMATION_SCHEMA
FULLTEXT
INFORMATION_SCHEMA
FULLTEXT
MySQL的> CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title,body)
) ENGINE=InnoDB;
MySQL的> INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
('MySQL vs. YourSQL','In the following database comparison ...'),
('MySQL Security','When configured properly, MySQL ...');
innodb_ft_aux_table
InnoDB
INFORMATION_SCHEMA
INNODB_FT_DEFAULT_STOPWORD
MySQL的> SET GLOBAL innodb_ft_aux_table = 'test/articles';
INNODB_FT_INDEX_CACHE
FULLTEXT
OPTIMIZE
TABLE
MySQL的> SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE LIMIT 5;
------------ -------------- ------------- ----------- -------- ---------- |字| first_doc_id | last_doc_id | doc_count | doc_id |位置| ------------ -------------- ------------- ----------- -------- ---------- | 1001 | 5 | 5 | 1 | 5 | 0 | |后| 3 | 3 | 1 | 3 | 22 | |比较| 6 | 6 1 6 44 | | | | |配置| 7 | 7 | 1 | 7 | 20 | |数据库| 2 | 6 | 2 | 2 | 31 | ------------ -------------- ------------- ----------- -------- ----------
innodb_optimize_fulltext_only
OPTIMIZE TABLE
FULLTEXT
innodb_optimize_fulltext_only
OPTIMIZE
TABLE
InnoDB
mysql>SET GLOBAL innodb_optimize_fulltext_only=ON;
Query OK, 0 rows affected (0.00 sec) mysql>OPTIMIZE TABLE articles;
+---------------+----------+----------+----------+ | Table | Op | Msg_type | Msg_text | +---------------+----------+----------+----------+ | test.articles | optimize | status | OK | +---------------+----------+----------+----------+
INNODB_FT_INDEX_TABLE
FULLTEXT
MySQL的> SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE LIMIT 5;
------------ -------------- ------------- ----------- -------- ---------- |字| first_doc_id | last_doc_id | doc_count | doc_id |位置| ------------ -------------- ------------- ----------- -------- ---------- | 1001 | 5 | 5 | 1 | 5 | 0 | |后| 3 | 3 | 1 | 3 | 22 | |比较| 6 | 6 1 6 44 | | | | |配置| 7 | 7 | 1 | 7 | 20 | |数据库| 2 | 6 | 2 | 2 | 31 | ------------ -------------- ------------- ----------- -------- ----------
INNODB_FT_INDEX_CACHE
OPTIMIZE
TABLE
mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE LIMIT 5;
Empty set (0.00 sec)
test/articles
MySQL的> DELETE FROM test.articles WHERE id < 4;
查询行,3行受影响(0.11秒)
INNODB_FT_DELETED
OPTIMIZE TABLE
MySQL的> SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED;
-------- | DOC _ ID | -------- | 2 3 4 | | | | | --------
OPTIMIZE TABLE
MySQL的> OPTIMIZE TABLE articles;
--------------- ---------- ---------- ---------- |表| OP | msg_type | msg_text | --------------- ---------- ---------- ---------- | test.articles |优化|状态|好| --------------- ---------- ---------- ----------
INNODB_FT_DELETED
MySQL的> SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED;
空集合(0秒)
INNODB_FT_CONFIG
optimize_checkpoint_limit
OPTIMIZE TABLE
synced_doc_id
stopword_table_name
database/table
use_stopword
mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG;
+---------------------------+-------+
| KEY | VALUE |
+---------------------------+-------+
| optimize_checkpoint_limit | 180 |
| synced_doc_id | 8 |
| stopword_table_name | |
| use_stopword | 1 |
+---------------------------+-------+
InnoDB
InnoDB
InnoDB
mysql> SHOW TABLES FROM INFORMATION_SCHEMA LIKE 'INNODB_BUFFER%';
+-----------------------------------------------+
| Tables_in_INFORMATION_SCHEMA (INNODB_BUFFER%) |
+-----------------------------------------------+
| INNODB_BUFFER_PAGE_LRU |
| INNODB_BUFFER_PAGE |
| INNODB_BUFFER_POOL_STATS |
+-----------------------------------------------+
INNODB_BUFFER_PAGE
INNODB_BUFFER_PAGE_LRU
INNODB_BUFFER_PAGE_LRU
INNODB_BUFFER_PAGE
INNODB_BUFFER_PAGE_LRU
BLOCK_ID
INNODB_BUFFER_POOL_STATS
SHOW ENGINE
INNODB STATUS
INNODB_BUFFER_PAGE
INNODB_BUFFER_PAGE_LRU
TABLE_NAME
/
mysql>SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE TABLE_NAME IS NULL OR (INSTR(TABLE_NAME, '/') = 0 AND INSTR(TABLE_NAME, '.') = 0);
+----------+ | COUNT(*) | +----------+ | 1516 | +----------+
mysql>SELECT
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE TABLE_NAME IS NULL OR (INSTR(TABLE_NAME, '/') = 0 AND INSTR(TABLE_NAME, '.') = 0)
) AS system_pages,
(
SELECT COUNT(*)
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
) AS total_pages,
(
SELECT ROUND((system_pages/total_pages) * 100)
) AS system_page_percentage;
+--------------+-------------+------------------------+ | system_pages | total_pages | system_page_percentage | +--------------+-------------+------------------------+ | 295 | 8192 | 4 | +--------------+-------------+------------------------+
PAGE_TYPE
mysql>SELECT DISTINCT PAGE_TYPE FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE TABLE_NAME IS NULL OR (INSTR(TABLE_NAME, '/') = 0 AND INSTR(TABLE_NAME, '.') = 0);
+-------------------+ | PAGE_TYPE | +-------------------+ | SYSTEM | | IBUF_BITMAP | | UNKNOWN | | FILE_SPACE_HEADER | | INODE | | UNDO_LOG | | ALLOCATED | +-------------------+
TABLE_NAME
NOT LIKE
'%INNODB_TABLES%'
MySQL的> SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE TABLE_NAME IS NOT NULL AND TABLE_NAME NOT LIKE '%INNODB_TABLES%';
---------- |计数(*)| ---------- | 7897 | ----------
mysql>SELECT
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE TABLE_NAME IS NOT NULL AND (INSTR(TABLE_NAME, '/') > 0 OR INSTR(TABLE_NAME, '.') > 0)) AS user_pages,
(
SELECT COUNT(*)
FROM information_schema.INNODB_BUFFER_PAGE
) AS total_pages,
(
SELECT ROUND((user_pages/total_pages) * 100)
) AS user_page_percentage;
+------------+-------------+----------------------+ | user_pages | total_pages | user_page_percentage | +------------+-------------+----------------------+ | 7897 | 8192 | 96 | +------------+-------------+----------------------+
mysql>SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE TABLE_NAME IS NOT NULL AND (INSTR(TABLE_NAME, '/') > 0 OR INSTR(TABLE_NAME, '.') > 0)
AND TABLE_NAME NOT LIKE '`mysql`.`innodb_%';
+-------------------------+ | TABLE_NAME | +-------------------------+ | `employees`.`salaries` | | `employees`.`employees` | +-------------------------+
INDEX_NAME
employees.salaries
MySQL的> SELECT INDEX_NAME, COUNT(*) AS Pages,
ROUND(SUM(IF(COMPRESSED_SIZE = 0, @@global.innodb_page_size, COMPRESSED_SIZE))/1024/1024)
AS 'Total Data (MB)'
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE INDEX_NAME='emp_no' AND TABLE_NAME = '`employees`.`salaries`';
| ------------ ------- -----------------总指数数据页| | _ name(MB)| ------------ ------- ----------------- | EMP _不| 1609 | 25 | ------------ -------;
employees.salaries
MySQL的> SELECT INDEX_NAME, COUNT(*) AS Pages,
ROUND(SUM(IF(COMPRESSED_SIZE = 0, @@global.innodb_page_size, COMPRESSED_SIZE))/1024/1024)
AS 'Total Data (MB)'
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE TABLE_NAME = '`employees`.`salaries`'
GROUP BY INDEX_NAME;
------------ ------- ----------------- | index_name |页|总数据(MB)| ------------ ------- ----------------- | emp_no | 1608 | 25 | |初级| 6086 | 95 | ------------ ------- -----------------
INNODB_BUFFER_PAGE_LRU
INNODB_BUFFER_PAGE
BLOCK_ID
employees.employees
MySQL的> SELECT COUNT(LRU_POSITION) FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU
WHERE TABLE_NAME='`employees`.`employees`' AND LRU_POSITION < 3072;
--------------------- |计数(lru_position)| --------------------- | 548 | ---------------------
INNODB_BUFFER_POOL_STATS
SHOW ENGINE INNODB
STATUS
mysql> SELECT * FROM information_schema.INNODB_BUFFER_POOL_STATS \G
*************************** 1. row ***************************
POOL_ID: 0
POOL_SIZE: 8192
FREE_BUFFERS: 1
DATABASE_PAGES: 8173
OLD_DATABASE_PAGES: 3014
MODIFIED_DATABASE_PAGES: 0
PENDING_DECOMPRESS: 0
PENDING_READS: 0
PENDING_FLUSH_LRU: 0
PENDING_FLUSH_LIST: 0
PAGES_MADE_YOUNG: 15907
PAGES_NOT_MADE_YOUNG: 3803101
PAGES_MADE_YOUNG_RATE: 0
PAGES_MADE_NOT_YOUNG_RATE: 0
NUMBER_PAGES_READ: 3270
NUMBER_PAGES_CREATED: 13176
NUMBER_PAGES_WRITTEN: 15109
PAGES_READ_RATE: 0
PAGES_CREATE_RATE: 0
PAGES_WRITTEN_RATE: 0
NUMBER_PAGES_GET: 33069332
HIT_RATE: 0
YOUNG_MAKE_PER_THOUSAND_GETS: 0
NOT_YOUNG_MAKE_PER_THOUSAND_GETS: 0
NUMBER_PAGES_READ_AHEAD: 2713
NUMBER_READ_AHEAD_EVICTED: 0
READ_AHEAD_RATE: 0
READ_AHEAD_EVICTED_RATE: 0
LRU_IO_TOTAL: 0
LRU_IO_CURRENT: 0
UNCOMPRESS_TOTAL: 0
UNCOMPRESS_CURRENT: 0
SHOW ENGINE INNODB
STATUS
SHOW ENGINE INNODB
STATUS
mysql> SHOW ENGINE INNODB STATUS \G
...
----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 137428992
Dictionary memory allocated 579084
Buffer pool size 8192
Free buffers 1
Database pages 8173
Old database pages 3014
Modified db pages 0
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 15907, not young 3803101
0.00 youngs/s, 0.00 non-youngs/s
Pages read 3270, created 13176, written 15109
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 8173, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
...
mysql> SHOW STATUS LIKE 'Innodb_buffer%';
+---------------------------------------+-------------+
| Variable_name | Value |
+---------------------------------------+-------------+
| Innodb_buffer_pool_dump_status | not started |
| Innodb_buffer_pool_load_status | not started |
| Innodb_buffer_pool_resize_status | not started |
| Innodb_buffer_pool_pages_data | 8173 |
| Innodb_buffer_pool_bytes_data | 133906432 |
| Innodb_buffer_pool_pages_dirty | 0 |
| Innodb_buffer_pool_bytes_dirty | 0 |
| Innodb_buffer_pool_pages_flushed | 15109 |
| Innodb_buffer_pool_pages_free | 1 |
| Innodb_buffer_pool_pages_misc | 18 |
| Innodb_buffer_pool_pages_total | 8192 |
| Innodb_buffer_pool_read_ahead_rnd | 0 |
| Innodb_buffer_pool_read_ahead | 2713 |
| Innodb_buffer_pool_read_ahead_evicted | 0 |
| Innodb_buffer_pool_read_requests | 33069332 |
| Innodb_buffer_pool_reads | 558 |
| Innodb_buffer_pool_wait_free | 0 |
| Innodb_buffer_pool_write_requests | 11985961 |
+---------------------------------------+-------------+
INNODB_METRICS
INNODB_METRICS
mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts" \G
*************************** 1. row ***************************
NAME: dml_inserts
SUBSYSTEM: dml
COUNT: 46273
MAX_COUNT: 46273
MIN_COUNT: NULL
AVG_COUNT: 492.2659574468085
COUNT_RESET: 46273
MAX_COUNT_RESET: 46273
MIN_COUNT_RESET: NULL
AVG_COUNT_RESET: NULL
TIME_ENABLED: 2014-11-28 16:07:53
TIME_DISABLED: NULL
TIME_ELAPSED: 94
TIME_RESET: NULL
STATUS: enabled
TYPE: status_counter
COMMENT: Number of rows inserted
innodb_monitor_enable
SET GLOBAL innodb_monitor_enable = [counter-name|module_name|pattern|all];
innodb_monitor_disable
SET GLOBAL innodb_monitor_disable = [counter-name|module_name|pattern|all];
innodb_monitor_reset
SET GLOBAL innodb_monitor_reset = [counter-name|module_name|pattern|all];
innodb_monitor_reset_all
innodb_monitor_reset_all
SET GLOBAL innodb_monitor_reset_all = [counter-name|module_name|pattern|all];
log
metadata_table_handles_closed
my.cnf
[mysqld]innodb_monitor_enable = module_recovery,metadata_table_handles_opened,metadata_table_handles_closed
innodb_monitor_enable
innodb_monitor_enable
INNODB_METRICS
SHOW ENGINE INNODB
STATUS
SHOW ENGINE INNODB
STATUS
INNODB_METRICS
INNODB_METRICS
INNODB_METRICS
MySQL的> SELECT name, subsystem, status FROM INFORMATION_SCHEMA.INNODB_METRICS ORDER BY NAME;
子系统名称------------------------------------------ ------------------------选择| | |状态自适应选择| ------------------------------------------ ------------------------ | _哈希_页面添加_ _ |自适应哈希指数| _残疾人| |自适应哈希_页面删除_ _ |自适应哈希指数_ _ |残疾人| _ |自适应哈希_ rows _增值|自适应_ _ |残疾人|哈希指数|自适应_ _ rows删除哈希散列_ _ _ NO _收|自适应哈希指数_ _ |残疾人| |自适应_ _ _ rows删除哈希散列索引|自适应_ _ |残疾人| |自适应_ _ rows _ |自适应更新哈希哈希索引_ _ |残疾人| | _ _ |自适应哈希搜索自适应散列索引_ _ | | |启用自适应哈希搜索_ _ _ btree指数_ |自适应哈希_ |启用缓冲数据读取| | _ _ |启用缓冲数据缓冲区| | | _ _写缓冲功能的| | | | _冲洗_自适应缓冲缓冲区缓冲区残疾人| | | | _冲洗_自适应_ AVG _护照|缓冲缓冲|残疾人| | _冲洗_自适应_ AVG _ _ EST |缓冲时间缓冲|残疾人| | _冲洗_自适应_ AVG _时_ |缓冲槽|残疾人| |缓冲_ _自适应_ AVG _冲洗时间_ | |残疾人线程缓冲缓冲| | _冲洗_自适应_页面缓冲| |残疾人| |缓冲_冲洗_完全自适应_ _页面缓冲| |残疾人| |缓冲_冲洗_ AVG _页缓冲_率| |残疾人| |缓冲_冲洗_ AVG _ |缓冲|残疾人| |护照_冲洗缓冲时间缓冲_ AVG _ | |残疾人| |缓冲_冲洗_背景|缓冲缓冲|残疾人| | _冲洗_背景_页面缓冲| |残疾人| |缓冲_冲洗_背景_完全_页面缓冲| |残疾人| |缓冲_ _ |批量冲洗缓冲区缓冲区残疾人| | | _间歇冲洗_ _ Num _扫描|缓冲缓冲|残疾人| | _间歇冲洗_ _页面缓冲| |残疾人| |缓冲_间歇冲洗_ _扫描|缓冲缓冲|残疾人| | _间歇冲洗_ _扫描_呼叫通过_ | |残疾人| |缓冲器缓冲器_间歇冲洗_ _完全_页面缓冲| |残疾人| |缓冲_冲洗_ lsn _ AVG _率|缓冲缓冲|残疾人| | _冲洗_近邻|缓冲缓冲|残疾人| | _冲洗_近邻_页面缓冲| |残疾人| |缓冲_冲洗_近邻_完全| _页面缓冲|残疾人| |缓冲_冲洗冲洗_ _ N到_ _ red _时代|缓冲缓冲|残疾人| | _冲洗冲洗_ _ N到_ _请求缓冲| |残疾人| |缓冲_冲洗肮脏的_ PCT _ _ | |禁用缓存
SUBSYSTEM
INNODB_METRICS
dml
MySQL的> SET GLOBAL innodb_monitor_enable = module_dml;
MySQL的> SELECT name, subsystem, status FROM INFORMATION_SCHEMA.INNODB_METRICS
WHERE subsystem ='dml';
------------- ----------- --------- |名字|子系统|状态| ------------- ----------- --------- | dml_reads | DML |启用| | dml_inserts | DML |启用| | dml_deletes | DML |启用| | dml_updates | DML |启用| ------------- ----------- ---------
module_name
innodb_monitor_enable
module_adaptive_hash
(subsystem =
module_buffer
(subsystem =
module_buffer_page
(subsystem =
module_compress
(subsystem =
module_ddl
(subsystem =
module_dml
(subsystem =
module_file
(subsystem =
module_ibuf_system
(subsystem =
module_icp
(subsystem =
module_index
(subsystem =
module_innodb
(subsystem =
module_lock
(subsystem =
module_log
(subsystem =
module_metadata
(subsystem =
module_os
(subsystem =
module_purge
(subsystem =
module_trx
(subsystem =
INNODB_METRICS
InnoDB
MySQL的> USE test;
数据库changedmysql > CREATE TABLE t1 (c1 INT) ENGINE=INNODB;
查询行,0行受影响(0.02秒)
dml_inserts
MySQL的> SET GLOBAL innodb_monitor_enable = dml_inserts;
查询行,0行受影响(0.01秒)
dml_inserts
INNODB_METRICS
MySQL的> SELECT NAME, COMMENT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts";
------------- ------------------------- |名字|评论| ------------- ------------------------- | dml_inserts |行数插入| ------------- -------------------------
INNODB_METRICS
TIME_ENABLED
mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts" \G
*************************** 1. row ***************************
NAME: dml_inserts
SUBSYSTEM: dml
COUNT: 0
MAX_COUNT: 0
MIN_COUNT: NULL
AVG_COUNT: 0
COUNT_RESET: 0
MAX_COUNT_RESET: 0
MIN_COUNT_RESET: NULL
AVG_COUNT_RESET: NULL
TIME_ENABLED: 2014-12-04 14:18:28
TIME_DISABLED: NULL
TIME_ELAPSED: 28
TIME_RESET: NULL
STATUS: enabled
TYPE: status_counter
COMMENT: Number of rows inserted
mysql>INSERT INTO t1 values(1);
Query OK, 1 row affected (0.00 sec) mysql>INSERT INTO t1 values(2);
Query OK, 1 row affected (0.00 sec) mysql>INSERT INTO t1 values(3);
Query OK, 1 row affected (0.00 sec)
INNODB_METRICS
COUNT
AVG_COUNT
INNODB_METRICS
MySQL的> SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts"\G
×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××1。××××××××××××××××××××××××一×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××:子系统名称:DML DML:_刀片3计数最大计数:3分钟_ _计数:计数:计数零平均_ 0.046153846153846156 _ _计数复位:复位:3max _ _ 3min _计数计数复位:复位:nullavg _ _零时间:2014年启用_—12—04 28 14 18队球队_ _残疾人:空运行时间:时间:_ 65复位启用状态:零状态_型:评论:插入的行数计数器
dml_inserts
INNODB_METRICS
%_RESET
MAX_RESET
MAX_COUNT
mysql>SET GLOBAL innodb_monitor_reset = dml_inserts;
Query OK, 0 rows affected (0.00 sec) mysql>SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts"\G
*************************** 1. row *************************** NAME: dml_inserts SUBSYSTEM: dml COUNT: 3 MAX_COUNT: 3 MIN_COUNT: NULL AVG_COUNT: 0.03529411764705882 COUNT_RESET: 0 MAX_COUNT_RESET: 0 MIN_COUNT_RESET: NULL AVG_COUNT_RESET: 0 TIME_ENABLED: 2014-12-04 14:18:28 TIME_DISABLED: NULL TIME_ELAPSED: 85 TIME_RESET: 2014-12-04 14:19:44 STATUS: enabled TYPE: status_counter COMMENT: Number of rows inserted
STATUS
mysql>SET GLOBAL innodb_monitor_disable = dml_inserts;
Query OK, 0 rows affected (0.00 sec) mysql>SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts"\G
*************************** 1. row *************************** NAME: dml_inserts SUBSYSTEM: dml COUNT: 3 MAX_COUNT: 3 MIN_COUNT: NULL AVG_COUNT: 0.030612244897959183 COUNT_RESET: 0 MAX_COUNT_RESET: 0 MIN_COUNT_RESET: NULL AVG_COUNT_RESET: 0 TIME_ENABLED: 2014-12-04 14:18:28 TIME_DISABLED: 2014-12-04 14:20:06 TIME_ELAPSED: 98 TIME_RESET: NULL STATUS: disabled TYPE: status_counter COMMENT: Number of rows inserted
dml_inserts
dml_%
innodb_monitor_reset_all
MySQL的> SET GLOBAL innodb_monitor_reset_all = dml_inserts;
查询好,为受影响的行(0.001秒)MySQL > SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts"\G
×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××1。××××××××××××××××××××××××一×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××:子系统名称:DML DML:_插入计数最大计数为0 _空:空_字数:字数:AVG _ _零计数计数复位:复位:0max _ _ nullmin _ _计数计数复位:复位:nullavg _ _启用时间:时间_空空空的时间运行时间的设置:_ _:空:空时_复位状态设置状态:评论:_型:插入的行数计数器
INNODB_TEMP_TABLE_INFO
InnoDB
mysql> SHOW TABLES FROM INFORMATION_SCHEMA LIKE 'INNODB_TEMP%';
+---------------------------------------------+
| Tables_in_INFORMATION_SCHEMA (INNODB_TEMP%) |
+---------------------------------------------+
| INNODB_TEMP_TABLE_INFO |
+---------------------------------------------+
INNODB_TEMP_TABLE_INFO
InnoDB
MySQL的> CREATE TEMPORARY TABLE t1 (c1 INT PRIMARY KEY) ENGINE=INNODB;
INNODB_TEMP_TABLE_INFO
MySQL的> SELECT * FROM INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO\G
*************************** 1。行*************************** table_id:194名称:# sql7a79_1_0 n_cols:4空间:182
TABLE_ID
N_COLS
DB_ROW_ID
DB_ROLL_PTR
INNODB_TEMP_TABLE_INFO
MySQL的> SELECT * FROM INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO\G
INNODB_TEMP_TABLE_INFO
mysql> CREATE TEMPORARY TABLE t1 (c1 INT PRIMARY KEY) ENGINE=INNODB;
INNODB_TEMP_TABLE_INFO
MySQL的> SELECT * FROM INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO\G
*************************** 1。行*************************** table_id:196名称:# sql7b0e_1_0 n_cols:4空间:184
SPACE
INFORMATION_SCHEMA.FILES
InnoDB
INFORMATION_SCHEMA.FILES
INNODB_TABLESPACES
INNODB_DATAFILES
InnoDB
INFORMATION_SCHEMA.FILES
INFORMATION_SCHEMA.FILES
mysql>SELECT FILE_ID, FILE_NAME, FILE_TYPE, TABLESPACE_NAME, FREE_EXTENTS,
TOTAL_EXTENTS, EXTENT_SIZE, INITIAL_SIZE, MAXIMUM_SIZE, AUTOEXTEND_SIZE, DATA_FREE, STATUS ENGINE
FROM INFORMATION_SCHEMA.FILES WHERE TABLESPACE_NAME LIKE 'innodb_system' \G
*************************** 1. row *************************** FILE_ID: 0 FILE_NAME: ./ibdata1 FILE_TYPE: TABLESPACE TABLESPACE_NAME: innodb_system FREE_EXTENTS: 0 TOTAL_EXTENTS: 12 EXTENT_SIZE: 1048576 INITIAL_SIZE: 12582912 MAXIMUM_SIZE: NULL AUTOEXTEND_SIZE: 67108864 DATA_FREE: 4194304 ENGINE: NORMAL
FILE_ID
InnoDB
mysql>SELECT FILE_ID, FILE_NAME FROM INFORMATION_SCHEMA.FILES
WHERE FILE_NAME LIKE '%.ibd%' ORDER BY FILE_ID;
+---------+---------------------------------------+ | FILE_ID | FILE_NAME | +---------+---------------------------------------+ | 2 | ./mysql/plugin.ibd | | 3 | ./mysql/servers.ibd | | 4 | ./mysql/help_topic.ibd | | 5 | ./mysql/help_category.ibd | | 6 | ./mysql/help_relation.ibd | | 7 | ./mysql/help_keyword.ibd | | 8 | ./mysql/time_zone_name.ibd | | 9 | ./mysql/time_zone.ibd | | 10 | ./mysql/time_zone_transition.ibd | | 11 | ./mysql/time_zone_transition_type.ibd | | 12 | ./mysql/time_zone_leap_second.ibd | | 13 | ./mysql/innodb_table_stats.ibd | | 14 | ./mysql/innodb_index_stats.ibd | | 15 | ./mysql/slave_relay_log_info.ibd | | 16 | ./mysql/slave_master_info.ibd | | 17 | ./mysql/slave_worker_info.ibd | | 18 | ./mysql/gtid_executed.ibd | | 19 | ./mysql/server_cost.ibd | | 20 | ./mysql/engine_cost.ibd | | 21 | ./sys/sys_config.ibd | | 23 | ./test/t1.ibd | | 26 | /home/user/test/test/t2.ibd | +---------+---------------------------------------+
FILE_ID
InnoDB
mysql>SELECT FILE_ID, FILE_NAME FROM INFORMATION_SCHEMA.FILES
WHERE FILE_NAME LIKE '%ibtmp%';
+---------+-----------+ | FILE_ID | FILE_NAME | +---------+-----------+ | 22 | ./ibtmp1 | +---------+-----------+
InnoDB
FILE_ID
InnoDB
MySQL的> SELECT FILE_ID, FILE_NAME FROM INFORMATION_SCHEMA.FILES
WHERE FILE_NAME LIKE '%undo%';
InnoDB
InnoDB
InnoDB
performance_schema
InnoDB
setup_instruments
mysql> SELECT * FROM setup_instruments WHERE NAME LIKE '%innodb%';
+-------------------------------------------------------+---------+-------+
| NAME | ENABLED | TIMED |
+-------------------------------------------------------+---------+-------+
| wait/synch/mutex/innodb/commit_cond_mutex | NO | NO |
| wait/synch/mutex/innodb/innobase_share_mutex | NO | NO |
| wait/synch/mutex/innodb/autoinc_mutex | NO | NO |
| wait/synch/mutex/innodb/buf_pool_mutex | NO | NO |
| wait/synch/mutex/innodb/buf_pool_zip_mutex | NO | NO |
| wait/synch/mutex/innodb/cache_last_read_mutex | NO | NO |
| wait/synch/mutex/innodb/dict_foreign_err_mutex | NO | NO |
| wait/synch/mutex/innodb/dict_sys_mutex | NO | NO |
| wait/synch/mutex/innodb/recalc_pool_mutex | NO | NO |
...
| wait/io/file/innodb/innodb_data_file | YES | YES |
| wait/io/file/innodb/innodb_log_file | YES | YES |
| wait/io/file/innodb/innodb_temp_file | YES | YES |
| stage/innodb/alter table (end) | YES | YES |
| stage/innodb/alter table (flush) | YES | YES |
| stage/innodb/alter table (insert) | YES | YES |
| stage/innodb/alter table (log apply index) | YES | YES |
| stage/innodb/alter table (log apply table) | YES | YES |
| stage/innodb/alter table (merge sort) | YES | YES |
| stage/innodb/alter table (read PK and internal sort) | YES | YES |
| stage/innodb/buffer pool load | YES | YES |
| memory/innodb/buf_buf_pool | NO | NO |
| memory/innodb/dict_stats_bg_recalc_pool_t | NO | NO |
| memory/innodb/dict_stats_index_map_t | NO | NO |
| memory/innodb/dict_stats_n_diff_on_level | NO | NO |
| memory/innodb/other | NO | NO |
| memory/innodb/row_log_buf | NO | NO |
| memory/innodb/row_merge_sort | NO | NO |
| memory/innodb/std | NO | NO |
| memory/innodb/sync_debug_latches | NO | NO |
| memory/innodb/trx_sys_t::rw_trx_ids | NO | NO |
...
+-------------------------------------------------------+---------+-------+
155 rows in set (0.00 sec)
InnoDB
InnoDB
InnoDB
InnoDB
MySQL的> SELECT * FROM file_instances WHERE EVENT_NAME LIKE '%innodb%'\G
* * * * * * * * * * * * * * * * * * * * * * * * * * * 1。行* * * * * * * * * * * * * * * * * * * * * * * * * * * _ /路径/文件名:8.0 - to / MySQL /日期/ ibdata1event _ name:/我/文件/等/ InnoDB数据_ InnoDB _ FileOpen _ count:3 * * * * * * * * * * * * * * * * * * * * * * * * * * * 2。行* * * * * * * * * * * * * * * * * * * * * * * * * * * _ /路径/文件名:8.0 - to / MySQL /日期/ IB _ logfile0event _ name:等我/ / / / _ InnoDB InnoDB日志文件_ FileOpen _ count 2:* * * * * * * * * * * * * * * * * * * * * * * * * * * 3。行* * * * * * * * * * * * * * * * * * * * * * * * * * * _ /路径/文件名:8.0 - to / MySQL /日期/ IB _ logfile1event _ name:等我/ / / / _ InnoDB InnoDB日志文件_ FileOpen _ count 2:* * * * * * * * * * * * * * * * * * * * * * * * * * * 4。行* * * * * * * * * * * * * * * * * * * * * * * * * * * _ /路径/文件名:8.0 - to / MySQL /发动机/ MySQL /日期等_ cost.ibdevent _ name:文件/ / / /我InnoDB数据_ InnoDB _ FileOpen _ count:3。
performance_schema
InnoDB
InnoDB
ALTER
TABLE
InnoDB
WHERE NAME LIKE
'%innodb%'
ALTER TABLE
ALTER TABLE
WORK_ESTIMATED
ALTER TABLE
ALTER TABLE
ALTER TABLE
WORK_ESTIMATED
ALTER TABLE
ALTER TABLE
stage/innodb/alter table (read PK and internal
sort)
ALTER TABLE
WORK_COMPLETED=0
WORK_ESTIMATED
stage/innodb/alter table (merge sort)
ALTER TABLE
stage/innodb/alter table (insert)
ALTER TABLE
stage/innodb/alter table (log apply index)
ALTER TABLE
stage/innodb/alter table (flush)
stage/innodb/alter table (log apply table)
ALTER TABLE
stage/innodb/alter table (end)
ALTER TABLE
InnoDB
ALTER
TABLE
stage/innodb/alter table%
ALTER TABLE
stage/innodb/alter%
MySQL的> UPDATE setup_instruments SET ENABLED = 'YES' WHERE NAME LIKE 'stage/innodb/alter%';
查询行,7行受影响(0秒)的行匹配:7改变:7警告:0
events_stages_current
events_stages_history
events_stages_history_long
MySQL的> UPDATE setup_consumers SET ENABLED = 'YES' WHERE NAME LIKE '%stages%';
查询行,3行受影响(0秒)的行匹配:3改变:3警告:0
ALTER TABLE
mysql> ALTER TABLE employees.employees ADD COLUMN middle_name varchar(14) AFTER first_name;
Query OK, 0 rows affected (9.27 sec)
Records: 0 Duplicates: 0 Warnings: 0
ALTER
TABLE
events_stages_current
ALTER TABLE
WORK_ESTIMATED
MySQL的> SELECT EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED FROM events_stages_current;
------------------------------------------------------ ---------------- ---------------- | event_name | work_completed | work_estimated | ------------------------------------------------------ ---------------- ---------------- |阶段/ InnoDB /修改表(读PK和内部排序)| 280 | 1245 | ------------------------------------------------------ ---------------- ----------------一行集(0.01秒)
events_stages_current
ALTER
TABLE
events_stages_history
MySQL的> SELECT EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED FROM events_stages_history;
------------------------------------------------------ ---------------- ---------------- | event_name | work_completed | work_estimated | ------------------------------------------------------ ---------------- ---------------- |阶段/ InnoDB /修改表(读PK和内部排序)| 886 | 1213 | |阶段/ InnoDB /修改表(冲洗)| 1213 | 1213 | |阶段/ InnoDB /修改表(日志申请表)| 1597 | 1597 | |阶段/ InnoDB /修改表(结束)| 1597 | 1597 | |阶段/ InnoDB /修改表(日志申请表)| 1981 | 1981 | ------------------------------------------------------ ---------------- ---------------- 5行集(0秒)
WORK_ESTIMATED
ALTER TABLE
InnoDB
InnoDB
InnoDB
setup_instruments
mysql>SELECT * FROM performance_schema.setup_instruments
WHERE NAME LIKE '%wait/synch/mutex/innodb%';
+---------------------------------------------------------+---------+-------+ | NAME | ENABLED | TIMED | +---------------------------------------------------------+---------+-------+ | wait/synch/mutex/innodb/commit_cond_mutex | NO | NO | | wait/synch/mutex/innodb/innobase_share_mutex | NO | NO | | wait/synch/mutex/innodb/autoinc_mutex | NO | NO | | wait/synch/mutex/innodb/autoinc_persisted_mutex | NO | NO | | wait/synch/mutex/innodb/buf_pool_flush_state_mutex | NO | NO | | wait/synch/mutex/innodb/buf_pool_LRU_list_mutex | NO | NO | | wait/synch/mutex/innodb/buf_pool_free_list_mutex | NO | NO | | wait/synch/mutex/innodb/buf_pool_zip_free_mutex | NO | NO | | wait/synch/mutex/innodb/buf_pool_zip_hash_mutex | NO | NO | | wait/synch/mutex/innodb/buf_pool_zip_mutex | NO | NO | | wait/synch/mutex/innodb/cache_last_read_mutex | NO | NO | | wait/synch/mutex/innodb/dict_foreign_err_mutex | NO | NO | | wait/synch/mutex/innodb/dict_persist_dirty_tables_mutex | NO | NO | | wait/synch/mutex/innodb/dict_sys_mutex | NO | NO | | wait/synch/mutex/innodb/recalc_pool_mutex | NO | NO | | wait/synch/mutex/innodb/fil_system_mutex | NO | NO | | wait/synch/mutex/innodb/flush_list_mutex | NO | NO | | wait/synch/mutex/innodb/fts_bg_threads_mutex | NO | NO | | wait/synch/mutex/innodb/fts_delete_mutex | NO | NO | | wait/synch/mutex/innodb/fts_optimize_mutex | NO | NO | | wait/synch/mutex/innodb/fts_doc_id_mutex | NO | NO | | wait/synch/mutex/innodb/log_flush_order_mutex | NO | NO | | wait/synch/mutex/innodb/hash_table_mutex | NO | NO | | wait/synch/mutex/innodb/ibuf_bitmap_mutex | NO | NO | | wait/synch/mutex/innodb/ibuf_mutex | NO | NO | | wait/synch/mutex/innodb/ibuf_pessimistic_insert_mutex | NO | NO | | wait/synch/mutex/innodb/log_sys_mutex | NO | NO | | wait/synch/mutex/innodb/log_sys_write_mutex | NO | NO | | wait/synch/mutex/innodb/mutex_list_mutex | NO | NO | | wait/synch/mutex/innodb/page_zip_stat_per_index_mutex | NO | NO | | wait/synch/mutex/innodb/purge_sys_pq_mutex | NO | NO | | wait/synch/mutex/innodb/recv_sys_mutex | NO | NO | | wait/synch/mutex/innodb/recv_writer_mutex | NO | NO | | wait/synch/mutex/innodb/redo_rseg_mutex | NO | NO | | wait/synch/mutex/innodb/noredo_rseg_mutex | NO | NO | | wait/synch/mutex/innodb/rw_lock_list_mutex | NO | NO | | wait/synch/mutex/innodb/rw_lock_mutex | NO | NO | | wait/synch/mutex/innodb/srv_dict_tmpfile_mutex | NO | NO | | wait/synch/mutex/innodb/srv_innodb_monitor_mutex | NO | NO | | wait/synch/mutex/innodb/srv_misc_tmpfile_mutex | NO | NO | | wait/synch/mutex/innodb/srv_monitor_file_mutex | NO | NO | | wait/synch/mutex/innodb/buf_dblwr_mutex | NO | NO | | wait/synch/mutex/innodb/trx_undo_mutex | NO | NO | | wait/synch/mutex/innodb/trx_pool_mutex | NO | NO | | wait/synch/mutex/innodb/trx_pool_manager_mutex | NO | NO | | wait/synch/mutex/innodb/srv_sys_mutex | NO | NO | | wait/synch/mutex/innodb/lock_mutex | NO | NO | | wait/synch/mutex/innodb/lock_wait_mutex | NO | NO | | wait/synch/mutex/innodb/trx_mutex | NO | NO | | wait/synch/mutex/innodb/srv_threads_mutex | NO | NO | | wait/synch/mutex/innodb/rtr_active_mutex | NO | NO | | wait/synch/mutex/innodb/rtr_match_mutex | NO | NO | | wait/synch/mutex/innodb/rtr_path_mutex | NO | NO | | wait/synch/mutex/innodb/rtr_ssn_mutex | NO | NO | | wait/synch/mutex/innodb/trx_sys_mutex | NO | NO | | wait/synch/mutex/innodb/zip_pad_mutex | NO | NO | | wait/synch/mutex/innodb/master_key_id_mutex | NO | NO | +---------------------------------------------------------+---------+-------+
InnoDB
performance-schema-instrument
performance-schema-instrument='wait/synch/mutex/innodb/%=ON'
InnoDB
InnoDB
performance-schema-instrument='wait/synch/mutex/innodb/fts%=OFF'
wait/synch/mutex/innodb/fts%
performance-schema-instrument
setup_instruments
TIMED
mysql>SELECT * FROM performance_schema.setup_instruments
WHERE NAME LIKE '%wait/synch/mutex/innodb%';
+-------------------------------------------------------+---------+-------+ | NAME | ENABLED | TIMED | +-------------------------------------------------------+---------+-------+ | wait/synch/mutex/innodb/commit_cond_mutex | YES | YES | | wait/synch/mutex/innodb/innobase_share_mutex | YES | YES | | wait/synch/mutex/innodb/autoinc_mutex | YES | YES | ... | wait/synch/mutex/innodb/master_key_id_mutex | YES | YES | +-------------------------------------------------------+---------+-------+ 49 rows in set (0.00 sec)
setup_consumers
MySQL的> UPDATE performance_schema.setup_consumers SET enabled = 'YES'
WHERE name like 'events_waits%';
查询行,3行受影响(0秒)的行匹配:3改变:3警告:0
setup_consumers
events_waits_current
events_waits_history
events_waits_history_long
MySQL的> SELECT * FROM performance_schema.setup_consumers;
---------------------------------- --------- |名字|启用| ---------------------------------- --------- | events_stages_current |没有| | events_stages_history |没有| | events_stages_history_long |没有| | events_statements_current |是| | events_statements_history |是| | events_statements_history_long |没有| | events_transactions_current |是| | events_transactions_history |是| | events_transactions_history_long |没有| | events_waits_current |是| | events_waits_history |是| | events_waits_history_long |是| | global_instrumentation |是| | thread_instrumentation |是| | statements_digest |是| ---------------------------------- --------- 15行集(0秒)
shell>./mysqlslap --auto-generate-sql --concurrency=100 --iterations=10
--number-of-queries=1000 --number-char-cols=6 --number-int-cols=6;
events_waits_summary_global_by_event_name
events_waits_current
events_waits_history
events_waits_history_long
COUNT_STAR
SUM_TIMER_WAIT
MIN_TIMER_WAIT
AVG_TIMER_WAIT
MAX_TIMER_WAIT
EVENT_NAME
SUM_TIMER_WAIT
ORDER BY
MySQL的> SELECT EVENT_NAME, COUNT_STAR, SUM_TIMER_WAIT/1000000000 SUM_TIMER_WAIT_MS
FROM performance_schema.events_waits_summary_global_by_event_name
WHERE SUM_TIMER_WAIT > 0 AND EVENT_NAME LIKE 'wait/synch/mutex/innodb/%'
ORDER BY COUNT_STAR DESC;
--------------------------------------------------------- ------------ ------------------- | event_name | count_star | sum_timer_wait_ms | --------------------------------------------------------- ------------ -------------------等待/同步/互斥/ | InnoDB / trx_mutex | 201111 | 23.4719 |等待/同步/互斥/ | InnoDB / fil_system_mutex | 62244 | 9.6426 |等待/同步/互斥/ | InnoDB / redo_rseg_mutex | 48238 | 3.1135 | |等待/同步/互斥/ / log_sys_mutex InnoDB | 46113 | 2.0434 |等待/同步/互斥/ | InnoDB / trx_sys_mutex | 35134 | 1068.1588 |等待/同步/互斥/ | InnoDB / lock_mutex | 34872 | 1039.2589 |等待/同步/互斥/ | InnoDB / log_sys_write_mutex | 17805 | 1526.0490 | | /同步/互斥/等/ dict_sys_mutex InnoDB | 14912 | 1606.7348 | |等待/同步/ / / trx_undo_mutex InnoDB互斥| 10634 | 1.1424 |等待/同步/互斥/ | InnoDB / rw_lock_list_mutex | 8538 | 0.1960 |等待/同步/互斥/ | InnoDB / buf_pool_free_list_mutex | 5961 |传代后|等待/同步/互斥/ | InnoDB / trx_pool_mutex |四千八百八十五| 8821.7496 | | /同步/互斥/ InnoDB等/ buf_pool_lru_list_mutex | 4364 | 0.2077 |等待/同步/互斥/ | InnoDB / innobase_share_mutex |吗| 0.2650 |等待/同步/互斥/ | InnoDB / flush_list_mutex | 3178 | 0.2349 |等待/同步/互斥/ | InnoDB / trx_pool_manager_mutex |以下| 0.1310 |等待/同步/互斥/ | InnoDB / buf_pool_flush_state_mutex | 1318 | 0.2161 |等待/同步/互斥/ | InnoDB / log_flush_order_mutex | 1250 | 0.0893 |等待/同步/互斥/ | InnoDB / buf_dblwr_mutex | 951 | 0.0918 | | /同步/互斥/创新等670 | 0.0942分贝/ recalc_pool_mutex | |等待/同步/互斥/ | InnoDB / dict_persist_dirty_tables_mutex | 345 | 0.0414 |等待/同步/互斥/ | InnoDB / lock_wait_mutex | 303 | 0.1565 |等待/同步/互斥/ | InnoDB / autoinc_mutex | 196 | 0.0213 |等待/同步/互斥/ | InnoDB / autoinc_persisted_mutex | 196 | 0.0175 |等待/同步/互斥/ | InnoDB / purge_sys_pq_mutex | 117 | 0.0308 |等待/同步/互斥/ | InnoDB / srv_sys_mutex | 94 | 0.0077 |等待/同步/互斥/ | InnoDB / ibuf_mutex | 22 | 0.0086 |等待/同步/互斥/ | InnoDB / recv_sys_mutex | 12 | 0.0008 | |等待/同步/互斥/会/ srv_innodb_monitor_mutex | 4 | 0.0009 | | /同步/互斥/等/ recv_writer_mutex InnoDB
events_waits_summary_global_by_event_name
MySQL的> TRUNCATE performance_schema.events_waits_summary_global_by_event_name;
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
stderr
stderr
stderr
--console
stderr
InnoDB
SHOW ENGINE INNODB
STATUS
pid
pid
innodb_status.
pid
innodb-status-file
InnoDB
InnoDB
InnoDB
=====================================2014-10-16 18:37:29 0x7fc2a95c1700 INNODB MONITOR OUTPUT=====================================
InnoDB
innodb_status_output
innodb_status_output_locks
InnoDB
PROCESS
InnoDB
innodb_status_output
SET GLOBAL innodb_status_output=ON;
InnoDB
innodb_status_output
innodb_status_output
InnoDB
SHOW ENGINE
INNODB STATUS
\G
MySQL的> SHOW ENGINE INNODB STATUS\G
SHOW ENGINE INNODB
STATUS
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
innodb_status_output_locks
InnoDB
InnoDB
SET GLOBAL innodb_status_output=ON;SET GLOBAL innodb_status_output_locks=ON;
InnoDB
innodb_status_output_locks
innodb_status_output
InnoDB
innodb_status_output
innodb_status_output_locks
InnoDB
SHOW ENGINE INNODB
STATUS
innodb_status_output_locks
SHOW ENGINE INNODB
STATUS
mysql> SHOW ENGINE INNODB STATUS\G
*************************** 1. row ***************************
Type: InnoDB
Name:
Status:
=====================================
2018-04-12 15:14:08 0x7f971c063700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 4 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 15 srv_active, 0 srv_shutdown, 1122 srv_idle
srv_master_thread log flush and writes: 0
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 24
OS WAIT ARRAY INFO: signal count 24
RW-shared spins 4, rounds 8, OS waits 4
RW-excl spins 2, rounds 60, OS waits 2
RW-sx spins 0, rounds 0, OS waits 0
Spin rounds per wait: 2.00 RW-shared, 30.00 RW-excl, 0.00 RW-sx
------------------------
LATEST FOREIGN KEY ERROR
------------------------
2018-04-12 14:57:24 0x7f97a9c91700 Transaction:
TRANSACTION 7717, ACTIVE 0 sec inserting
mysql tables in use 1, locked 1
4 lock struct(s), heap size 1136, 3 row lock(s), undo log entries 3
MySQL thread id 8, OS thread handle 140289365317376, query id 14 localhost root update
INSERT INTO child VALUES (NULL, 1), (NULL, 2), (NULL, 3), (NULL, 4), (NULL, 5), (NULL, 6)
Foreign key constraint fails for table `test`.`child`:
,
CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`) ON DELETE
CASCADE ON UPDATE CASCADE
Trying to add in child table, in index par_ind tuple:
DATA TUPLE: 2 fields;
0: len 4; hex 80000003; asc ;;
1: len 4; hex 80000003; asc ;;
But in parent table `test`.`parent`, in index PRIMARY,
the closest match we can find is record:
PHYSICAL RECORD: n_fields 3; compact format; info bits 0
0: len 4; hex 80000004; asc ;;
1: len 6; hex 000000001e19; asc ;;
2: len 7; hex 81000001110137; asc 7;;
------------
TRANSACTIONS
------------
Trx id counter 7748
Purge done for trx's n:o < 7747 undo n:o < 0 state: running but idle
History list length 19
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 421764459790000, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 7747, ACTIVE 23 sec starting index read
mysql tables in use 1, locked 1
LOCK WAIT 2 lock struct(s), heap size 1136, 1 row lock(s)
MySQL thread id 9, OS thread handle 140286987249408, query id 51 localhost root updating
DELETE FROM t WHERE i = 1
------- TRX HAS BEEN WAITING 23 SEC FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 4 page no 4 n bits 72 index GEN_CLUST_INDEX of table `test`.`t`
trx id 7747 lock_mode X waiting
Record lock, heap no 3 PHYSICAL RECORD: n_fields 4; compact format; info bits 0
0: len 6; hex 000000000202; asc ;;
1: len 6; hex 000000001e41; asc A;;
2: len 7; hex 820000008b0110; asc ;;
3: len 4; hex 80000001; asc ;;
------------------
TABLE LOCK table `test`.`t` trx id 7747 lock mode IX
RECORD LOCKS space id 4 page no 4 n bits 72 index GEN_CLUST_INDEX of table `test`.`t`
trx id 7747 lock_mode X waiting
Record lock, heap no 3 PHYSICAL RECORD: n_fields 4; compact format; info bits 0
0: len 6; hex 000000000202; asc ;;
1: len 6; hex 000000001e41; asc A;;
2: len 7; hex 820000008b0110; asc ;;
3: len 4; hex 80000001; asc ;;
--------
FILE I/O
--------
I/O thread 0 state: waiting for i/o request (insert buffer thread)
I/O thread 1 state: waiting for i/o request (log thread)
I/O thread 2 state: waiting for i/o request (read thread)
I/O thread 3 state: waiting for i/o request (read thread)
I/O thread 4 state: waiting for i/o request (read thread)
I/O thread 5 state: waiting for i/o request (read thread)
I/O thread 6 state: waiting for i/o request (write thread)
I/O thread 7 state: waiting for i/o request (write thread)
I/O thread 8 state: waiting for i/o request (write thread)
I/O thread 9 state: waiting for i/o request (write thread)
Pending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,
ibuf aio reads:, log i/o's:, sync i/o's:
Pending flushes (fsync) log: 0; buffer pool: 0
833 OS file reads, 605 OS file writes, 208 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 0, seg size 2, 0 merges
merged operations:
insert 0, delete mark 0, delete 0
discarded operations:
insert 0, delete mark 0, delete 0
Hash table size 553253, node heap has 0 buffer(s)
Hash table size 553253, node heap has 1 buffer(s)
Hash table size 553253, node heap has 3 buffer(s)
Hash table size 553253, node heap has 0 buffer(s)
Hash table size 553253, node heap has 0 buffer(s)
Hash table size 553253, node heap has 0 buffer(s)
Hash table size 553253, node heap has 0 buffer(s)
Hash table size 553253, node heap has 0 buffer(s)
0.00 hash searches/s, 0.00 non-hash searches/s
---
LOG
---
Log sequence number 19643450
Log buffer assigned up to 19643450
Log buffer completed up to 19643450
Log written up to 19643450
Log flushed up to 19643450
Added dirty pages up to 19643450
Pages flushed up to 19643450
Last checkpoint at 19643450
129 log i/o's done, 0.00 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 2198863872
Dictionary memory allocated 409606
Buffer pool size 131072
Free buffers 130095
Database pages 973
Old database pages 0
Modified db pages 0
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 810, created 163, written 404
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 973, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
----------------------
INDIVIDUAL BUFFER POOL INFO
----------------------
---BUFFER POOL 0
Buffer pool size 65536
Free buffers 65043
Database pages 491
Old database pages 0
Modified db pages 0
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 411, created 80, written 210
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 491, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 1
Buffer pool size 65536
Free buffers 65052
Database pages 482
Old database pages 0
Modified db pages 0
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 399, created 83, written 194
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 482, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
0 read views open inside InnoDB
Process ID=5772, Main thread ID=140286437054208 , state=sleeping
Number of rows inserted 57, updated 354, deleted 4, read 4421
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================
Status
InnoDB
BACKGROUND THREAD
srv_master_thread
SEMAPHORES
InnoDB
innodb_thread_concurrency
SHOW ENGINE
INNODB MUTEX
LATEST FOREIGN KEY ERROR
LATEST DETECTED DEADLOCK
InnoDB
TRANSACTIONS
FILE I/O
InnoDB
innodb_read_io_threads
innodb_write_io_threads
INSERT BUFFER AND ADAPTIVE HASH INDEX
InnoDB
LOG
InnoDB
BUFFER POOL AND MEMORY
ROW OPERATIONS
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
.ibd
InnoDB
my.cnf
--single-transaction
InnoDB
InnoDB
InnoDB
CHECK TABLE
CHECK
TABLE
InnoDB
InnoDB
InnoDB: The log sequence number 664050266 in the system tablespace does not match the log sequence number 685111586 in the ib_logfiles! InnoDB: Database was not shutdown normally! InnoDB: Starting crash recovery. InnoDB: Using 'tablespaces.open.2' max LSN: 664075228 InnoDB: Doing recovery: scanned up to log sequence number 690354176 InnoDB: Doing recovery: scanned up to log sequence number 695597056 InnoDB: Doing recovery: scanned up to log sequence number 700839936 InnoDB: Doing recovery: scanned up to log sequence number 706082816 InnoDB: Doing recovery: scanned up to log sequence number 711325696 InnoDB: Doing recovery: scanned up to log sequence number 713458156 InnoDB: Applying a batch of 1467 redo log records ... InnoDB: 10% InnoDB: 20% InnoDB: 30% InnoDB: 40% InnoDB: 50% InnoDB: 60% InnoDB: 70% InnoDB: 80% InnoDB: 90% InnoDB: 100% InnoDB: Apply batch completed! InnoDB: 1 transaction(s) which must be rolled back or cleaned up in total 561887 row operations to undo InnoDB: Trx id counter is 4096 ... InnoDB: 8.0.1 started; log sequence number 713458156 InnoDB: Waiting for purge to start InnoDB: Starting in background the rollback of uncommitted transactions InnoDB: Rolling back trx with id 3596, 561887 rows to undo ... ./mysqld: ready for connections....
InnoDB
InnoDB
ibdata*
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
innodb_fast_shutdown
1
InnoDB
innodb_force_recovery
InnoDB
XA
PREPARE
InnoDB
InnoDB
InnoDB
innodb_data_home_dir
innodb_data_home_dir
datadir
tablespaces.open.1
innodb_scan_directories
innodb_scan_directories
innodb_scan_directories
mysqld --innodb-scan-directories="directory_path_1
;directory_path_2
"
[mysqld] innodb_scan_directories="directory_path_1
;directory_path_2
"
innodb_scan_directories
InnoDB: Directories to scan 'directory_path_1
;directory_path_2
' InnoDB: Scanning 'directory_path_1
' InnoDB: Scanning 'directory_path_2
' InnoDB: Found 10 '.ibd' file(s)
InnoDB
InnoDB
InnoDB
InnoDB
CREATE TABLE
CREATE TABLE fc1 ( i INT PRIMARY KEY, j INT) ENGINE = InnoDB;CREATE TABLE fc2 ( m INT PRIMARY KEY, n INT, FOREIGN KEY ni (n) REFERENCES fc1 (i) ON DELETE CASCADE) ENGINE = InnoDB;
InnoDB
FOREIGN KEY
硕士 INSERT INTO fc1 VALUES (1, 1), (2, 2);
查询行,2行受影响(0.09秒)记录:2份:0警告:0master > INSERT INTO fc2 VALUES (1, 1), (2, 2), (3, 1);
查询好,三行受影响(0.19秒)记录:三副本:警告:0 0
fc1
master>SELECT * FROM fc1;
+---+------+ | i | j | +---+------+ | 1 | 1 | | 2 | 2 | +---+------+ 2 rows in set (0.00 sec) master>SELECT * FROM fc2;
+---+------+ | m | n | +---+------+ | 1 | 1 | | 2 | 2 | | 3 | 1 | +---+------+ 3 rows in set (0.00 sec) slave>SELECT * FROM fc1;
+---+------+ | i | j | +---+------+ | 1 | 1 | | 2 | 2 | +---+------+ 2 rows in set (0.00 sec) slave>SELECT * FROM fc2;
+---+------+ | m | n | +---+------+ | 1 | 1 | | 2 | 2 | | 3 | 1 | +---+------+ 3 rows in set (0.00 sec)
DELETE
硕士 DELETE FROM fc1 WHERE i=1;
查询行,1行的影响(0.09秒)
fc2
硕士 SELECT * FROM fc2;
--- | M | N | --- | 2 | 2 | --- 1行集(0秒)
DELETE
fc2
slave> SELECT * FROM fc2;
+---+---+
| m | n |
+---+---+
| 1 | 1 |
| 3 | 1 |
| 2 | 2 |
+---+---+
3 rows in set (0.00 sec)
InnoDB
InnoDB
daemon_memcached
InnoDB
get
incr
InnoDB
add
incr
InnoDB
daemon_memcached
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
2|4|6|8
InnoDB
InnoDB
daemon_memcached
add
InnoDB
InnoDB
daemon_memcached
AVG()
InnoDB
InnoDB
InnoDB
InnoDB
daemon_memcached
daemon_memcached
InnoDB
daemon_memcached
InnoDB
get
InnoDB
InnoDB
InnoDB
innodb_api_bk_commit_interval
daemon_memcached_r_batch_size
daemon_memcached_w_batch_size
daemon_memcached_option
innodb_api_trx_level
innodb_api_trx_level
READ UNCOMMITTED
innodb_api_enable_mdl
InnoDB
InnoDB
memcached
innodb_memcached_config.sql
INSTALL PLUGIN
daemon_memcached
InnoDB
innodb_buffer_pool_size
innodb_only
caching
daemon_memcached
table_id
key
table_id
key
@@
add
incr
get
table_id
得到@ @ table_id
get
incr
table_id
innodb_only
daemon_memcached
add
innodb_only
InnoDB
caching
daemon_memcached
daemon_memcached
memcached-tool
stderr
-vv
get
add
InnoDB
InnoDB
libmemcached
InnoDB
daemon_memcached
daemon_memcached
InnoDB
daemon_memcached
daemon_memcached
daemon_memcached
-DWITH_INNODB_MEMCACHED=ON
plugin_dir
libmemcached.so
innodb_engine.so
libevent
libevent
apt-get
port
install
sudo的ATP - get install libevent DEV
libevent
libevent
-DWITH_LIBEVENT
yes
daemon_memcached
innodb_memcached_config.sql
MYSQL_HOME
cache_policies
containers
test
MySQL的> source
MYSQL_HOME
/share/innodb_memcached_config.sql
innodb_memcached_config.sql
mysql>USE innodb_memcache;
mysql>SHOW TABLES;
+---------------------------+ | Tables_in_innodb_memcache | +---------------------------+ | cache_policies | | config_options | | containers | +---------------------------+ mysql>USE test;
mysql>SHOW TABLES;
+----------------+ | Tables_in_test | +----------------+ | demo_test | +----------------+
innodb_memcache.containers
InnoDB
daemon_memcached
innodb_memcached_config.sql
demo_test
mysql>SELECT * FROM innodb_memcache.containers\G
*************************** 1. row *************************** name: aaa db_schema: test db_table: demo_test key_columns: c1 value_columns: c2 flags: c3 cas_column: c4 expire_time_column: c5 unique_idx_name_on_key: PRIMARY mysql>SELECT * FROM test.demo_test;
+----+------------------+------+------+------+ | c1 | c2 | c3 | c4 | c5 | +----+------------------+------+------+------+ | AA | HELLO, HELLO | 8 | 0 | 0 | +----+------------------+------+------+------+
innodb_memcache
daemon_memcached
INSTALL PLUGIN
MySQL的> INSTALL PLUGIN daemon_memcached soname "libmemcached.so";
daemon_memcached
test.demo_test
AA
telnet localhost 11211
尝试连接到127.0.0.1…localhost。转义字符是“^ ]”。 get AA
价值8 12hello AA,helloend
set
set BB 10 0 16
GOODBYE, GOODBYE
存储
set
BB
10
0
0
16
GOODBYE, GOODBYE
test.demo_test
MySQL的> SELECT * FROM test.demo_test;
---- ------------------ ------ ------ ------ | C1 C2 C3 C4 | | | | C5 | ---- ------------------ ------ ------ ------ | AA |你好,你好| 8 | 0 | 0 | | BB |再见,再见| 10 | 1 | 0 | ---- ------------------ ------ ------ ------
BB
get BB
价值10 16goodbye BB,goodbyeend quit
InnoDB
get
test.demo_test
InnoDB
InnoDB
flags
expiry
name
country
innodb_memcache.containers
MySQL的> CREATE TABLE city (
city_id VARCHAR(32),
name VARCHAR(1024),
state VARCHAR(1024),
country VARCHAR(1024),
flags INT,
cas BIGINT UNSIGNED,
expiry INT,
primary key(city_id)
) ENGINE=InnoDB;
innodb_memcache.containers
InnoDB
mysql> DESCRIBE innodb_memcache.containers;
+------------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------------+--------------+------+-----+---------+-------+
| name | varchar(50) | NO | PRI | NULL | |
| db_schema | varchar(250) | NO | | NULL | |
| db_table | varchar(250) | NO | | NULL | |
| key_columns | varchar(250) | NO | | NULL | |
| value_columns | varchar(250) | YES | | NULL | |
| flags | varchar(250) | NO | | 0 | |
| cas_column | varchar(250) | YES | | NULL | |
| expire_time_column | varchar(250) | YES | | NULL | |
| unique_idx_name_on_key | varchar(250) | NO | | NULL | |
+------------------------+--------------+------+-----+---------+-------+
innodb_memcache.containers
MySQL的> INSERT INTO `innodb_memcache`.`containers` (
`name`, `db_schema`, `db_table`, `key_columns`, `value_columns`,
`flags`, `cas_column`, `expire_time_column`, `unique_idx_name_on_key`)
VALUES ('default', 'test', 'city', 'city_id', 'name|state|country',
'flags','cas','expiry','PRIMARY');
default
city
daemon_memcached
InnoDB
state
containers.value_columns
flags
expire_time_column
daemon_memcached
0
innodb_memcache.containers
mysql>UNINSTALL PLUGIN daemon_memcached;
mysql>INSTALL PLUGIN daemon_memcached soname "libmemcached.so";
city
set
telnet localhost 11211
尝试连接到127.0.0.1…localhost。转义字符是“^ ]”。 set B 0 0 22
BANGALORE|BANGALORE|IN
存储
test.city
MySQL的> SELECT * FROM test.city;
--------- ----------- ----------- --------- ------- ------ -------- | city_id |名字|状态|国|旗帜| CAS |到期| --------- ----------- ----------- --------- ------- ------ -------- | B |班加罗尔|班加罗尔|在| 0 | 3 | 0 | --------- ----------- ----------- --------- ------- ------ --------
test.city
MySQL的> INSERT INTO city VALUES ('C','CHENNAI','TAMIL NADU','IN', 0, 0 ,0);
MySQL的> INSERT INTO city VALUES ('D','DELHI','DELHI','IN', 0, 0, 0);
MySQL的> INSERT INTO city VALUES ('H','HYDERABAD','TELANGANA','IN', 0, 0, 0);
MySQL的> INSERT INTO city VALUES ('M','MUMBAI','MAHARASHTRA','IN', 0, 0, 0);
0
cas_column
get
get H
| H 0值22hyderabad泰| inend
memcached
daemon_memcached_option
-p11222
daemon_memcached_option
mysqld .... --daemon_memcached_option="-p11222"
daemon_memcached_option
daemon_memcached
daemon_memcached_engine_lib_name
innodb_engine.so
daemon_memcached_engine_lib_path
daemon_memcached_r_batch_size
daemon_memcached_r_batch_size
InnoDB
get
daemon_memcached_w_batch_size
replace
prepend
decr
daemon_memcached_w_batch_size
set
decr
flush_all
daemon_memcached_engine_lib_name
daemon_memcached_engine_lib_path
daemon_memcached
daemon_memcached
daemon_memcached
MySQL的> UNINSTALL PLUGIN daemon_memcached;
MySQL的> INSTALL PLUGIN daemon_memcached soname "libmemcached.so";
daemon_memcached
InnoDB
test.city
mysql>USE test;
mysql>SELECT * FROM test.city;
+---------+-----------+-------------+---------+-------+------+--------+ | city_id | name | state | country | flags | cas | expiry | +---------+-----------+-------------+---------+-------+------+--------+ | B | BANGALORE | BANGALORE | IN | 0 | 1 | 0 | | C | CHENNAI | TAMIL NADU | IN | 0 | 0 | 0 | | D | DELHI | DELHI | IN | 0 | 0 | 0 | | H | HYDERABAD | TELANGANA | IN | 0 | 0 | 0 | | M | MUMBAI | MAHARASHTRA | IN | 0 | 0 | 0 | +---------+-----------+-------------+---------+-------+------+--------+
get
telnet 127.0.0.1 11211
Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'.get B C D H M
VALUE B 0 22 BANGALORE|BANGALORE|IN VALUE C 0 21 CHENNAI|TAMIL NADU|IN VALUE D 0 14 DELHI|DELHI|IN VALUE H 0 22 HYDERABAD|TELANGANA|IN VALUE M 0 21 MUMBAI|MAHARASHTRA|IN END
get
containers.name
get @@aaa.AA BB
值“8 12hello @aaa.aa,hellovalue BB 10 16goodbye,goodbyeend
get
daemon_memcached
<
>
<=
>=
test.city
mysql> SELECT * FROM test.city;
+---------+-----------+-------------+---------+-------+------+--------+
| city_id | name | state | country | flags | cas | expiry |
+---------+-----------+-------------+---------+-------+------+--------+
| B | BANGALORE | BANGALORE | IN | 0 | 1 | 0 |
| C | CHENNAI | TAMIL NADU | IN | 0 | 0 | 0 |
| D | DELHI | DELHI | IN | 0 | 0 | 0 |
| H | HYDERABAD | TELANGANA | IN | 0 | 0 | 0 |
| M | MUMBAI | MAHARASHTRA | IN | 0 | 0 | 0 |
+---------+-----------+-------------+---------+-------+------+--------+
telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
B
get @>B
VALUE C 0 21
CHENNAI|TAMIL NADU|IN
VALUE D 0 14
DELHI|DELHI|IN
VALUE H 0 22
HYDERABAD|TELANGANA|IN
VALUE M 0 21
MUMBAI|MAHARASHTRA|IN
END
M
get @<M
get @<M
VALUE B 0 22
BANGALORE|BANGALORE|IN
VALUE C 0 21
CHENNAI|TAMIL NADU|IN
VALUE D 0 14
DELHI|DELHI|IN
VALUE H 0 22
HYDERABAD|TELANGANA|IN
END
M
get @<=M
get @<=M
VALUE B 0 22
BANGALORE|BANGALORE|IN
VALUE C 0 21
CHENNAI|TAMIL NADU|IN
VALUE D 0 14
DELHI|DELHI|IN
VALUE H 0 22
HYDERABAD|TELANGANA|IN
VALUE M 0 21
MUMBAI|MAHARASHTRA|IN
B
get @>B@<M
get @>B@<M
C值的0 21chennai |泰米尔纳德邦|价值0 14delhi |德里|至H 0 22hyderabad |特|时尚
@<
@<=
@>
@>=
get
get
B@>C
get @<M@>B@>C
C值的0 21chennai |泰米尔纳德邦|价值0 14delhi |德里|至H 0 22hyderabad | |在特
daemon_memcached
daemon_memcached
daemon_memcached
InnoDB
InnoDB
daemon_memcached
daemon_memcached
daemon_memcached
sudo apt-get -f install libsasl2-2 sasl2-bin libsasl2-2 libsasl2-dev libsasl2-modules
daemon_memcached
ENABLE_MEMCACHED_SASL=1
ENABLE_MEMCACHED_SASL_PWDB=1
cmake ... -DWITH_INNODB_MEMCACHED=1 -DENABLE_MEMCACHED_SASL=1 -DENABLE_MEMCACHED_SASL_PWDB=1
daemon_memcached
testname
echo "testname:testpasswd:::::::" >/home/jy/memcached-sasl-db
MEMCACHED_SASL_PWDB
export MEMCACHED_SASL_PWDB=/home/jy/memcached-sasl-db
memcached
echo "mech_list: plain" > /home/jy/work2/msasl/clients/memcached.confexport SASL_CONF_PATH=/home/jy/work2/msasl/clients
-S
daemon_memcached_option
mysqld ... --daemon_memcached_option="-S"
memcp --servers=localhost:11211 --binary --username=testname --password=password
myfile.txt memcat --servers=localhost:11211 --binary --username=testname --password=password
myfile.txt
memcache error
AUTHENTICATION FAILURE
InnoDB
daemon_memcached
daemon_memcached
VARCHAR
TEXT
BLOB
InnoDB
daemon_memcached
add()
get()
InnoDB
InnoDB
daemon_memcached
INTEGER
InnoDB
AVG()
VARCHAR
CAST()
#字母条目作为zero.select投回来(C2为无符号整数)从demo_test;#自会有0个数值,不能取消它们。#测试字符串值,发现都是整数的,平均只有those.select AVG(CAST(C2为无符号整数))从demo_test C2之间“0”和“9999999999”;#观点让你隐藏的查询的复杂性。结果已经转换;#无需重复转换函数和WHERE子句中每个time.create视图数作为选择C1键,铸造(C2为无符号整数)值从demo_test C2之间的“0”和“9999999999”;选择和(Val)数;
CAST()
WHERE
InnoDB
daemon_memcached
default
innodb_memcache.containers
get @@
name
name
test.demo_test
InnoDB
value_columns
InnoDB
col1|col2|col3
add
get
memcached
daemon_memcached
python-memcache
multicol
'L'
MySQL的> USE test;
MySQL的> CREATE TABLE `multicol` (
`country` varchar(128) NOT NULL DEFAULT '',
`population` varchar(10) DEFAULT NULL,
`area_sq_km` varchar(9) DEFAULT NULL,
`drive_side` varchar(1) DEFAULT NULL,
`c3` int(11) DEFAULT NULL,
`c4` bigint(20) unsigned DEFAULT NULL,
`c5` int(11) DEFAULT NULL,
PRIMARY KEY (`country`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
innodb_memcache.containers
multicol
MySQL的> INSERT INTO innodb_memcache.containers
(name,db_schema,db_table,key_columns,value_columns,flags,cas_column,
expire_time_column,unique_idx_name_on_key)
VALUES
('bbb','test','multicol','country','population,area_sq_km,drive_side',
'c3','c4','c5','PRIMARY');
MySQL的> COMMIT;
innodb_memcache.containers
name
InnoDB
name
@@
db_schema
multicol
db_table
InnoDB
key_columns
country
InnoDB
area_sq_km
value_columns
flags
cas_column
daemon_memcached
unique_idx_name_on_key
country
multicol.py
multicol
daemon_memcached
import sys, osimport memcachedef connect_to_memcached(): memc = memcache.Client(['127.0.0.1:11211'], debug=0); print "Connected to memcached." return memcdef banner(message): print print "=" * len(message) print message print "=" * len(message)country_data = [("Canada","34820000","9984670","R"),("USA","314242000","9826675","R"),("Ireland","6399152","84421","L"),("UK","62262000","243610","L"),("Mexico","113910608","1972550","R"),("Denmark","5543453","43094","R"),("Norway","5002942","385252","R"),("UAE","8264070","83600","R"),("India","1210193422","3287263","L"),("China","1347350000","9640821","R"),]def switch_table(memc,table): key = "@@" + table print "Switching default table to '" + table + "' by issuing GET for '" + key + "'." result = memc.get(key)def insert_country_data(memc): banner("Inserting initial data via memcached interface") for item in country_data: country = item[0] population = item[1] area = item[2] drive_side = item[3] key = country value = "|".join([population,area,drive_side]) print "Key = " + key print "Value = " + value if memc.add(key,value): print "Added new key, value pair." else: print "Updating value for existing key." memc.set(key,value)def query_country_data(memc): banner("Retrieving data for all keys (country names)") for item in country_data: key = item[0] result = memc.get(key) print "Here is the result retrieved from the database for key " + key + ":" print result (m_population, m_area, m_drive_side) = result.split("|") print "Unpacked population value: " + m_population print "Unpacked area value : " + m_area print "Unpacked drive side value: " + m_drive_sideif __name__ == '__main__': memc = connect_to_memcached() switch_table(memc,"bbb") insert_country_data(memc) query_country_data(memc) sys.exit(0)
multicol
get
@@
bbb
innodb_memcache.containers.name
name
add
get
shell> python multicol.py
Connected to memcached. Switching default table to 'bbb' by issuing GET for '@@bbb'. ============================================== Inserting initial data via memcached interface ============================================== Key = Canada Value = 34820000|9984670|R Added new key, value pair. Key = USA Value = 314242000|9826675|R Added new key, value pair. Key = Ireland Value = 6399152|84421|L Added new key, value pair. Key = UK Value = 62262000|243610|L Added new key, value pair. Key = Mexico Value = 113910608|1972550|R Added new key, value pair. Key = Denmark Value = 5543453|43094|R Added new key, value pair. Key = Norway Value = 5002942|385252|R Added new key, value pair. Key = UAE Value = 8264070|83600|R Added new key, value pair. Key = India Value = 1210193422|3287263|L Added new key, value pair. Key = China Value = 1347350000|9640821|R Added new key, value pair. ============================================ Retrieving data for all keys (country names) ============================================ Here is the result retrieved from the database for key Canada: 34820000|9984670|R Unpacked population value: 34820000 Unpacked area value : 9984670 Unpacked drive side value: R Here is the result retrieved from the database for key USA: 314242000|9826675|R Unpacked population value: 314242000 Unpacked area value : 9826675 Unpacked drive side value: R Here is the result retrieved from the database for key Ireland: 6399152|84421|L Unpacked population value: 6399152 Unpacked area value : 84421 Unpacked drive side value: L Here is the result retrieved from the database for key UK: 62262000|243610|L Unpacked population value: 62262000 Unpacked area value : 243610 Unpacked drive side value: L Here is the result retrieved from the database for key Mexico: 113910608|1972550|R Unpacked population value: 113910608 Unpacked area value : 1972550 Unpacked drive side value: R Here is the result retrieved from the database for key Denmark: 5543453|43094|R Unpacked population value: 5543453 Unpacked area value : 43094 Unpacked drive side value: R Here is the result retrieved from the database for key Norway: 5002942|385252|R Unpacked population value: 5002942 Unpacked area value : 385252 Unpacked drive side value: R Here is the result retrieved from the database for key UAE: 8264070|83600|R Unpacked population value: 8264070 Unpacked area value : 83600 Unpacked drive side value: R Here is the result retrieved from the database for key India: 1210193422|3287263|L Unpacked population value: 1210193422 Unpacked area value : 3287263 Unpacked drive side value: L Here is the result retrieved from the database for key China: 1347350000|9640821|R Unpacked population value: 1347350000 Unpacked area value : 9640821 Unpacked drive side value: R
innodb_memcache.containers
demo_test
multicol
MySQL的> SELECT * FROM innodb_memcache.containers\G
*************************** 1。行***************************名称:AAA db_schema:测试db_table:demo_test key_columns:C1 C2 C3 value_columns:国旗:cas_column:C4 expire_time_column:c5unique_idx_name_on_key:主要*************************** 2。行***************************名称:BBB db_schema:测试db_table:多色key_columns:国家value_columns:人口、area_sq_km,drive_side标志:C3 C4 cas_column:expire_time_column:c5unique_idx_name_on_key:初级
multicol
mysql> SELECT * FROM test.multicol;
+---------+------------+------------+------------+------+------+------+
| country | population | area_sq_km | drive_side | c3 | c4 | c5 |
+---------+------------+------------+------------+------+------+------+
| Canada | 34820000 | 9984670 | R | 0 | 11 | 0 |
| China | 1347350000 | 9640821 | R | 0 | 20 | 0 |
| Denmark | 5543453 | 43094 | R | 0 | 16 | 0 |
| India | 1210193422 | 3287263 | L | 0 | 19 | 0 |
| Ireland | 6399152 | 84421 | L | 0 | 13 | 0 |
| Mexico | 113910608 | 1972550 | R | 0 | 15 | 0 |
| Norway | 5002942 | 385252 | R | 0 | 17 | 0 |
| UAE | 8264070 | 83600 | R | 0 | 18 | 0 |
| UK | 62262000 | 243610 | L | 0 | 14 | 0 |
| USA | 314242000 | 9826675 | R | 0 | 12 | 0 |
+---------+------------+------------+------------+------+------+------+
VARCHAR
InnoDB
country
mysql>SELECT AVG(population) FROM multicol WHERE drive_side = 'R';
+-------------------+ | avg(population) | +-------------------+ | 261304724.7142857 | +-------------------+ mysql>SELECT SUM(area_sq_km) FROM multicol WHERE country LIKE 'U%';
+-----------------+ | sum(area_sq_km) | +-----------------+ | 10153885 | +-----------------+
population
AVG()
<
9
> 1000
SELECT
*
mysql>CREATE VIEW populous_countries AS
SELECT
country,
cast(population as unsigned integer) population,
cast(area_sq_km as unsigned integer) area_sq_km,
drive_side FROM multicol
ORDER BY CAST(population as unsigned integer) DESC
LIMIT 3;
mysql>SELECT * FROM populous_countries;
+---------+------------+------------+------------+ | country | population | area_sq_km | drive_side | +---------+------------+------------+------------+ | China | 1347350000 | 9640821 | R | | India | 1210193422 | 3287263 | L | | USA | 314242000 | 9826675 | R | +---------+------------+------------+------------+ mysql>DESC populous_countries;
+------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+---------------------+------+-----+---------+-------+ | country | varchar(128) | NO | | | | | population | bigint(10) unsigned | YES | | NULL | | | area_sq_km | int(9) unsigned | YES | | NULL | | | drive_side | varchar(1) | YES | | NULL | | +------------+---------------------+------+-----+---------+-------+
InnoDB
daemon_memcached
InnoDB
InnoDB
InnoDB
@@
table_id
.key
innodb_memcache.containers
containers.name
innodb_only
set()
while expecting 'STORED', got unexpected response
'NOT_STORED
innodb_only
InnoDB
InnoDB
GET
WHERE
SQL:SELECT col FROM tbl WHERE key = 'key_value';memcached:get key_valueSQL:SELECT col FROM tbl WHERE col1 = val1 and col2 = val2 and col3 = val3;memcached:# Since you must always know these 3 values to look up the key,# combine them into a unique string and use that as the key# for all ADD, SET, and GET operations.key_value = val1 + ":" + val2 + ":" + val3get key_valueSQL:SELECT 'key exists!' FROM tbl WHERE EXISTS (SELECT col1 FROM tbl WHERE KEY = 'key_value') LIMIT 1;memcached:# Test for existence of key by asking for its value and checking if the call succeeds,# ignoring the value itself. For existence checking, you typically only store a very# short value such as "1".get key_value
daemon_memcached
innodb_buffer_pool_size
innodb_buffer_pool_instances
InnoDB
innodb_doublewrite
innodb_flush_log_at_trx_commit
innodb_flush_method
daemon_memcached_r_batch_size
daemon_memcached_w_batch_size
daemon_memcached_r_batch_size
N
daemon_memcached_w_batch_size
N
daemon_memcached_w_batch_size
100
daemon_memcached_w_batch_size
InnoDB
add
daemon_memcached
daemon_memcached
set
get
daemon_memcached
InnoDB
daemon_memcached_w_batch_size=1
daemon_memcached_w_batch_size
daemon_memcached_w_batch_size
innodb_api_bk_commit_interval
InnoDB
get
InnoDB
innodb_api_trx_level
REPEATABLE READ
innodb_api_trx_level
innodb_api_disable_rowlock
daemon_memcached
OFF
get
innodb_api_disable_rowlock
innodb_api_disable_rowlock
ALTER TABLE
innodb_api_enable_mdl
CREATE INDEX
innodb_memcache.cache_policies
innodb_only
cache-only
caching
InnoDB
caching
get
incr
delete
get
caching
flush
InnoDB
MySQL的> SELECT * FROM innodb_memcache.cache_policies;
-------------- ------------- ------------- --------------- -------------- | policy_name | get_policy | set_policy | delete_policy | flush_policy | -------------- ------------- ------------- --------------- -------------- | cache_policy | innodb_only | innodb_only | innodb_only | innodb_only | -------------- ------------- ------------- --------------- -------------- MySQL > UPDATE innodb_memcache.cache_policies SET set_policy = 'caching'
WHERE policy_name = 'cache_policy';
innodb_memcache.cache_policies
mysql>UNINSTALL PLUGIN daemon_memcached;
mysql>INSTALL PLUGIN daemon_memcached soname "libmemcached.so";
daemon_memcached
daemon_memcached
memcached
add
set
decr
delete
key
t1
innodb_memcache.containers
key_columns
value_columns
插入T1(键,值(Val) some_key
, some_value
);SELECT val FROM t1 WHERE key =some_key
;UPDATE t1 SET val =new_value
WHERE key =some_key
;UPDATE t1 SET val = val + x WHERE key =some_key
;DELETE FROM t1 WHERE key =some_key
;
TRUNCATE TABLE
DELETE
t1
TRUNCATE TABLE t1; DELETE FROM t1;
InnoDB
daemon_memcached_w_batch_size
READ
UNCOMMITTED
MySQL的> SET SESSSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
MySQL的> SELECT * FROM demo_test;
””””””””””。| CX | CY | C1 C2作为| CZ | | | CB | C3与C4 C5 | | | |””””””””””。| | |零零零零| A11 | | 123456789 | | 10 | |零零(3 |空|”-----------””””””””
daemon_memcached_r_batch_size
InnoDB
daemon_memcached_r_batch_size
daemon_memcached_w_batch_size
daemon_memcached
daemon_memcached
daemon_memcached
daemon_memcached
innodb_api_enable_binlog
--log-bin
mysqld ... --log-bin -–innodb_api_enable_binlog=1
master shell>mysqldump --all-databases --lock-all-tables > dbdump.db
slave shell>mysql < dbdump.db
SHOW MASTER
STATUS
MySQL的> SHOW MASTER STATUS;
CHANGE
MASTER TO
MySQL的> CHANGE MASTER TO
MASTER_HOST='localhost',
MASTER_USER='root',
MASTER_PASSWORD='',
MASTER_PORT = 13000,
MASTER_LOG_FILE='0.000001,
MASTER_LOG_POS=114;
mysql> START SLAVE;
2013-09-24T13:04:38.639684Z 49 [Note] Slave I/O thread: connected to master 'root@localhost:13000', replication started in log '0.000001' at position 114
InnoDB
demo_test
daemon_memcached
set
10
t1
telnet 127.0.0.1 11211
尝试连接到127.0.0.1…127.0.0.1.escape字符是^ ]”。 set test1 10 0 1
t1
存储
demo_test
AA
c1
c3
c5
MySQL的> SELECT * FROM test.demo_test;
------- -------------- ------ ------ ------ | C1 C2 C3 C4 | | | | C5 | ------- -------------- ------ ------ ------ | AA |你好,你好| 8 | 0 | 0 | | test1 | T1 | 10 | 1 | 0 | ------- -------------- ------ ------ ------
mysql> SELECT * FROM test.demo_test;
+-------+--------------+------+------+------+
| c1 | c2 | c3 | c4 | c5 |
+-------+--------------+------+------+------+
| AA | HELLO, HELLO | 8 | 0 | 0 |
| test1 | t1 | 10 | 1 | 0 |
+-------+--------------+------+------+------+
set
telnet 127.0.0.1 11211
Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'.set test1 10 0 2
new
STORED
cas
MySQL的> SELECT * FROM test.demo_test;
------- -------------- ------ ------ ------ | C1 C2 C3 C4 | | | | C5 | ------- -------------- ------ ------ ------ | AA |你好,你好| 8 | 0 | 0 | | test1 |新| 10 | 2 | 0 | ------- -------------- ------ ------ ------
test1
telnet 127.0.0.1 11211
Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'.delete test1
DELETED
delete
mysql> SELECT * FROM test.demo_test;
+----+--------------+------+------+------+
| c1 | c2 | c3 | c4 | c5 |
+----+--------------+------+------+------+
| AA | HELLO, HELLO | 8 | 0 | 0 |
+----+--------------+------+------+------+
flush_all
telnet 127.0.0.1 11211
尝试连接到127.0.0.1…127.0.0.1.escape字符是^ ]”。 flush_all
好啊
MySQL的> SELECT * FROM test.demo_test;
空集合(0秒)
telnet 127.0.0.1 11211
Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'set test2 10 0 4
again
STOREDset test3 10 0 5
again1
STORED
mysql> SELECT * FROM test.demo_test;
+-------+--------------+------+------+------+
| c1 | c2 | c3 | c4 | c5 |
+-------+--------------+------+------+------+
| test2 | again | 10 | 4 | 0 |
| test3 | again1 | 10 | 5 | 0 |
+-------+--------------+------+------+------+
flush_all
telnet 127.0.0.1 11211
尝试连接到127.0.0.1…127.0.0.1.escape字符是^ ]”。 flush_all
好啊
flush_all
MySQL的> SELECT * FROM test.demo_test;
空集合(0秒)
flush_all
binlog_format
flush_all
TRUNCATE TABLE
flush_all
TRUNCATE TABLE
DELETE
TRUNCATE TABLE
daemon_memcached_r_batch_size
daemon_memcached_w_batch_size
daemon_memcached_w_batch_size
daemon_memcached_w_batch_size
SET
TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
TRUNCATE TABLE
InnoDB
get | |
set | INSERT
|
add | INSERT
|
replace | UPDATE |
append | UPDATE
|
prepend | UPDATE
|
incr | UPDATE |
decr | UPDATE |
delete | DELETE |
flush_all | TRUNCATE TABLE |
daemon_memcached
config_options
innodb_memcached_config.sql
mysql>USE innodb_memcache;
Database changed mysql>SHOW TABLES;
+---------------------------+ | Tables_in_innodb_memcache | +---------------------------+ | cache_policies | | config_options | | containers | +---------------------------+
cache_policies
memcached
set
flush
innodb_only
cache-only
caching
InnoDB
disable
policy_name | cache_policy |
get_policy | innodb_only
caching
innodb_only |
set_policy | innodb_only
caching
innodb_only |
delete_policy | innodb_only
caching
innodb_only |
flush_policy | innodb_only
caching
innodb_only |
config_options
separator
Name | config_options
|
Value |
containers
containers
memcached
containers
innodb_memcached_config.sql
InnoDB
name | InnoDB
daemon_memcached
containers.name
containers
InnoDB |
db_schema | InnoDB |
db_table | InnoDB |
key_columns | InnoDB |
value_columns | InnoDB
innodb_memcached.config_options col1|col2|col3 |
flags | InnoDB incr
value_columns
flags
0 |
cas_column | InnoDB
InnoDB 0 |
expire_time_column | InnoDB
InnoDB 0
|
unique_idx_name_on_key | InnoDB InnoDB |
db_schema
key_columns
unique_idx_name_on_key
flags
expire_time_column
key_columns
CHAR
VARCHAR
cas_column
BIGINT
expiration_time_column
INTEGER
flags
INTEGER
InnoDB
containers
InnoDB
memcached
innodb_memcached_config.sql
test
innodb_memcached_config.sql
innodb_memcache.containers
MySQL的> SELECT * FROM innodb_memcache.containers\G
*************************** 1。行***************************名称:AAA db_schema:测试db_table:demo_test key_columns:C1 C2 C3 value_columns:国旗:cas_column:C4 expire_time_column:c5unique_idx_name_on_key:primarymysql > SELECT * FROM test.demo_test;
---- ------------------ ------ ------ ------ | C1 C2 C3 C4 | | | | C5 | ---- ------------------ ------ ------ ------ | AA |你好,你好| 8 | 0 | 0 | ---- ------------------ ------ ------ ------
InnoDB
# Linux shell>ulimit -n
1024 shell>ulimit -n 4096
shell>ulimit -n
4096 # OS X shell>ulimit -n
256 shell>ulimit -n 4096
shell>ulimit -n
4096
-c
daemon_memcached_option
[mysqld] ... loose-daemon_memcached_option='-c 64'
InnoDB
daemon_memcached_option
[mysqld] ... loose-daemon_memcached_option='-vvv'
daemon_memcached
[mysqld]
daemon_memcached=OFF
INSTALL
PLUGIN
innodb_memcache.containers
mysql> UNINSTALL PLUGIN daemon_memcached;
daemon_memcached
daemon_memcached_option
daemon_memcached
InnoDB
InnoDB
InnoDB
set
table_id
col1|col2|col3
InnoDB
NOT
NULL
innodb_memcache.containers
INSERT
NULL
NOT
NULL
INSERT
innodb_memcache.containers
cas_column
innodb_memcached.containers
InnoDB_Memcached: column 6 in the entry for config table 'containers' in database 'innodb_memcache' has an invalid NULL value.
NULL
expire_time_column
InnoDB
innodb_page_size
daemon_memcached
loose-daemon_memcached_option='-c 64'
daemon_memcached_option='-c 64'
InnoDB
InnoDB
innodb_print_all_deadlocks
InnoDB
--console
InnoDB
InnoDB
InnoDB
InnoDB
InnoDB
CHECK TABLE
InnoDB
InnoDB
ibdata
InnoDB
InnoDB
InnoDB
InnoDB
my.cnf
innodb_data_home_dir
innodb_data_file_path
innodb_data_file_path
SELECT ... INTO
OUTFILE
tbl_name
InnoDB
innodb_force_recovery
[mysqld]
[mysqld]innodb_force_recovery = 1
innodb_force_recovery
innodb_force_recovery
innodb_force_recovery=1
innodb_force_recovery
innodb_force_recovery
innodb_force_recovery
InnoDB
INSERT
UPDATE
DELETE
innodb_force_recovery
innodb_force_recovery
1
SELECT * FROM
tbl_name
2
3
4
InnoDB
5
InnoDB
6
InnoDB
SELECT
innodb_force_recovery
CREATE
DROP
TABLE
innodb_force_recovery
DROP TABLE
innodb_force_recovery
ALTER TABLE
innodb_force_recovery
DROP
ORDER BY
primary_key
DESC
innodb_force_recovery
WHERE
SELECT * FROM t
InnoDB
innodb_file_per_table
.ibd
[错误] InnoDB:在文件操作数2操作系统错误。[错误] InnoDB:这个错误是系统找不到指定的路径。[错误]:不能为只读方式打开数据文件设置:'。/测试/ T1。IBD的操作系统错误:71 [警告] InnoDB表空间:忽略`试验/T1 `因为它无法打开。
DROP
TABLE
.ibd
.ibd
.ibd
.idb
mysql>CREATE DATABASE sakila;
mysql>USE sakila;
mysql>CREATE TABLE actor (
actor_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
first_name VARCHAR(45) NOT NULL,
last_name VARCHAR(45) NOT NULL,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (actor_id),
KEY idx_actor_last_name (last_name)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
mysql> ALTER TABLE sakila.actor DISCARD TABLESPACE;
.idb
内核> cp /
backup_directory
/actor.ibdpath/to/mysql-5.7/data
/sakila/
.ibd
.ibd
mysql> ALTER TABLE sakila.actor IMPORT TABLESPACE; SHOW WARNINGS;
Query OK, 0 rows affected, 1 warning (0.15 sec)
Warning | 1810 | InnoDB: IO Read error: (2, No such file or directory)
Error opening './sakila/actor.cfg', will attempt to import
without schema verification
.ibd
MySQL的> SELECT COUNT(*) FROM sakila.actor;
---------- |计数(*)| ---------- | 200 | ----------
InnoDB
Table is full
InnoDB
--innodb_rollback_on_timeout
--innodb_rollback_on_timeout
START
TRANSACTION
BEGIN
COMMIT
ROLLBACK
IGNORE
row too long error
InnoDB
ROLLBACK
SHOW PROCESSLIST
State