1¡¢ Èç¹ûͬʱ´Óͬһ¸ö¿Í»§¶Ë²åÈëºÜ¶àÐУ¬Ê¹Óú¬¶à¸ö VALUEµÄINSERTÓï¾äͬʱ²åÈ뼸ÐС£Õâ±ÈʹÓõ¥ÐÐINSERTÓï¾ä¿ì(ÔÚijЩÇé¿öÏ¿켸±¶)¡£Èç¹ûÄãÕýÏòÒ»¸ö·Ç¿Õ±íÌí¼ÓÊý¾Ý£¬¿ÉÒÔµ÷½Ú bulk_insert_buffer_size±äÁ¿£¬Ê¹Êý¾Ý²åÈë¸ü¿ì¡£²Î¼û5.3.3 ½Ú£¬¡°·þÎñÆ÷ϵͳ±äÁ¿¡±¡£
2¡¢Èç¹ûÄã´Ó²»Í¬µÄ¿Í»§¶Ë²åÈëºÜ¶àÐУ¬ÄÜͨ¹ýINSERT DELAYEDÓï¾ä¼Ó¿ìËٶȡ£²Î¼û13.2.4 ½Ú£¬¡°INSERTÓï·¨¡±¡£
3¡¢ÓÃMyISAM£¬Èç¹ûÔÚ±íÖÐûÓÐɾ³ýµÄÐУ¬ÄÜÔÚSELECTÓï¾äÕýÔÚÔËÐеÄͬʱ²åÈëÐС£
4¡¢µ±´ÓÒ»¸öÎı¾Îļþ×°ÔØÒ»¸ö±íʱ£¬Ê¹ÓÃLOAD DATA INFILE¡£Õâͨ³£±ÈʹÓúܶàINSERTÓï¾ä¿ì20±¶¡£²Î¼û13.2.5 ½Ú£¬¡°LOAD DATA INFILEÓï·¨¡±¡£
5¡¢µ±±íÓкܶàË÷Òýʱ£¬ÓпÉÄÜÒª¶à×öЩ¹¤×÷ʹµÃLOAD DATA INFILE¸ü¿ìЩ¡£Ê¹ÓÃÏÂÁйý³Ì£º
1£©. ÓÐÑ¡ÔñµØÓÃCREATE TABLE´´½¨±í¡£
2£©. Ö´ÐÐFLUSH TABLESÓï¾ä»òÃüÁîmysqladmin flush-tables¡£
3). ʹÓÃmyisamchk --keys-used=0 -rq /path/to/db/tbl_name¡£Õ⽫´Ó±íÖÐÈ¡ÏûËùÓÐË÷ÒýµÄʹÓá£
4). ÓÃLOAD DATA INFILE°ÑÊý¾Ý²åÈëµ½±íÖУ¬ÒòΪ²»¸üÐÂÈκÎË÷Òý£¬Òò´ËºÜ¿ì¡£
5). Èç¹ûÖ»ÏëÔÚÒÔºó¶ÁÈ¡±í£¬Ê¹ÓÃmyisampackѹËõËü¡£²Î¼û15.1.3.3 ½Ú£¬¡°Ñ¹Ëõ±íÌØÐÔ¡±¡£
6). ÓÃmyisamchk -r -q /path/to/db/tbl_nameÖØд´½¨Ë÷Òý¡£Õ⽫ÔÚдÈë´ÅÅÌÇ°ÔÚÄÚ´æÖд´½¨Ë÷ÒýÊ÷£¬²¢ÇÒËü¸ü¿ì£¬ÒòΪ±ÜÃâÁË´óÁ¿´ÅÅÌËÑË÷¡£½á¹ûË÷ÒýÊ÷Ò²±»ÍêÃÀµØƽºâ¡£
7). Ö´ÐÐFLUSH TABLESÓï¾ä»òmysqladmin flush-tablesÃüÁî¡£
6¡¢Ëø¶¨±í¿ÉÒÔ¼ÓËÙÓöà¸öÓï¾äÖ´ÐеÄINSERT²Ù×÷£º
* LOCK TABLES a WRITE;
* INSERT INTO a VALUES (1,23),(2,34),(4,33);
* INSERT INTO a VALUES (8,26),(6,29);
* UNLOCK TABLES;
ÕâÑùÐÔÄÜ»áÌá¸ß£¬ÒòΪË÷Òý»º´æÇø½öÔÚËùÓÐINSERTÓï¾äÍê³Éºóˢе½´ÅÅÌÉÏÒ»´Î¡£Ò»°ãÓжàÉÙINSERTÓï¾ä¼´ÓжàÉÙË÷Òý»º´æÇøˢС£Èç¹ûÄÜÓÃÒ»¸öÓï¾ä²åÈëËùÓеÄÐУ¬¾Í²»ÐèÒªËø¶¨¡£
¶ÔÓÚÊÂÎñ±í£¬Ó¦Ê¹ÓÃBEGINºÍCOMMIT´úÌæLOCK TABLESÀ´¼Ó¿ì²åÈë¡£
ÍƼöÐÅÏ¢
ÈÈÃÅÐÅÏ¢
- 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ÎÞÃÜÂëµÇ¼
ÆÀÂÛ