{"id":773,"date":"2014-07-29T00:35:09","date_gmt":"2014-07-28T15:35:09","guid":{"rendered":"http:\/\/tech.akat.info\/?p=773"},"modified":"2014-10-15T02:25:06","modified_gmt":"2014-10-14T17:25:06","slug":"mysql-innodb","status":"publish","type":"post","link":"https:\/\/tech.akat.info\/?p=773","title":{"rendered":"MySQL &#8211; InnoDB"},"content":{"rendered":"<h1>\u30b9\u30c8\u30ec\u30fc\u30b8\u30a8\u30f3\u30b8\u30f3<\/h1>\n<p>\u3069\u306e\u3088\u3046\u306b\u30c7\u30fc\u30bf\u3092\u683c\u7d0d\u3059\u308b\u304b\u3001\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u3092\u51e6\u7406\u3059\u308b\u304b\u306a\u3069\u306fMySQL\u72ec\u81ea\u306e\u300c\u30b9\u30c8\u30ec\u30fc\u30b8\u30a8\u30f3\u30b8\u30f3\u300d\u3067\u5b9f\u88c5\u3057\u3066\u3044\u308b<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nmysql&gt; show engines\\G # \u5229\u7528\u53ef\u80fd\u306a\u30b9\u30c8\u30ec\u30fc\u30b8\u30a8\u30f3\u30b8\u30f3\u3059\u308b\r\n+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+\r\n| Engine             | Support | Comment                                                                    | Transactions | XA   | Savepoints |\r\n+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+\r\n| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables                  | NO           | NO   | NO         |\r\n| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                                      | NO           | NO   | NO         |\r\n| MyISAM             | YES     | MyISAM storage engine                                                      | NO           | NO   | NO         |\r\n| BLACKHOLE          | YES     | \/dev\/null storage engine (anything you write to it disappears)             | NO           | NO   | NO         |\r\n| InnoDB             | DEFAULT | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys | YES          | YES  | YES        |\r\n| PERFORMANCE_SCHEMA | YES     | Performance Schema                                                         | NO           | NO   | NO         |\r\n| ARCHIVE            | YES     | Archive storage engine                                                     | NO           | NO   | NO         |\r\n| SPHINX             | YES     | Sphinx storage engine                                                      | NO           | NO   | NO         |\r\n| FEDERATED          | YES     | FederatedX pluggable storage engine                                        | YES          | NO   | YES        |\r\n| CSV                | YES     | CSV storage engine                                                         | NO           | NO   | NO         |\r\n| Aria               | YES     | Crash-safe tables with MyISAM heritage                                     | NO           | NO   | NO         |\r\n+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+\r\n<\/pre>\n<h1>\u4e3b\u306a\u6a5f\u80fd<\/h1>\n<ul>\n<li>InnoDB\u306e\u30c7\u30fc\u30bf\u30b5\u30a4\u30ba\u306e\u4e0a\u9650\u306f64TB<\/li>\n<li>\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u5bfe\u5fdc<\/li>\n<li>\u30af\u30e9\u30c3\u30b7\u30e5\u30ea\u30ab\u30d0\u30ea<\/li>\n<li>\u30c7\u30fc\u30bf\u3068\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u8868\u9818\u57df\u306b\u683c\u7d0d<\/li>\n<li>\u5916\u90e8\u30ad\u30fc\u306e\u30b5\u30dd\u30fc\u30c8<\/li>\n<\/ul>\n<h1>\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3<\/h1>\n<p>InnoDB\u306fMVCC (Multi Version Concurrency Control)\u3067\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u3092\u5b9f\u88c5<br \/>\n\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u958b\u59cb\u6642\u306b\u30c7\u30a3\u30b9\u30af\u4e0a\u306e\u30c7\u30fc\u30bf\u3092\u30e1\u30e2\u30ea\u4e0a\u306e\u300c\u30d0\u30c3\u30d5\u30a1\u30d7\u30fc\u30eb\u300d\u306b\u30b3\u30d4\u30fc\u3057\u3001\u4ee5\u964d\u306e\u64cd\u4f5c\u3092\u30e1\u30e2\u30ea\u4e0a\u3067\u884c\u3046<\/p>\n<p>\u30b3\u30df\u30c3\u30c8\u304c\u5b9f\u884c\u3055\u308c\u308b\u3068\u30c7\u30a3\u30b9\u30af\u4e0a\u306e\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u51fa\u3055\u308c\u308b<br \/>\n\u3053\u306e\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u3092\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u30ed\u30b0(InnoDB\u30ed\u30b0\u3001WAL(Write Ahead Log)\u3068\u3082)\u3068\u547c\u3073\u3001\u3053\u306e\u30ed\u30b0\u3067\u30af\u30e9\u30c3\u30b7\u30e5\u30ea\u30ab\u30d0\u30ea\u3092\u5b9f\u73fe\u3059\u308b<br \/>\n\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u30ed\u30b0\u3078\u306e\u66f8\u304d\u8fbc\u307f\u306f\u30b7\u30fc\u30b1\u30f3\u30b7\u30e3\u30eb\u3067\u3042\u308a\u3001\u30b7\u30fc\u30af\u6642\u9593\u304c\u306a\u304f\u3068\u3066\u3082\u901f\u3044<br \/>\n\u30b3\u30df\u30c3\u30c8\u6642\u306b\u767a\u751f\u3059\u308b\u30c7\u30a3\u30b9\u30af\u3078\u306e\u66f8\u304d\u8fbc\u307f\u306f\u30ed\u30b0\u306e\u307f\u3067\u3001\u30c7\u30fc\u30bf\u305d\u306e\u3082\u306e\u306f\u30c1\u30a7\u30c3\u30af\u30dd\u30a4\u30f3\u30c8\u3068\u547c\u3070\u308c\u308b\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u5225\u9014\u30c6\u30fc\u30d6\u30eb\u30b9\u30da\u30fc\u30b9\u306b\u66f8\u304d\u51fa\u3055\u308c\u308b<br \/>\n\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u30ed\u30b0\u3068\u30c6\u30fc\u30d6\u30eb\u30b9\u30da\u30fc\u30b9\u3092\u5408\u308f\u305b\u3066\u3001\u3059\u3079\u3066\u306e\u30c7\u30fc\u30bf\u3068\u306a\u308b\u3053\u3068\u306b\u6ce8\u610f<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nmysql&gt; show variables like 'innodb_max_dirty_pages_pct';\r\n+----------------------------+-------+\r\n| Variable_name              | Value |\r\n+----------------------------+-------+\r\n| innodb_max_dirty_pages_pct | 75    |  # \u30c0\u30fc\u30c6\u30a3\u30da\u30fc\u30b8\u304c75%\u3092\u8d8a\u3048\u308b\u3068\u3001\u5f37\u5236\u7684\u306b\u30c1\u30a7\u30c3\u30af\u30dd\u30a4\u30f3\u30c8\r\n+----------------------------+-------+\r\n1 row in set (0.00 sec)\r\n\r\nmysql&gt; show variables like 'innodb_doublewrite';\r\n+--------------------+-------+\r\n| Variable_name      | Value |\r\n+--------------------+-------+\r\n| innodb_doublewrite | ON    | # \u30c6\u30fc\u30d6\u30eb\u30b9\u30da\u30fc\u30b9\u53cd\u6620\u76f4\u524d\u306b\u3053\u3061\u3089\u306b\u66f8\u304d\u51fa\u3057\u3066\u304b\u3089\u3001\u53cd\u6620\u3059\u308b\u3002\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u3067\u3044\u3046\u30b8\u30e3\u30fc\u30ca\u30eb\r\n+--------------------+-------+\r\n1 row in set (0.00 sec)\r\n<\/pre>\n<h1>\u30d5\u30a1\u30a4\u30eb\u69cb\u6210<\/h1>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nmysql&gt; create table novel(id int) engine=MyISAM;\r\nQuery OK, 0 rows affected (0.01 sec)\r\n\r\nmysql&gt; create table magazine(id int) engine=InnoDB;\r\nQuery OK, 0 rows affected (0.05 sec)\r\n\r\nroot@akat:\/var\/lib\/mysql\/books# ls \/var\/lib\/mysql\/\r\nbooks\r\nib_logfile0\r\nib_logfile1\r\nibdata1\r\n\r\nroot@akat:\/var\/lib\/mysql\/books# ls\r\ndb.opt  magazine.frm  novel.MYD  novel.MYI  novel.frm\r\n\r\n# table_name.frm      \u30c6\u30fc\u30d6\u30eb\u5b9a\u7fa9\u306e\u4fdd\u5b58\r\n# \u203b\u30c6\u30fc\u30d6\u30eb\u69cb\u9020\u306e\u30c7\u30fc\u30bf\u306f\u3001\u30c6\u30fc\u30d6\u30eb\u540d.frm\u30d5\u30a1\u30a4\u30eb\u5185\u3060\u3051\u3067\u306a\u304f\u3001\u30c6\u30fc\u30d6\u30eb\u30b9\u30da\u30fc\u30b9\u5185\u306b\u3082\u683c\u7d0d\u3055\u308c\u308b\r\n# table_name.MYD      \u30c6\u30fc\u30d6\u30eb\u30c7\u30fc\u30bf\u306e\u4fdd\u5b58\r\n# table_name.MYI      \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u4fdd\u5b58\r\n# ibdata1            \u30c6\u30fc\u30d6\u30eb\u30c7\u30fc\u30bf\u3084\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u4fdd\u5b58(\u30c6\u30fc\u30d6\u30eb\u30b9\u30da\u30fc\u30b9\u3068\u547c\u3070\u308c\u308b)\r\n# ib_logfile0,ib_logfile1        \u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\r\n\r\n# \u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u8a2d\u5b9a\u3067\u306f1\u3064\u3068\u306a\u3063\u3066\u304a\u308a\u300110MB\u306e\u30b5\u30a4\u30ba\u30c7\u30fc\u30bf\u304c\u683c\u7d0d\u3055\u308c\u3066\u5bb9\u91cf\u304c\u8db3\u308a\u306a\u304f\u306a\u308b\u3068\u81ea\u52d5\u3067\u62e1\u5f35\u3055\u308c\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\r\nmysql&gt; show variables like 'innodb_data_file_path';\r\n+-----------------------+------------------------+\r\n| Variable_name         | Value                  |\r\n+-----------------------+------------------------+\r\n| innodb_data_file_path | ibdata1:10M:autoextend |\r\n+-----------------------+------------------------+\r\n1 row in set (0.00 sec)\r\n\r\nmysql&gt; show variables like 'innodb_log_file_%';\r\n+---------------------------+---------+\r\n| Variable_name             | Value   |\r\n+---------------------------+---------+\r\n| innodb_log_file_size      | 5242880 |\r\n| innodb_log_files_in_group | 2       |\r\n+---------------------------+---------+\r\n2 rows in set (0.00 sec)\r\n\r\nmysql&gt; show table status from books like 'magazine'\\G\r\n*************************** 1. row ***************************\r\n           Name: magazine\r\n         Engine: InnoDB\r\n        Version: 10\r\n     Row_format: Compact\r\n           Rows: 0\r\n Avg_row_length: 0\r\n    Data_length: 16384\r\nMax_data_length: 0\r\n   Index_length: 0\r\n      Data_free: 11534336\r\n Auto_increment: NULL\r\n    Create_time: 2013-08-07 22:01:53\r\n    Update_time: NULL\r\n     Check_time: NULL\r\n      Collation: utf8_general_ci\r\n       Checksum: NULL\r\n Create_options:\r\n        Comment:\r\n1 row in set (0.00 sec)\r\n\r\n# \u30c7\u30d5\u30a9\u30eb\u30c8\u78ba\u8a8d\u65b9\u6cd5\r\nmysql&gt; select @@storage_engine;\r\n+------------------+\r\n| @@storage_engine |\r\n+------------------+\r\n| InnoDB           |\r\n+------------------+\r\n1 row in set (0.00 sec)\r\n\r\n<\/pre>\n<p>\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u30ed\u30b0(InnoDB\u30ed\u30b0\u3068\u3082)\u306b\u3064\u3044\u3066\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u8a2d\u5b9a\u3067\u306f1\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u304c10MB\u3001\u30d5\u30a1\u30a4\u30eb\u6570\u306f2\u3064\u3067\u30ed\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3<br \/>\n\u3064\u307e\u308a\u3001\u8907\u6570\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u30c7\u30fc\u30bf\u3068\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30921\u3064\u306e\u3053\u306e2\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u683c\u7d0d\u3063\u3059\u308b<br \/>\n\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001\u3042\u3089\u304b\u3058\u3081\u5bb9\u91cf\u3092\u8a2d\u5b9a\u3057\u3066\u304a\u304f\u3053\u3068\u3084\u3001\u5bb9\u91cf\u3092\u81ea\u52d5\u62e1\u5f35\u3059\u308bautoextend\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u8a2d\u5b9a\u53ef\u80fd<br \/>\n\u8907\u6570\u30d5\u30a1\u30a4\u30eb\u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u306f\u3001autoextend\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u4f7f\u3048\u308b\u306e\u306f\u30ea\u30b9\u30c8\u306e\u6700\u5f8c\u306b\u66f8\u304b\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u307f<br \/>\n\u307e\u305f\u3001innodb-file-per-table\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4f7f\u3046\u3068\u3001\u30c6\u30fc\u30d6\u30eb\u3054\u3068\u306b\u30c7\u30fc\u30bf\u3068\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u683c\u7d0d\u3059\u308b\u8868\u9818\u57df\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b<br \/>\n\u203bInnoDB \u306f\u30b5\u30fc\u30d0\u3092\u518d\u8d77\u52d5\u3059\u308b\u6642\u306b\u30d5\u30a1\u30a4\u30eb(\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u30ed\u30b0)\u3092\u4f5c\u6210\u3057\u3001\u521d\u671f\u5316\u3057\u3066\u3044\u308b<br \/>\n\u3000\u65e2\u5b58\u306e\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u30ed\u30b0\u304c\u8a2d\u5b9a\u3088\u308a\u3082\u5927\u304d\u304b\u3063\u305f\u308a\u3059\u308c\u3070\u3001InnoDB\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u30a8\u30e9\u30fc\u3068\u306a\u308b<\/p>\n<h1>\u30af\u30e9\u30b9\u30bf\u30fc\u30c9\u30a4\u30f3\u30c7\u30c3\u30af\u30b9<\/h1>\n<p><a href=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/07\/2.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/07\/2.gif\" alt=\"2\" width=\"450\" height=\"250\" class=\"alignnone size-full wp-image-796\" \/><\/a><br \/>\nInnoDB\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3068\u3001\u30af\u30e9\u30b9\u30bf\u30fc\u30c9\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f5c\u6210\u3059\u308b<br \/>\n\u5168\u3066\u306e InnoDB \u30c6\u30fc\u30d6\u30eb\u306f\u3001\u884c\u306e\u30c7\u30fc\u30bf\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b clustered index \u3068\u547c\u3070\u308c\u308b\u7279\u5225\u306a\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u6301\u3063\u3066\u3044\u308b<br \/>\n\u901a\u5e38\u4e3b\u30ad\u30fc\u306b\u8a2d\u5b9a\u3055\u308c\u308b\u304c\u3001\u4e3b\u30ad\u30fc\u304c\u306a\u3044\u5834\u5408\u306f\u3001InnoDB\u304c\u81ea\u52d5\u7684\u306b6\u30d0\u30a4\u30c8\u306e\u30ed\u30fcID\u3068\u547c\u3076\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u30ec\u30b3\u30fc\u30c9\u306b\u8ffd\u52a0\u3057\u3001\u3053\u306e\u30ed\u30fcID\u3092\u7528\u3044\u3066\u30af\u30e9\u30b9\u30bf\u30fc\u30c9\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u69cb\u6210\u3059\u308b<\/p>\n<p>\u30bb\u30ab\u30f3\u30c0\u30ea\u30a4\u30f3\u30c7\u30c3\u30af\u30b9(\u901a\u5e38\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9)\u306f\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u691c\u7d22\u7d50\u679c\u304b\u3089\u5b9f\u30c6\u30fc\u30d6\u30eb\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b<br \/>\n\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u7528\u306e\u30da\u30fc\u30b8\u304c\u3042\u308a\u3001\u305d\u3053\u306b\u30ad\u30fc\u3068\u30ed\u30b1\u30fc\u30bf\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u3002\u30ed\u30b1\u30fc\u30bf\u3092\u983c\u308a\u306b\u5b9f\u30c6\u30fc\u30d6\u30eb\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b<br \/>\n\u3053\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u7528\u306e\u30da\u30fc\u30b8(\u30ea\u30fc\u30d5\u3068\u547c\u3070\u308c\u308b)\u3068\u5b9f\u30c6\u30fc\u30d6\u30eb\u30a2\u30af\u30bb\u30b9\u306f\u3001\u30a2\u30af\u30bb\u30b9\u983b\u5ea6\u304b\u3089\u30ad\u30e3\u30c3\u30b7\u30e5\u3055\u308c\u306b\u304f\u304f\u30e1\u30e2\u30ea\u3067\u306f\u306a\u304f\u30c7\u30a3\u30b9\u30af\u30a2\u30af\u30bb\u30b9\u3068\u306a\u308a\u4f4e\u901f\u3068\u306a\u308b<\/p>\n<p>\u3057\u304b\u3057\u30af\u30e9\u30b9\u30bf\u30fc\u30c9\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u691c\u7d22\u7d50\u679c(\u30ea\u30fc\u30d5)\u304c\u30c6\u30fc\u30d6\u30eb\u306e\u30ec\u30b3\u30fc\u30c9\u3068\u306a\u3063\u3066\u3044\u308b\u305f\u3081<br \/>\n\u5b9f\u30c6\u30fc\u30d6\u30eb\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u5fc5\u8981\u304c\u306a\u304f\u306a\u308a\u3001\u30e9\u30f3\u30c0\u30e0\u30ea\u30fc\u30c9\u304c\u5c11\u306a\u304f\u306a\u308b\u305f\u3081\u3001\u9ad8\u901f\u306b\u52d5\u4f5c\u3059\u308b<br \/>\n\u307e\u305f\u30c7\u30a3\u30b9\u30af\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u304d\u306f\u30011\u30a8\u30af\u30b9\u30c6\u30f3\u30c8(16KB(1\u30d6\u30ed\u30c3\u30af\u3042\u305f\u308a\u306e\u5bb9\u91cf) * 64\u30d6\u30ed\u30c3\u30af)\u3092\u5148\u8aad\u307f\u3057\u306a\u308b\u3079\u304f\u30c7\u30a3\u30b9\u30af\u30a2\u30af\u30bb\u30b9\u3092\u6e1b\u3089\u3059\u4ed5\u7d44\u307f\u306b\u306a\u3063\u3066\u3044\u308b<br \/>\n(MyISAM\u306fread_buffer_size\u3067\u6307\u5b9a\u3057\u305f\u6587\u3092\u5148\u8aad\u307f\u3059\u308b)<\/p>\n<p>\u30c7\u30e1\u30ea\u30c3\u30c8<\/p>\n<ul>\n<li>\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u30b5\u30a4\u30ba\u304c\u5927\u304d\u304f\u306a\u308b<\/li>\n<li>\u30c7\u30fc\u30bf\u8ffd\u52a0\u6642\u306e\u30aa\u30fc\u30d0\u30d8\u30c3\u30c9\u304c\u5927\u304d\u3044<\/li>\n<li>\u30bb\u30ab\u30f3\u30c0\u30ea\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u7528\u3044\u305f\u691c\u7d22\u304c\u9045\u304f\u306a\u308b<\/li>\n<p>\u3000\u3000\u3000(\u30af\u30e9\u30b9\u30bf\u30fc\u30c9\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u7528\u3044\u308b\u5834\u5408\u3001\u30c7\u30fc\u30bf\u306f\u3059\u3079\u3066\u4e3b\u30ad\u30fc\u306b\u683c\u7d0d\u3055\u308c\u305f\u7279\u6b8a\u306a\u69cb\u9020\u3068\u306a\u308b\u305f\u3081\u3001\u30bb\u30ab\u30f3\u30c0\u30ea\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3082\u7279\u6b8a\u306a\u69cb\u9020\u3068\u306a\u308b)\n<\/ul>\n<p><a href=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/07\/2014-08-11_005625.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/07\/2014-08-11_005625.png\" alt=\"2014-08-11_005625\" width=\"882\" height=\"661\" class=\"alignnone size-full wp-image-819\" \/><\/a><\/p>\n<pre class=\"brush: plain; title: \u30af\u30e9\u30b9\u30bf\u30fc\u30c9\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f5c\u6210; notranslate\" title=\"\u30af\u30e9\u30b9\u30bf\u30fc\u30c9\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f5c\u6210\">\r\nmysql&gt; create table personal(id int, name varchar(20));\r\nQuery OK, 0 rows affected (0.14 sec)\r\n\r\nmysql&gt; desc personal;\r\n+-------+-------------+------+-----+---------+-------+\r\n| Field | Type        | Null | Key | Default | Extra |\r\n+-------+-------------+------+-----+---------+-------+\r\n| id    | int(11)     | YES  |     | NULL    |       |\r\n| name  | varchar(20) | YES  |     | NULL    |       |\r\n+-------+-------------+------+-----+---------+-------+\r\n2 rows in set (0.00 sec)\r\n\r\nmysql&gt; ALTER TABLE personal ADD PRIMARY KEY(id);\r\nQuery OK, 1 row affected (0.09 sec)\r\nRecords: 1  Duplicates: 0  Warnings: 0\r\n\r\nmysql&gt; show index from personal\\G\r\n*************************** 1. row ***************************\r\n        Table: personal\r\n   Non_unique: 0\r\n     Key_name: PRIMARY # MySQL\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u7a2e\u985e\u306fPRIMARY\u30fbINDEX\u30fbUNIQUE\u30fbFULLTEXT\u3060\u3051\u3067\u3042\u308a\u3001PRIMARY\u304c\u3042\u308c\u3070\u305d\u308c\u3092\u30af\u30e9\u30b9\u30bf\u30fc\u30c9\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3068\u3057\u3066\u5229\u7528\u3057\u3001\u306a\u3051\u308c\u3070UNIQUE(\u305f\u3060\u3057NOT NULL\u3067\u3042\u308b\u3053\u3068)\u3092\u5229\u7528\u3057\u3001\u305d\u308c\u3082\u306a\u3051\u308c\u3070\u5185\u90e8\u306b\u4fdd\u6301\u3059\u308b\r\n Seq_in_index: 1\r\n  Column_name: id\r\n    Collation: A\r\n  Cardinality: 1\r\n     Sub_part: NULL\r\n       Packed: NULL\r\n         Null:\r\n   Index_type: BTREE\r\n      Comment:\r\nIndex_comment:\r\n1 row in set (0.00 sec)\r\n<\/pre>\n<h1>\u30af\u30e9\u30c3\u30b7\u30e5\u30ea\u30ab\u30d0\u30ea\u306b\u3064\u3044\u3066<\/h1>\n<p>MySQL\u306f\u518d\u8d77\u52d5\u6642\u306bib_logfile\u304b\u3089\u30b3\u30df\u30c3\u30c8\u3055\u308c\u305f\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u3092\u8aad\u307f\u51fa\u3057\u3001\u305d\u308c\u304c\u5b9f\u30c7\u30fc\u30bf\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u3060\u3068 ibdata\uff09\u306b\u53cd\u6620\u3055\u308c\u3066\u3044\u306a\u3051\u308c\u3070\u53cd\u6620\u3055\u305b\u308b\u3068\u3044\u3046\u51e6\u7406\u304c\u8d70\u308b<br \/>\ninnodb_flush_log_at_trx_commit\u306e\u5024\u306b\u3088\u308a\u30011\u79d2\u6bce\u3001\u307e\u305f\u306f\u30b3\u30df\u30c3\u30c8\u6bce\u306b\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u3092\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u306b\u30d5\u30e9\u30c3\u30b7\u30e5\u3059\u308b<\/p>\n<p>0\u306e\u5834\u5408\u3001\u30b3\u30df\u30c3\u30c8\u3055\u308c\u305f\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u306f1\u79d2\u6bce\u306b\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u306b\u30d5\u30e9\u30c3\u30b7\u30e5\u3055\u308c\u3001\u30b3\u30df\u30c3\u30c8\u6bce\u306b\u306f\u30d5\u30e9\u30c3\u30b7\u30e5\u3055\u308c\u306a\u3044<br \/>\n1\u306e\u5834\u5408\u306f\u30b3\u30df\u30c3\u30c8\u3055\u308c\u305f\u30af\u30a8\u30ea\u306f\u90fd\u5ea6\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u306b\u30d5\u30e9\u30c3\u30b7\u30e5\u3055\u308c\u308b\u306e\u3067\u3001\u5931\u308f\u308c\u308b\u30c7\u30fc\u30bf\u306f\u7406\u8ad6\u4e0a0\u3068\u306a\u308b<\/p>\n<h1>SHOW ENGINE INNODB STATUS<\/h1>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nmysql&gt; SHOW ENGINE INNODB STATUS\\G # MySQL5.5\u3067\u306f&quot;SHOW INNODB STATUS&quot;\u304c\u5ec3\u6b62\u3055\u308c\u3066\u3044\u308b\r\n*************************** 1. row ***************************\r\n  Type: InnoDB\r\n  Name:\r\nStatus:\r\n=====================================\r\n140803  3:54:56 INNODB MONITOR OUTPUT\r\n=====================================\r\nPer second averages calculated from the last 31 seconds\r\n-----------------\r\nBACKGROUND THREAD\r\n-----------------\r\nsrv_master_thread loops: 26526 1_second, 26526 sleeps, 2349 10_second, 3059 background, 3059 flush\r\nsrv_master_thread log flush and writes: 171015\r\n----------\r\nSEMAPHORES\r\n----------\r\nOS WAIT ARRAY INFO: reservation count 2961, signal count 2958\r\nMutex spin waits 1188, rounds 35640, OS waits 1164\r\nRW-shared spins 1778, rounds 53313, OS waits 1772\r\nRW-excl spins 6, rounds 750, OS waits 25\r\nSpin rounds per wait: 30.00 mutex, 29.98 RW-shared, 125.00 RW-excl\r\n--------\r\nFILE I\/O\r\n--------\r\nI\/O thread 0 state: waiting for completed aio requests (insert buffer thread)\r\nI\/O thread 1 state: waiting for completed aio requests (log thread)\r\nI\/O thread 2 state: waiting for completed aio requests (read thread)\r\nI\/O thread 3 state: waiting for completed aio requests (read thread)\r\nI\/O thread 4 state: waiting for completed aio requests (read thread)\r\nI\/O thread 5 state: waiting for completed aio requests (read thread)\r\nI\/O thread 6 state: waiting for completed aio requests (write thread)\r\nI\/O thread 7 state: waiting for completed aio requests (write thread)\r\nI\/O thread 8 state: waiting for completed aio requests (write thread)\r\nI\/O thread 9 state: waiting for completed aio requests (write thread)\r\nPending normal aio reads: 0 &#x5B;0, 0, 0, 0] , aio writes: 0 &#x5B;0, 0, 0, 0] ,\r\n ibuf aio reads: 0, log i\/o's: 0, sync i\/o's: 0\r\nPending flushes (fsync) log: 0; buffer pool: 0\r\n4969 OS file reads, 77138 OS file writes, 35149 OS fsyncs\r\n0.00 reads\/s, 0 avg bytes\/read, 0.00 writes\/s, 0.00 fsyncs\/s\r\n-------------------------------------\r\nINSERT BUFFER AND ADAPTIVE HASH INDEX\r\n-------------------------------------\r\nIbuf: size 1, free list len 0, seg size 2, 0 merges\r\nmerged operations:\r\n insert 0, delete mark 0, delete 0\r\ndiscarded operations:\r\n insert 0, delete mark 0, delete 0\r\nHash table size 553229, node heap has 17 buffer(s)\r\n0.00 hash searches\/s, 0.00 non-hash searches\/s\r\n---\r\nLOG\r\n---\r\nLog sequence number 244707017 # \u30ed\u30b0\u30d0\u30c3\u30d5\u30a1\u3078\u306e\u66f4\u65b0\u304c\u884c\u308f\u308c\u305f\u30c8\u30fc\u30bf\u30eb\u306e\u30d0\u30a4\u30c8\u6570\r\nLog flushed up to   244707017 # \u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u30ed\u30b0\u3078\u306e\u66f8\u304d\u8fbc\u307f\u304c\u884c\u308f\u308c\u305f\u30d0\u30a4\u30c8\u6570\r\nLast checkpoint at  244707017 # \u6700\u5f8c\u306b\u30c1\u30a7\u30c3\u30af\u30dd\u30a4\u30f3\u30c8\u304c\u884c\u308f\u308c\u305f\u30d0\u30a4\u30c8\u6570\r\n# \u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u30ed\u30b0\u306b\u306f\u30c1\u30a7\u30c3\u30af\u30dd\u30a4\u30f3\u30c8\u304c\u5b8c\u4e86\u3057\u3066\u3044\u306a\u3044\u5168\u3066\u306e\u30c7\u30fc\u30bf\u3092\u8a18\u9332\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u305f\u3081\u3001&#x5B;Log sequence number] - &#x5B;Last checkpoint] \u306e\u5024\u304c\u3001&#x5B;innodb_log_file_size] * &#x5B;innodb_log_files_in_group]\u306e\u5024\u3092\u8d85\u3048\u3066\u3044\u308b\u5834\u5408\u3001innodb_log_file_size\u3092\u8abf\u6574\u3057\u305f\u307b\u3046\u304c\u3088\u3044\r\nMax checkpoint age    7782360\r\nCheckpoint age target 7539162\r\nModified age          0\r\nCheckpoint age        0\r\n0 pending log writes, 0 pending chkp writes\r\n27132 log i\/o's done, 0.00 log i\/o's\/second\r\n----------------------\r\nBUFFER POOL AND MEMORY\r\n----------------------\r\nTotal memory allocated 275513344; in additional pool allocated 0\r\nTotal memory allocated by read views 104\r\nInternal hash tables (constant factor + variable factor)\r\n    Adaptive hash index 4708576         (4425832 + 282744)\r\n    Page hash           277432 (buffer pool 0 only)\r\n    Dictionary cache    1243539         (1107952 + 135587)\r\n    File system         88720   (82672 + 6048)\r\n    Lock system         665312  (664936 + 376)\r\n    Recovery system     0       (0 + 0)\r\nDictionary memory allocated 135587\r\nBuffer pool size        16383\r\nBuffer pool size, bytes 268419072\r\nFree buffers            10469\r\nDatabase pages          5897\r\nOld database pages      2156\r\nModified db pages       0\r\nPending reads 0\r\nPending writes: LRU 0, flush list 0, single page 0\r\nPages made young 4, not young 0\r\n0.00 youngs\/s, 0.00 non-youngs\/s\r\nPages read 4946, created 951, written 48133\r\n0.00 reads\/s, 0.00 creates\/s, 0.00 writes\/s\r\nNo buffer pool page gets since the last printout\r\nPages read ahead 0.00\/s, evicted without access 0.00\/s, Random read ahead 0.00\/s\r\nLRU len: 5897, unzip_LRU len: 0\r\nI\/O sum&#x5B;0]:cur&#x5B;0], unzip sum&#x5B;0]:cur&#x5B;0]\r\n--------------\r\nROW OPERATIONS\r\n--------------\r\n0 queries inside InnoDB, 0 queries in queue\r\n1 read views open inside InnoDB\r\n0 transactions active inside InnoDB\r\n0 out of 1000 descriptors used\r\n---OLDEST VIEW---\r\nNormal read view\r\nRead view low limit trx n:o 4D48A\r\nRead view up limit trx id 4D48A\r\nRead view low limit trx id 4D48A\r\nRead view individually stored trx ids:\r\n-----------------\r\nMain thread process no. 19340, id 140199879227136, state: flushing log\r\nNumber of rows inserted 7915, updated 3271, deleted 17141, read 2925543\r\n0.00 inserts\/s, 0.00 updates\/s, 0.00 deletes\/s, 0.00 reads\/s\r\n------------\r\nTRANSACTIONS\r\n------------\r\nTrx id counter 4D48A\r\nPurge done for trx's n:o &lt; 4D483 undo n:o &lt; 0\r\nHistory list length 1391\r\nLIST OF TRANSACTIONS FOR EACH SESSION:\r\n---TRANSACTION 0, not started\r\nMySQL thread id 8631, OS thread handle 0x7f82fea98700, query id 169975 localhost root\r\nSHOW ENGINE INNODB STATUS\r\n----------------------------\r\nEND OF INNODB MONITOR OUTPUT\r\n============================\r\n\r\n1 row in set (0.00 sec)\r\n<\/pre>\n<h1>\u53c2\u8003URL<\/h1>\n<p>http:\/\/www.dbonline.jp\/mysql\/storage\/index3.html<br \/>\nhttp:\/\/akio0911.net\/archives\/2601<br \/>\nhttp:\/\/enterprisezine.jp\/dbonline\/detail\/3711<br \/>\nhttp:\/\/nippondanji.blogspot.jp\/2009\/01\/innodb.html<br \/>\nhttp:\/\/nippondanji.blogspot.jp\/2010\/10\/innodb.html<br \/>\nhttp:\/\/blog.livedoor.jp\/sasata299\/archives\/51336006.html<\/p>\n<div class=\"oceanwp-oembed-wrap clr\"><iframe loading=\"lazy\" src=\"https:\/\/www.slideshare.net\/slideshow\/embed_code\/key\/kawMdXa6tPbB9\" width=\"427\" height=\"356\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" style=\"border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;\" allowfullscreen> <\/iframe> <\/p>\n<div style=\"margin-bottom:5px\"> <strong> <a href=\"https:\/\/www.slideshare.net\/crooz_techblog\/mysql-index-26016127\" title=\"MySQL Index\u52c9\u5f37\u4f1a\u5916\u90e8\u516c\u958b\u7528\" target=\"_blank\">MySQL Index\u52c9\u5f37\u4f1a\u5916\u90e8\u516c\u958b\u7528<\/a> <\/strong> from <strong><a href=\"http:\/\/www.slideshare.net\/crooz_techblog\" target=\"_blank\">CROOZ, inc.<\/a><\/strong> <\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u30b9\u30c8\u30ec\u30fc\u30b8\u30a8\u30f3\u30b8\u30f3 \u3069\u306e\u3088\u3046\u306b\u30c7\u30fc\u30bf\u3092\u683c\u7d0d\u3059\u308b\u304b\u3001\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u3092\u51e6\u7406\u3059\u308b\u304b\u306a\u3069\u306fMySQL\u72ec\u81ea\u306e\u300c\u30b9\u30c8\u30ec\u30fc\u30b8\u30a8\u30f3\u30b8\u30f3\u300d\u3067\u5b9f\u88c5\u3057\u3066\u3044\u308b mysql&gt; show engines\\G # \u5229\u7528\u53ef\u80fd\u306a\u30b9\u30c8\u30ec\u30fc\u30b8\u30a8\u30f3\u30b8\u30f3 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[14],"tags":[],"_links":{"self":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/773"}],"collection":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=773"}],"version-history":[{"count":16,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/773\/revisions"}],"predecessor-version":[{"id":1129,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/773\/revisions\/1129"}],"wp:attachment":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=773"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=773"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=773"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}