ΪʲôÎÒÃÇÐèÒªËø£¿Ïȱð¼±×Żش𡢻ØÏëÒ»ÏÂÎÒÃÇÔÚ¹äÌÔ±¦Ï¶©µ¥Ê±µÄÒ»¸ö³¡¾°£º
InnoDB ÊÇÐÐËø¡¢²»´æÔÚËøÉý¼¶ÎÊÌâ¡¢Ò²¾ÍÊÇ¡¢Ëøס 1 ÐкÍËøס 1 ǧÍòÐеĿªÏúÊÇÒ»Ñù,µ«ÊÇ¡¢InnoDB ÐÐËøÈÔÈ»´æÔÚÒ»°ãµÄËøÔڸ߲¢·¢ÏÂËùÌØÓеÄ"ÁÓ¸ùÐÔ":
¡ñ ¶ªÊ§¸üУºAµÄÐ޸ı»B¸²¸Ç¡¢Î½Ö®"Ç°ÀË×ܱ»ºóÀ˸Ç"
¡ñ Ôà¶Á£º²»Í¬ÊÂÎñ¼ä¡¢¶Áµ½Î´Ìá½»µÄÊý¾Ý
¡ñ ²»¿ÉÖظ´¶Á£ºÍ¬Ò»ÊÂÎñ¡¢Á½´Î¶Á²»Í¬
Íâ¼üÎÞË÷ÒýÊÇOracle ËÀËø·¢ÉúµÄ³£¼ûÔÒò¡¢¶øÔÚInnoDB ¡¢ÎҸϽš¢
InnoDB ÊÇ"ÂòÒ»ËÍÒ»"¡¢²¢ÇÒ¡¢²»ÒªÄãÒ²µÃÒª¡¢ÒòΪ¡¢
ÔÚ InnoDBÀï¡¢»á×Ô¶¯¶ÔÍâ¼üÌí¼ÓË÷Òý¡¢ÈËΪɾ³ýÍâ¼üË÷Òý»á±¨´í
ÓÐÐËȤµÄÅóÓÑ¡¢¶Ô×Ó±í show index from tbname; ±ã»á·¢ÏÖ
InnoDB ËøÓÐ 3ÖÖÀàÐÍ£º
¡ñ Record Lock£ºËø¶¨µ¥Ìõ¼Ç¼
¡ñ Gap Lock£ºËø¶¨Ò»¸ö·¶Î§µÄ¼Ç¼¡¢µ«²»°üÀ¨¼Ç¼±¾Éí
¡ñ Next-Key Lock£ºËø¶¨Ò»¸ö·¶Î§µÄ¼Ç¼¡¢²¢ÇÒ°üº¬¼Ç¼±¾Éí¡¢ÕâÊÇĬÈϵÄËøÀàÐÍ
ÄÇô¡¢ÎÒÃǸÃÈçºÎÏÔʾ¼Ó InnoDB ËøÄØ£¿ÓÐ 2ÖÖ·½Ê½£º
¡ñ select ... lock in share mode£º¼Ó S Ëø
¡ñ select ... for update£º¼Ó X Ëø
InnoDB ËøÐÔÄܼà¿Ø
mysql> show status like 'innodb_row_lock_%'; +-------------------------------+-------+ | Variable_name | Value | +-------------------------------+-------+ | Innodb_row_lock_current_waits | 0 | | Innodb_row_lock_time | 23265 | | Innodb_row_lock_time_avg | 2115 | | Innodb_row_lock_time_max | 7401 | | Innodb_row_lock_waits | 11 | +-------------------------------+-------+ 5 rows in set (0.00 sec)
½âÊÍÈçÏ£º
Innodb_row_lock_current_waits£ºµ±Ç°µÈ´ýËøµÄÊýÁ¿
Innodb_row_lock_time£ºÏµÍ³Æô¶¯µ½ÏÖÔÚ¡¢Ëø¶¨µÄ×Üʱ¼ä³¤¶È
Innodb_row_lock_time_avg£ºÃ¿´Îƽ¾ùËø¶¨µÄʱ¼ä
Innodb_row_lock_time_max£º×һ´ÎËø¶¨Ê±¼ä
Innodb_row_lock_waits£ºÏµÍ³Æô¶¯µ½ÏÖÔÚ¡¢×ܹ²Ëø¶¨´ÎÊý
Ó°Ïì InnoDB µÄ¼¸¸ö²ÎÊý
mysql> select @@global.tx_isolation; +-----------------------+ | @@global.tx_isolation | +-----------------------+ | REPEATABLE-READ | +-----------------------+ --É趨ÊÂÎñ¸ôÀ뼶±ð mysql> select @@global.autocommit; +---------------------+ | @@global.autocommit | +---------------------+ | 1 | +---------------------+ --×Ô¶¯Ìá½» mysql> select @@global.innodb_table_locks; +-----------------------------+ | @@global.innodb_table_locks | +-----------------------------+ | 1 | +-----------------------------+ --InnoDB ÄÚ²¿Ëø¶¨Ò»¸ö±í mysql> select @@global.innodb_lock_wait_timeout; +-----------------------------------+ | @@global.innodb_lock_wait_timeout | +-----------------------------------+ | 50 | +-----------------------------------+ --¿ØÖƵȴýʱ¼ä mysql> select @@global.innodb_locks_unsafe_for_binlog; +-----------------------------------------+ | @@global.innodb_locks_unsafe_for_binlog | +-----------------------------------------+ | 0 | +-----------------------------------------+ --insert into ...select ÊÇ·ñËø¶¨Ô´±í
ÍƼöÐÅÏ¢
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
ÆÀÂÛ