mysql ENGINE=InnoDB
InnoDB ¸ø MySQL ÌṩÁ˾ßÓÐÊÂÎñ(commit)¡¢»Ø¹ö(rollback)ºÍ±ÀÀ£ÐÞ¸´ÄÜÁ¦(crash recovery capabilities)¡¢¶à°æ±¾²¢·¢¿ØÖÆ(multi-versioned concurrency control)µÄÊÂÎñ°²È«(transaction-safe (ACID compliant))ÐÍ±í¡£InnoDB ÌṩÁËÐм¶Ëø(locking on row level)£¬ÌṩÓë Oracle ÀàËƵIJ»¼ÓËø¶ÁÈ¡(non-locking read in SELECTs)¡£InnoDBËø¶¨ÔÚÐм¶²¢ÇÒÒ²ÔÚSELECTÓï¾äÌṩһ¸öOracle·ç¸ñÒ»ÖµķÇËø¶¨¶Á¡£ÕâЩÌØÉ«Ôö¼ÓÁ˶àÓû§²¿ÊðºÍÐÔÄÜ¡£Ã»ÓÐÔÚInnoDBÖÐÀ©´óËø¶¨µÄÐèÒª£¬ÒòΪÔÚInnoDBÖÐÐм¶Ëø¶¨ÊʺϷdz£Ð¡µÄ¿Õ¼ä¡£InnoDBÒ²Ö§³ÖFOREIGN KEYÇ¿ÖÆ¡£ÔÚSQL²éѯÖУ¬Äã¿ÉÒÔ×ÔÓɵؽ«InnoDBÀàÐ͵ıíÓëÆäËüMySQLµÄ±íµÄÀàÐÍ»ìºÏÆðÀ´£¬ÉõÖÁÔÚͬһ¸ö²éѯÖÐÒ²¿ÉÒÔ»ìºÏ¡£ÕâЩÌØÐÔ¾ùÌá¸ßÁ˶àÓû§²¢·¢²Ù×÷µÄÐÔÄܱíÏÖ¡£ÔÚInnoDB±íÖв»ÐèÒªÀ©´óËø¶¨(lock escalation)£¬ÒòΪ InnoDB µÄÐм¶Ëø¶¨(row level locks)ÊÊÒ˷dz£Ð¡µÄ¿Õ¼ä¡£InnoDB ÊÇ MySQL ÉϵÚÒ»¸öÌṩÍâ¼üÔ¼Êø(FOREIGN KEY constraints)µÄ±íÒýÇæ¡£
¡¡¡¡InnoDBÊÇΪ´¦Àí¾Þ´óÊý¾ÝÁ¿Ê±µÄ×î´óÐÔÄÜÉè¼Æ¡£ËüµÄCPUЧÂÊ¿ÉÄÜÊÇÈκÎÆäËü»ùÓÚ´ÅÅ̵ĹØϵÊý¾Ý¿âÒýÇæËù²»ÄÜÆ¥µÐµÄ¡£
¡¡¡¡InnoDB´æ´¢ÒýÇæ±»ÍêÈ«ÓëMySQL·þÎñÆ÷ÕûºÏ£¬InnoDB´æ´¢ÒýÇæΪÔÚÖ÷ÄÚ´æÖлº´æÊý¾ÝºÍË÷Òý¶øά³ÖËü×Ô¼ºµÄ»º³å³Ø¡£ InnoDB´æ´¢ËüµÄ±í£¦Ë÷ÒýÔÚÒ»¸ö±í¿Õ¼äÖУ¬±í¿Õ¼ä¿ÉÒÔ°üº¬Êý¸öÎļþ£¨»òÔʼ´ÅÅÌ·ÖÇø£©¡£ÕâÓëMyISAM±í²»Í¬£¬±ÈÈçÔÚMyISAM±íÖÐÿ¸ö±í±»´æÔÚ·ÖÀëµÄÎļþÖС£InnoDB ±í¿ÉÒÔÊÇÈκγߴ磬¼´Ê¹ÔÚÎļþ³ß´ç±»ÏÞÖÆΪ2GBµÄ²Ù×÷ϵͳÉÏ¡£
¡¡¡¡InnoDBĬÈϵر»°üº¬ÔÚMySQL¶þ½øÖÆ·Ö·¢ÖС£Windows Essentials installerʹInnoDB³ÉΪWindowsÉÏMySQLµÄĬÈÏ±í¡£
¡¡¡¡InnoDB±»ÓÃÀ´ÔÚÖÚ¶àÐèÒª¸ßÐÔÄܵĴóÐÍÊý¾Ý¿âÕ¾µãÉϲúÉú¡£ÖøÃûµÄInternetÐÂÎÅÕ¾µãSlashdot.orgÔËÐÐÔÚ InnoDBÉÏ¡£Mytrix, Inc.ÔÚInnoDBÉÏ´æ´¢³¬¹ý1TBµÄÊý¾Ý£¬»¹ÓÐһЩÆäËüÕ¾µãÔÚInnoDBÉÏ´¦Àíƽ¾ùÿÃë800´Î²åÈë/¸üеĸººÉ¡£
¡¡¡¡ÔÚ¼¼ÊõÉÏ£¬InnoDB ÊÇÒ»Ì×·ÅÔÚ MySQL ºǫ́µÄÍêÕûÊý¾Ý¿âϵͳ£¬InnoDB ÔÚÖ÷ÄÚ´æÖн¨Á¢ÆäרÓõĻº³å³ØÓÃÓÚ¸ßËÙ»º³åÊý¾ÝºÍË÷Òý¡£MySQLInnoDB °ÑÊý¾ÝºÍË÷Òý´æ·ÅÔÚ±í¿Õ¼äÀ¿ÉÄÜ°üº¬¶à¸öÎļþ£¬ÕâÓëÆäËüµÄ²»Ò»Ñù£¬¾ÙÀýÀ´Ëµ£¬ÔÚ MyISAM ÖУ¬±í±»´æ·ÅÔÚµ¥¶ÀµÄÎļþÖС£InnoDB ±íµÄ´óСֻÊÜÏÞÓÚ²Ù×÷ϵͳµÄÎļþ´óС£¬¿ÉÒ²¿ÉÒÔÿ¸ö±íʹÓø÷×Ô¶ÀÁ¢µÄ±í¿Õ¼ä£¬Ö»ÐèÒªÆôÓÃÑ¡Ïî innodb_file_per_table¡£
¡¡¡¡ÔÚ http://www.innodb.com/ ÉÏ¿ÉÒÔÕÒµ½ InnoDB ×îеÄÐÅÏ¢¡£InnoDB ÊÖ²áµÄ
Ïà¹ØÎĵµ£º
mysqlÊÇÒ»¸öÓÅÐãµÄ¿ªÔ´Êý¾Ý¿â£¬ËüÏÖÔÚµÄÓ¦Ó÷dz£µÄ¹ã·º£¬Òò´ËºÜÓбØÒª¼òµ¥µÄ½éÉÜÒ»ÏÂÓÃpython²Ù×÷mysqlÊý¾Ý¿âµÄ·½·¨¡£python²Ù×÷Êý¾Ý¿âÐèÒª°²×°Ò»¸öµÚÈý·½µÄÄ£¿é£¬ÔÚhttp://mysql-python.sourceforge.net/
ÓÐÏÂÔغÍÎĵµ¡£
ÓÉÓÚpythonµÄÊý¾Ý¿âÄ£¿éÓÐרÃŵÄÊý¾Ý¿âÄ£¿éµÄ¹æ·¶£¬ËùÒÔ£¬Æäʵ²»¹ÜʹÓÃÄÄÖÖÊý¾ ......
1.MySQL´´½¨ÊÓͼµÄ¼òµ¥Óï¾äΪ£ºCREATE VIEW view_name AS SELECT * from TABLE_NAME;
²»ÄܶԴ¥·¢Æ÷´´½¨ÊÓͼ(VIEW)¡£µ«ÊÇÔÚ5.1.4ÖÐÊÇÕâÑùÃèÊöµÄ£¬A view can be created from many kinds of SELECT statements. It can refer to base tables or other views. It can use joins, UNION, and subqueries¡£´óÖÂÒâ˼ÊÇÊÓÍ ......
create procedure getInfor2()
BEGIN
declare _abc varchar(200);
declare stopFlag int;
DECLARE cursor_name CURSOR
FOR
select zhuanyuan from server;
DECLARE CONTINUE HANDLER FOR NOT FOUND set stopFlag=1;
OPEN cursor_name;
REPEAT
FETCH cursor_name INTO _abc;
begin
if _abc='root'
the ......
select * for updateËø±íµÄÎÊÌâ
ÓÉÓÚInnoDBÔ¤ÉèÊÇRow-Level Lock£¬ËùÒÔÖ»ÓС¸Ã÷È·¡¹µÄÖ¸¶¨Ö÷¼ü£¬MySQL²Å»áÖ´ÐÐRow lock (Ö»Ëøס±»Ñ¡È¡µÄ×ÊÁÏÀý) £¬·ñÔòMySQL½«»áÖ´ÐÐTable Lock (½«Õû¸ö×ÊÁÏ±íµ¥¸øËøס)¡£
¾Ù¸öÀý×Ó:
¼ÙÉèÓиö±íµ¥products £¬ÀïÃæÓÐid¸úname¶þ¸öÀ¸Î»£¬idÊÇÖ÷¼ü¡£
Àý1: (Ã÷È·Ö¸¶¨Ö÷¼ü£¬²¢ÇÒÓд˱Ê×ÊÁÏ£¬ ......
NOW()º¯ÊýÒÔ`'YYYY-MM-DD HH:MM:SS'·µ»Øµ±Ç°µÄÈÕÆÚʱ¼ä£¬¿ÉÒÔÖ±½Ó´æµ½DATETIME×Ö¶ÎÖС£
CURDATE()ÒÔ’YYYY-MM-DD’µÄ¸ñʽ·µ»Ø½ñÌìµÄÈÕÆÚ£¬¿ÉÒÔÖ±½Ó´æµ½DATE×Ö¶ÎÖС£
CURTIME()ÒÔ’HH:MM:SS’µÄ¸ñʽ·µ»Øµ±Ç°µÄʱ¼ä£¬¿ÉÒÔÖ±½Ó´æµ½TIME×Ö¶ÎÖС£
Àý£ºinsert ......