æ©ãæ²ç¸ãªãã£ã¹ä½ã£ã¦ãããªãããªã¼å¯ãã¦ä»äºã«ãªããªããï¼ã¿ãªããããã«ã¡ã¯ nakamura ã§ãã ãã¼ã³ãå¾ããµã¤ãã®éç¨ãåãæã£ã¦ããã¨ã©ããã¦ãæ©è½è¿½å ãªã©ã§ DB ã®ãã¼ãã«æ§æãå¤ããªãããããªãã£ã¦äºããã¨æãã¾ãããã¼ã¿éããã»ã©å¤ããªããã°åé¡ã«ãªããªãããããã¾ããããMySQL ã® ALTER TABLE ã¯ãã¼ãã«å ¨ä½ã«å¯¾ãã¦æ¸ãè¾¼ã¿ããã¯ãããã¦ãã¾ãããããµã¤ãºã®å¤§ããªãã¼ãã«ã®å ´åçµæ§ãªæéãµã¤ããæ¢ããå¿ è¦ãåºã¦ãã¦ãã¾ã£ãããããããå æ¸ãªãã¨ããªããªãã®ããï¼ã¨æã£ã¦æ¢ãã¦ãããä¸ã ããæãã®ãã¼ã«ãè¦ã¤ããã®ã§ä»åã¯ãã®ãç´¹ä»ã§ãã Percona Toolkit pt-online-schema-change 㯠Percona Toolkit ã¨ãã MySQL ã使ãä¸ã§ã®ä¾¿å©æ©è½ãã¾ã¨ãããã¼ã«ç¾¤ã«å«ã¾ãã¦ãã¾ããpt-online-sc
MySQLã§ãã¼ãã«ã¸ã®ã«ã©ã 追å ããã¼ãã«ã®åç·¨æãè¡ãã«ã¯ãALTER TABLEæã使ç¨ãã¾ããMySQLã®ALTER TABLEæã¯ãå¤æ´å¾ã®å®ç¾©ã«ãã¨ã¥ãä½æ¥ç¨ãã¼ãã«ãä½æããå¤æ´åã®ãã¼ãã«ããä½æ¥ç¨ãã¼ãã«ã¸ãã¼ã¿ãã³ãã¼ãã¦ãæå¾ã«äºã¤ã®ãã¼ãã«ãå ¥ãæ¿ããã¨ããä»çµã¿ã«ãªã£ã¦ãã¾ãããã¼ãã«ã¸ã®ã¤ã³ããã¯ã¹è¿½å ã«ã¤ãã¦ããç¾å¨ã®ã¨ãã大åã®ã±ã¼ã¹ã§å é¨çã«ALTER TABLEæãå®è¡ããã¦ãã¾ãã ALTER TABLEæã®æãã¨ããã¯ãå¦çãããããçµããã®ãã©ãããåãããªãã¨ããã§ãããã¼ãã«ãµã¤ãºã1GBãè¶ ãããããããååä½ã®æéããããããã«ãªãã100GBã¨ããªãã¨æ¬å½ã«çµããã®ãï¼ã¨è¦ã¦ãã¦ä¸å®ã«ãªãã¾ããã¡ã³ããã³ã¹æéãéããã¦ããå ´åã¯ãä½æ¥ãä¸æãã¹ããã©ããé£ããå¤æãè¿«ããããã¨ãããã¾ãã å®ã¯ãã¨ããã»ã©ã§ã¯ããã¾ããããALTER
MySQLã§ãã¼ãã«ã¸ã®ã«ã©ã 追å ãã¤ã³ããã¯ã¹è¿½å ããã¼ãã«ã®åç·¨æãªã©ãè¡ãã¨ããã®éãã¼ãã«ã«å ±æããã¯ãããã£ã¦ãã¾ãã¾ãããã®ãããããã®ã¡ã³ããã³ã¹å¦çã¯ãé常å©ç¨è ã®å°ãªãæ·±å¤æ©æ帯ã«ãµã¼ãã¹ãæ¢ãã¦å®æ½ããå¿ è¦ãããã¾ããæ¬æ¥ã¯ãããç¡åæ¢ããªã³ã©ã¤ã³ã®ã¾ã¾ã§ã§ããªããã¨ãã話é¡ã§ãã åºæ¬çãªã¢ã¤ã㢠ã¡ã³ããã³ã¹å¯¾è±¡ã®å ãã¼ãã«ãã³ãã¼ãã¦ãä½æ¥ç¨ã®ä»®ãã¼ãã«ãä½ãã¾ã ä»®ãã¼ãã«ã«å¯¾ãã¦ãã«ã©ã 追å ãªã©ã®å¤æ´ãå ãã¾ã ãã®éãå ãã¼ãã«ã«å¯¾ãã¦è¡ãããæ´æ°å¦çã«ã¤ãã¦å·®åãè¨é²ãã¦ããã¾ã ä»®ãã¼ãã«ã®å¤æ´ãçµãã£ãããè¨é²ãã¦ãããå·®åãã¼ã¿ãä»®ãã¼ãã«ã«åæ ãã¾ã å·®åãã¼ã¿ã®åæ ãçµãã£ãããå ãã¼ãã«ã¨ä»®ãã¼ãã«ãå ¥ãæ¿ãã¾ã ããã¨ä¼¼ããããªãã¨ãèããæ¹ã¯çµæ§ããã£ãããã®ã§ã¯ãªãã§ããããããã ãè¨ãã¯æããè¡ãã¯é£ãã§ããæ´åæ§ããã¡ãã¨åãããã©ã
ãã¼ãã«å®ç¾©ãå¤æ´ããããã¤ã³ããã¯ã¹ãå£ãã¦ãã¾ã£ãã®ã§åä½æãããããããªå ´åã¯ALTER TABLEã使ããALTER TABLEã¯ãã¼ãã«å®ç¾©ãå¤æ´ããã馴æã¿ã®ã³ãã³ãã§ãããããã®æåã¯æå¤ã¨ç¥ããã¦ããªããï¼ã¨ãã¹ãã¼ãã¨ãã¼ããæ¹ã ããã度ã 質åãåãããï¼ãããªããã§ãä»æ¥ã¯ALTER TABLEã«ã¤ãã¦è§£èª¬ãããã¨æãã ã¾ãçµè«ããè¨ãã¨ããªãã¨MySQLã®ALTER TABLEã¯ãã¼ãã«ã®ãã¼ã¿ãå ¨ã¦ã³ãã¼ãç´ãã®ã§ããããªãã¦ç¡é§ãªãã¨ãï¼ï¼ã¨æãããç¥ããªããããã¼ãã«å®ç¾©ï¼ã¹ãã¼ãï¼ã®å¤æ´ãåçã«è¡ãã«ã¯ãã¹ãã¬ã¼ã¸ã¨ã³ã¸ã³ã«ãããµãã¼ããå¿ è¦ã§ãããåçãªã¹ãã¼ãå¤æ´ããµãã¼ããã¦ããã¹ãã¬ã¼ã¸ã¨ã³ã¸ã³ã¯ã¾ã å°ãªãã®ã§ãããï¼åçã¹ãã¼ãå¤æ´ããµãã¼ããã¦ããã®ã¯MySQL Clusterãããã ãããã追å ã ããï¼ããã©ã«ãã§å©ç¨åºæ¥ãMyISAMã¯Inn
SQL ã¹ãã¼ãã¡ã³ãã使ç¨ãã¦ãã¼ãã£ã·ã§ã³ãã¼ãã«ãå¤æ´ããæ¹æ³ã¯å¤æ°ããã¾ããALTER TABLE ã¹ãã¼ãã¡ã³ãã®ãã¼ãã£ã·ã§ã³åæ¡å¼µã使ç¨ãã¦ãæ¢åã®ãã¼ãã£ã·ã§ã³ã追å ãåé¤ãåå®ç¾©ããã¼ã¸ã¾ãã¯åå²ã§ãã¾ãã ãã¼ãã£ã·ã§ã³åããããã¼ãã«ããã³ãã¼ãã£ã·ã§ã³ã«é¢ããæ å ±ãåå¾ããæ¹æ³ãããã¾ãã 以éã®ã»ã¯ã·ã§ã³ã§ã¯æ¬¡ã®ãããã¯ã«ã¤ãã¦èª¬æãã¾ãã RANGE ã¾ã㯠LIST ã«ãã£ã¦ãã¼ãã£ã·ã§ã³åããããã¼ãã«ã®ãã¼ãã£ã·ã§ã³ç®¡çã«ã¤ãã¦ã¯ãã»ã¯ã·ã§ã³24.3.1ãRANGE ããã³ LIST ãã¼ãã£ã·ã§ã³ã®ç®¡çããåç §ãã¦ãã ããã HASH ããã³ KEY ãã¼ãã£ã·ã§ã³ã®ç®¡çã«ã¤ãã¦ã¯ãã»ã¯ã·ã§ã³24.3.2ãHASH ããã³ KEY ãã¼ãã£ã·ã§ã³ã®ç®¡çããåç §ãã¦ãã ããã ãã¼ãã£ã·ã§ã³åããããã¼ãã«ããã³ãã¼ãã£ã·ã§ã³ã«é¢ããæ å ±ãåå¾ããããã«
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}