åã®èšäºã§ã¯ããã©ã³ã¯ããŒã¹ã®éçºã¢ãããŒãã䜿çšããåäžãªããžããªãžã®éçºã®ç§»è¡ãã¢ã»ã³ããªããã¹ããå±éãããã³ç£èŠã®ããã®çµ±åã·ã¹ãã ãç¶ç¶çãªçµ±åã·ã¹ãã ããã®ãããªç¶æ³ã§å¹æçã«æ©èœããããã«è§£æ±ºããªããã°ãªããªãã¿ã¹ã¯ã«ã€ããŠèª¬æããŸããã
æ¬æ¥ã¯ãHabrèªè ã«ç¶ç¶çã€ã³ãã°ã¬ãŒã·ã§ã³ã·ã¹ãã ã®ããã€ã¹ã«ã€ããŠèª¬æããŸãã
ç¶ç¶çã€ã³ãã°ã¬ãŒã·ã§ã³ã·ã¹ãã ã¯ã確å®ãã€è¿ éã«åäœããå¿ èŠããããŸãã ã·ã¹ãã ã¯ãçä¿¡ã€ãã³ãã«è¿ éã«å¿çããå¿ èŠãããããã¹ãå®è¡çµæããŠãŒã¶ãŒã«é ä¿¡ããããã»ã¹ã«è¿œå ã®é 延ãå°å ¥ããªãã§ãã ããã ã¢ã»ã³ããªãšãã¹ãã®çµæã¯ããªã¢ã«ã¿ã€ã ã§ãŠãŒã¶ãŒã«é ä¿¡ããå¿ èŠããããŸãã
ç¶ç¶çã€ã³ãã°ã¬ãŒã·ã§ã³ã·ã¹ãã ã¯ãé 延ãæå°éã®ã¹ããªãŒãã³ã°ããŒã¿åŠçã·ã¹ãã ã§ãã
ç¹å®ã®æ®µéïŒæ§æããã«ããã¹ã¿ã€ã«ãå°èŠæš¡ãã¹ããäžèŠæš¡ãã¹ããªã©ïŒã§ãã¹ãŠã®çµæãéä¿¡ããåŸããã«ãã·ã¹ãã ã¯ãããç¶ç¶çã€ã³ãã°ã¬ãŒã·ã§ã³ã·ã¹ãã ã«éç¥ãïŒã¹ããŒãžããéãããïŒããŠãŒã¶ãŒã¯ãã®ãã§ãã¯ãšãã®æ®µéã§ã¯ããã¹ãŠã®çµæãããã£ãŠããŸãã åã¹ããŒãžã¯ç¬ç«ããŠéããŸãã ãŠãŒã¶ãŒã¯äŸ¿å©ãªä¿¡å·ãããéãåãåããŸãã ãã¹ãŠã®ã¹ããŒãžãéããåŸããã§ãã¯ã¯å®äºãããšèŠãªãããŸãã
ã·ã¹ãã ãå®è£ ããããã«ã Kappaã¢ãŒããã¯ãã£ãéžæããŸããã ã·ã¹ãã ã¯2ã€ã®ãµãã·ã¹ãã ã§æ§æãããŠããŸãã
- ã€ãã³ããšããŒã¿ã®åŠçã¯ãªã¢ã«ã¿ã€ã åè·¯ã§è¡ãããŸãã å ¥åããŒã¿ã¯ãã¹ãŠããŒã¿ã¹ããªãŒã ïŒã¹ããªãŒã ïŒãšããŠæ±ãããŸãã æåã«ãã€ãã³ããã¹ããªãŒã ã«èšé²ãããŠããåŠçãããŸãã
- ããŒã¿åŠçã®çµæã¯ããŒââã¿ããŒã¹ã«ç¶ç¶çã«æžã蟌ãŸããAPIãä»ããŠåŒã³åºããè¡ãããŸãã Kappaã¢ãŒããã¯ãã£ã§ã¯ãããã¯ãµãŒãã³ã°ã¬ã€ã€ãŒãšåŒã°ããŸãã
ã·ã¹ãã ã®çŸåšã®ç¶æ ãåžžã«ææ¡ããå¿ èŠããããããããŒã¿å€æŽã®ãã¹ãŠã®èŠæ±ã¯ãªã¢ã«ã¿ã€ã åç·ãçµç±ããå¿ èŠããããŸãã èªã¿åãèŠæ±ã¯ããŒã¿ããŒã¹ã«ã®ã¿éä¿¡ãããŸãã
å¯èœãªéããè¿œå å°çšã«ãŒã«ã«åŸããŸãã å€ãäžèŠãªããŒã¿ãåé€ããå Žåãé€ãããªããžã§ã¯ãã®å€æŽãåé€ã¯ãããŸããã
1æ¥ã«2 Tbãè¶ ããçããŒã¿ããµãŒãã¹ãééããŸãã
å©ç¹ïŒ
- ã¹ããªãŒã ã«ã¯ããã¹ãŠã®ã€ãã³ããšã¡ãã»ãŒãžãå«ãŸããŸãã äœããã€èµ·ãã£ãããåžžã«ç解ã§ããŸãã ã¹ããªãŒã ã¯å€§ããªãã°ãšããŠèªèãããŸãã
- é«å¹çã§æå°éã®ãªãŒããŒãããã ããŒãªã³ã°ã倱ãããšãªããå®å šã«ã€ãã³ãæåã®ã·ã¹ãã ã«ãªããŸãã ã€ãã³ãã¯ãããŸãããç¹å¥ãªããšã¯äœãããŠããŸããã
- ã¢ããªã±ãŒã·ã§ã³ã³ãŒãã¯ãå®éã«ã¯ãã¹ã¬ããåæã®ããªããã£ããšã¹ã¬ããéã§å ±æãããã¡ã¢ãªãåŠçããŸããã ããã«ãããã·ã¹ãã ã®ä¿¡é Œæ§ãé«ãŸããŸãã
- ããã»ããµã¯äºãã«ååã«åé¢ãããŠããããã ã¹ããªãŒã ãä»ããŠã®ã¿ãçŽæ¥å¯Ÿè©±ããŸãã è¯å¥œãªãã¹ãç¯å²ãæäŸã§ããŸãã
ãã ããã¹ããªãŒãã³ã°ããŒã¿ã¯ããã»ã©åçŽã§ã¯ãããŸããã
- èšç®ã¢ãã«ã®ååãªç解ãå¿ èŠã§ãã æ¢åã®ããŒã¿åŠçã¢ã«ãŽãªãºã ãåèããå¿ èŠããããŸãã ãã¹ãŠã®ã¢ã«ãŽãªãºã ãããã«ã¹ããªãŒã ã¢ãã«ã«è©²åœããããã§ã¯ãªããé ãå°ãå£ãå¿ èŠããããŸãã
- ã€ãã³ãã®åä¿¡ãšåŠçã®é åºã®ä¿åãä¿èšŒããå¿ èŠããããŸãã
- çžäºã«é¢é£ããã€ãã³ããåŠçã§ããå¿ èŠããããŸãã æ°ããã¡ãã»ãŒãžã®åŠçäžã«å¿ èŠãªãã¹ãŠã®ããŒã¿ã«ãã°ããã¢ã¯ã»ã¹ã§ããŸãã
- ãŸããéè€ããã€ãã³ããåŠçã§ããå¿ èŠããããŸãã
ã¹ããªãŒã åŠç
ãããžã§ã¯ãã®äœæ¥äžã«ãStream Processorã©ã€ãã©ãªãäœæãããŸãããããã«ãããå®çšŒåç°å¢ã§ã¹ããªãŒã ããŒã¿åŠçã¢ã«ãŽãªãºã ãè¿ éã«å®è£ ããã³èµ·åã§ããŸããã
Stream Processorã¯ãã¹ããªãŒãã³ã°ããŒã¿åŠçã·ã¹ãã ãæ§ç¯ããããã®ã©ã€ãã©ãªã§ãã ã¹ããªãŒã ã¯ãæœåšçã«ç¡éã®ããŒã¿ïŒã¡ãã»ãŒãžïŒã®ã·ãŒã±ã³ã¹ã§ãããæ°ããã¡ãã»ãŒãžã®è¿œå ã®ã¿ãå¯èœã§ã;æ¢ã«èšé²ãããã¡ãã»ãŒãžã¯å€æŽããããã¹ããªãŒã ããåé€ãããŸããã ããã¹ããªãŒã ããå¥ã®ã¹ããªãŒã ãžã®ã³ã³ããŒã¿ãŒïŒã¹ããªãŒã ããã»ããµïŒã¯ãæ©èœçã«3ã€ã®éšåã§æ§æãããŸãïŒéåžžã1ã€ä»¥äžã®ã¹ããªãŒã ããã¡ãã»ãŒãžãèªã¿åããåŠçãã¥ãŒã«å ¥ããçä¿¡ã¡ãã»ãŒãžãããã€ããŒãçä¿¡ã¡ãã»ãŒãžãçºä¿¡ã¹ããªãŒã ã«å€æããŠãã¥ãŒã«å ¥ããã¡ãã»ãŒãžããã»ããµãŒã¿ã€ã ãŠã£ã³ããŠå ã§ã°ã«ãŒãåãããçºä¿¡ã¡ãã»ãŒãžãåºåã¹ããªãŒã ã«åé¡ãããèšé²ãšæžã蟌ã¿ã 1ã€ã®ã¹ããªãŒã ããã»ããµã§çæãããããŒã¿ã¡ãã»ãŒãžã¯ãåŸã§ä»ã®ããã»ããµã§äœ¿çšã§ããŸãã ãããã£ãŠãã¹ããªãŒã ãšããã»ããµã¯ããµã€ã¯ã«ãå¯èœãªæåã°ã©ãã圢æããŸããç¹ã«ãã¹ããªãŒã ããã»ããµã¯ãããŒã¿ãåä¿¡ããå Žæããåãã¹ããªãŒã ã§ã¡ãã»ãŒãžãçæããããšããã§ããŸãã
å ¥åã¹ããªãŒã ã®åã¡ãã»ãŒãžã¯ãããã«é¢é£ä»ããããŠããåããã»ããµã«ãã£ãŠå°ãªããšã1åïŒã»ãã³ãã£ã¯ã¹ãå°ãªããšã1åïŒåŠçãããããšãä¿èšŒãããŠããŸãã ãŸãããã¹ãŠã®ã¡ãã»ãŒãžããã®ã¹ããªãŒã ã«å°çããé åºã§åŠçãããããšãä¿èšŒãããŸãã ãããè¡ãããã«ãã¹ããªãŒã ããã»ããµã¯ãµãŒãã¹ã®ãã¹ãŠã®äœæ¥ããŒãã«åæ£ããããããäžåºŠã«ç»é²ãããåããã»ããµã®ã€ã³ã¹ã¿ã³ã¹ã¯1ã€ããæ©èœããŸããã
çžäºã«é¢é£ããã€ãã³ãã®åŠçã¯ãã¹ããªãŒãã³ã°ããŒã¿åŠççšã®ã·ã¹ãã ãæ§ç¯ããéã®äž»ãªåé¡ã®1ã€ã§ãã ååãšããŠãã¡ãã»ãŒãžãã¹ããªãŒãã³ã°ããå Žåãã¹ããªãŒã ããã»ããµã¯ãçŸåšã®ã¡ãã»ãŒãžãåŠçãããæç¹ã§æå¹ã ã£ãç¹å®ã®ç¶æ ãåŸã ã«äœæããŸãã ãã®ãããªç¶æ ãªããžã§ã¯ãã¯éåžžãã¹ããªãŒã å šäœã§ã¯ãªããç¹å®ã®ã¡ãã»ãŒãžã®ãµãã»ããã«é¢é£ä»ããããŸããããã¯ããã®ã¹ããªãŒã ã®ããŒå€ã«ãã£ãŠæ±ºå®ãããŸãã è³ç£ãå¹ççã«ä¿ç®¡ããããšãæåã®éµã§ãã 次ã®ã¡ãã»ãŒãžãåŠçãããšããããã»ããµããã®ç¶æ ããã°ããååŸãããããšçŸåšã®ã¡ãã»ãŒãžã«åºã¥ããŠéä¿¡ã¡ãã»ãŒãžãçæã§ããããšãéèŠã§ãã ãããã®ç¶æ ãªããžã§ã¯ãã¯ãã¡ã¢ãªå ã«ããL1ãã£ãã·ã¥ïŒCPUãã£ãã·ã¥ãšæ··åããªãã§ãã ããïŒLRUãã£ãã·ã¥ã«ã¢ã¯ã»ã¹ã§ããŸãã L1ãã£ãã·ã¥ã«ç¶æ ããªãã£ãå Žåãã¹ããªãŒã ãä¿åãããããã»ããµã®åäœäžã«å®æçã«ä¿åãããåãã¹ãã¬ãŒãžã«ããL2ãã£ãã·ã¥ãã埩å ãããŸãã L2ãã£ãã·ã¥ã«ç¶æ ããªãã£ãå Žåãããã»ããµãçŸåšã®ã¡ãã»ãŒãžããŒã«é¢é£ä»ãããããã¹ãŠã®å ã®ã¡ãã»ãŒãžãåŠçãããã®ããã«ãå ã®ã¹ããªãŒã ã¡ãã»ãŒãžãã埩å ãããŸãã å€ãã®å Žåãã·ãŒã±ã³ã·ã£ã«åŠçã¯ãµãŒããŒã®ããã©ãŒãã³ã¹ã§ã¯ãªããããŒã¿ãŠã§ã¢ããŠã¹ãšã®éä¿¡æã®èŠæ±ãšå¿çã®é 延ã«äŸåããããããã£ãã·ã¥æè¡ã«ãããã¹ãã¬ãŒãžã®é«é 延ã®åé¡ã«å¯ŸåŠã§ããŸãã
ã¡ã¢ãªå¹çã®é«ãæ§é ã«å ããŠãL1ãã£ãã·ã¥ã«ããŒã¿ããã¡ã¢ãªã«ã¡ãã»ãŒãžããŒã¿ãå¹æçã«ä¿åããããã«ããªããžã§ã¯ãããŒã«ã䜿çšããŠãã¡ã¢ãªå ã«ãªããžã§ã¯ãïŒãŸãã¯ãã®äžéšïŒã®ã³ããŒã1ã€ã ãæã€ããšãã§ããŸãã ãã®ææ³ã¯ãJDKã§æ¢ã«æååã®æå¶æååãšããŠäœ¿çšãããŠãããåæ§ã«ä»ã®ã¿ã€ãã®ãªããžã§ã¯ãã«ãé©çšãããŸãã
ã¹ããªãŒã ã¹ãã¬ãŒãžã«ããŒã¿ãã³ã³ãã¯ãã«ä¿åããã«ã¯ãäžéšã®ããŒã¿ãã¹ããªãŒã ã«æžã蟌ãåã«æ£èŠåããŸãã æ°åã«å€ãããŸãã ãã®åŸãå¹æçãªå§çž®ã¢ã«ãŽãªãºã ãæ°å€ïŒãªããžã§ã¯ãèå¥åïŒã«é©çšã§ããŸãã çªå·ã䞊ã¹æ¿ãããããã«ã¿ãã«ãŠã³ãããã次ã«ZigZagãšã³ã³ãŒãã§ãšã³ã³ãŒããããã¢ãŒã«ã€ããŒã§å§çž®ãããŸãã æ£èŠåã¯ãã¹ããªãŒãã³ã°ããŒã¿åŠçã·ã¹ãã ã®æšæºæè¡ã§ã¯ãããŸããã ãããããã®å§çž®æè¡ã¯éåžžã«å¹æçã§ãããæãããŒããããã¹ããªãŒã ã®ããŒã¿éã¯çŽ1,000ååæžãããŸãã
åã¹ããªãŒã ããã³ããã»ããµã«ã€ããŠãã¡ãã»ãŒãžåŠçã®ã©ã€ããµã€ã¯ã«ã远跡ããŸããå ¥åã¹ããªãŒã ã§ã®æ°ããã¡ãã»ãŒãžã®åºçŸãæªåŠçã¡ãã»ãŒãžã®ãã¥ãŒã®ãµã€ãºãçµæã®ã¹ããªãŒã ã«æžã蟌ããã¥ãŒã®ãµã€ãºãã¡ãã»ãŒãžåŠçæéãããã³ã¡ãã»ãŒãžåŠçã¹ããŒãžããšã®æéã®ååžïŒ
ããŒã¿ãŠã§ã¢ããŠã¹
ã¹ããªãŒãã³ã°çµæã¯ãã§ããã ãæ©ããŠãŒã¶ãŒãå©çšã§ããããã«ããå¿ èŠããããŸãã ã¹ããªãŒã ããã®åŠçæžã¿ããŒã¿ã¯ãããŒã¿ããŒã¹ã«ç¶ç¶çã«èšé²ãããå¿ èŠããããŸãããã®åŸãããŒã¿ãé©çšã§ããŸãïŒããšãã°ããã¹ãã®çµæãå«ãã¬ããŒãã®è¡šç€ºããã¹ãã®å±¥æŽã®è¡šç€ºïŒã
ä¿åãããããŒã¿ãšã¯ãšãªã®ç¹æ§ã
ã»ãšãã©ã®ããŒã¿ã¯ãã¹ãå®è¡ã§ãã 1ãæ以äžã§ã15åãè¶
ãããã«ããšãã¹ããéå§ãããŸãã èµ·åããšã«ããªã倧éã®æ
å ±ãä¿åãããŸãïŒãšã©ãŒã®çµæãšã¿ã€ãããšã©ãŒã®ç°¡åãªèª¬æïŒã¹ããããïŒããã°ãžã®ããã€ãã®ãªã³ã¯ããã¹ãæéãæ°å€ã®ã»ãããã¡ããªãã¯ãname = valueãªã©ã®åœ¢åŒã§ãã å®éã«ã¯ã©ã³ãã ãªå€ã§ããããããã®ããŒã¿ã®äžéšïŒããšãã°ãã¡ããªãã¯ã¹ãšæéïŒã¯å§çž®ãéåžžã«å°é£ã§ãã ä»ã®éšå-ããšãã°ãçµæããšã©ãŒã®ã¿ã€ãããã°-ã¯ãåããã¹ãã§å®è¡ããšã«ã»ãšãã©å€åããªããããããå¹ççã«ä¿åã§ããŸãã
以åã¯ãMySQLã䜿çšããŠåŠçæžã¿ããŒã¿ãä¿åããŠããŸããã ç§ãã¡ã¯åŸã ã«ããŒã¿ããŒã¹ã®æ©èœã«é Œãå§ããŸããã
- åŠçãããããŒã¿ã®éã¯6ãæããšã«2åã«ãªããŸãã
- éå»2ãæéã®ããŒã¿ããä¿åã§ããŸããã§ããããå°ãªããšã1幎éã¯ããŒã¿ãä¿åãããã£ãã®ã§ãã
- éãïŒåæã«è¿ãïŒã¯ãšãªã®å®è¡é床ã®åé¡ã
- è€éãªããŒã¿ããŒã¹ã¹ããŒãã ããŒã¿ããŒã¹ãžã®æžã蟌ã¿ãè€éã«ããå€æ°ã®ããŒãã«ïŒæ£èŠåïŒã åºæ¬ã¹ããŒã ã¯ããªã¢ã«ã¿ã€ã åè·¯ã§äœ¿çšããããªããžã§ã¯ãã®ã¹ããŒã ãšã¯å€§ããç°ãªããŸãã
- ãµãŒããŒãã·ã£ããããŠã³ããŠããŸããã å¥ã®ãµãŒããŒã«é害ãçºçããããããŒã¿ã»ã³ã¿ãŒãã·ã£ããããŠã³ããããããšãã·ã¹ãã é害ãçºçããå¯èœæ§ããããŸãã
- ããªãè€éãªæäœã
æ°ããããŒã¿ãŠã§ã¢ããŠã¹ã®åè£ãšããŠãããã€ãã®ãªãã·ã§ã³ãæ€èšããŸããïŒPostgreSQLãMongoDBã ClickHouseãªã©ã®ããã€ãã®å éšãœãªã¥ãŒã·ã§ã³ã
äžéšã®ãœãªã¥ãŒã·ã§ã³ã§ã¯ãå€ãMySQLããŒã¹ã®ãœãªã¥ãŒã·ã§ã³ãããå¹ççã«ããŒã¿ãä¿åããããšãã§ããŸããã ãã®ä»ã§ã¯ãé«éã§è€éãªïŒã»ãšãã©åæçãªïŒã¯ãšãªãå®è£ ã§ããŸããã ããšãã°ãç¹å®ã®ãããžã§ã¯ãïŒããã€ãã®ãã¹ãã»ããïŒã«åœ±é¿ããã³ãããã瀺ããããªãéããªã¯ãšã¹ãããããŸãã é«éãªSQLã¯ãšãªãå®è¡ã§ããªããã¹ãŠã®å ŽåããŠãŒã¶ãŒã«é·æéåŸ æ©ãããããæè»æ§ã倱ã£ãŠäºåã«èšç®ãè¡ãå¿ èŠããããŸãã äºåã«äœãããšãå Žåãããå€ãã®ã³ãŒããèšè¿°ãããšåæã«æè»æ§ã倱ãå¿ èŠããããŸããåäœããã°ããå€æŽããŠäœããåéèšããæ¹æ³ã¯ãããŸããã ãŠãŒã¶ãŒãå¿ èŠãšããããŒã¿ãè¿ãSQLã¯ãšãªãèšè¿°ããæ¹ãã¯ããã«äŸ¿å©ã§é«éã§ãããã·ã¹ãã ã®åäœãå€æŽãããå Žåã¯è¿ éã«å€æŽã§ããŸãã
ã¯ãªãã¯ããŠã¹
ClickHouseãéžæããŸãã ã ClickHouseã¯ããªã³ã©ã€ã³åæã¯ãšãªåŠçïŒOLAPïŒçšã®åæ±ç¶ã®ããŒã¿ããŒã¹ç®¡çã·ã¹ãã ïŒDBMSïŒã§ãã
ClickHouseã«åãæ¿ãããšãä»ã®DBMSãæäŸããæ©äŒã®äžéšãæèçã«æŸæ£ããéåžžã«é«éãªåæã¯ãšãªãšã³ã³ãã¯ããªããŒã¿ãŠã§ã¢ããŠã¹ãšãã圢ã§ããã«å¯Ÿãã䟡å€ã®ããè£åãåãåããŸããã
ãªã¬ãŒã·ã§ãã«DBMSã§ã¯ãè¡ããšã®å€ã¯ç©ççã«äžŠãã§æ ŒçŽãããŸãã ClickHouseã§ã¯ãç°ãªãåã®å€ã¯å¥ã ã«ä¿åããã1ã€ã®åã®ããŒã¿ã¯äžç·ã«ä¿åãããŸãã ãã®ããŒã¿ã¹ãã¬ãŒãžã®é åºã«ãããäž»ããŒãæ£ããéžæããŠé«åºŠãªããŒã¿å§çž®ãå®çŸã§ããŸãã ãŸããDBMSãé©åã«æ©èœããã·ããªãªã«ã圱é¿ããŸãã ClickHouseã¯ãå°æ°ã®åãèªã¿åãããã¯ãšãªã1ã€ã®å€§ããªããŒãã«ã䜿çšããæ®ãã®ããŒãã«ãå°ããã¯ãšãªã§ããé©åã«æ©èœããŸãã ãã ããéåæã¯ãšãªã§ããClickHouseã¯è¯ãçµæã衚瀺ã§ããŸãã
ããŒãã«å ã®ããŒã¿ã¯äž»ããŒã§ãœãŒããããŸãã ãœãŒãã¯ããã¯ã°ã©ãŠã³ãã§å®è¡ãããŸãã ããã«ãããå°ããªããªã¥ãŒã ã®ã¹ããŒã¹ã€ã³ããã¯ã¹ãäœæã§ããããŒã¿ããã°ããèŠã€ããããšãã§ããŸãã ClickHouseã«ã¯ã»ã«ã³ããªã€ã³ããã¯ã¹ããããŸããã å³å¯ã«èšããšã1ã€ã®ã»ã«ã³ããªã€ã³ããã¯ã¹ããããŸã-ããŒãã£ã·ã§ã³ããŒïŒClickHouseã¯ãããŒãã£ã·ã§ã³ããŒããªã¯ãšã¹ãã§æå®ãããŠããããŒãã£ã·ã§ã³ããŒã¿ãé®æããŸãïŒ è©³çŽ°
æ£èŠåã䜿çšããããŒã¿ã¹ããŒã ã¯æ©èœçã§ã¯ãããŸãããéã«ãèŠæ±ã«å¿ããŠããŒã¿ãéæ£èŠåããããšããå§ãããŸãã å€æ°ã®åãæã€ãå¹ ã®åºããããŒãã«ãäœæããããšããå§ãããŸãã ãã®é ç®ã¯ãã»ã«ã³ããªã€ã³ããã¯ã¹ããªãããã«ãç°ãªããã©ã€ããªããŒã䜿çšããŠããŒãã«ã®ã³ããŒãäœæããããšããããããåã®é ç®ã«ãé¢é£ããŠããŸãã
ClickHouseã«ã¯ãå€å žçãªæå³ã§ã®UPDATEããã³DELETEã¯ãããŸãããããããããšãã¥ã¬ãŒãããå¯èœæ§ããããŸãã
ããŒã¿ã¯ããŸãé »ç¹ã«ïŒæ°ç§ã«1åïŒå€§ããªãããã¯ã«æ¿å ¥ããå¿ èŠããããŸãã è¡ããšã®ããŒã¿èªã¿èŸŒã¿ã¯ãå®éã®ããŒã¿ããªã¥ãŒã ã§ã¯äºå®äžåäœããŸããã
ClickHouseã¯ãã©ã³ã¶ã¯ã·ã§ã³ããµããŒãããŠããªããããã·ã¹ãã ã¯æçµçã«äžè²«æ§ãä¿ã¡ãŸãã
ããã§ããä»ã®DBMSãšåæ§ã«ãClickHouseã®äžéšã®æ©èœã䜿çšãããšãæ¢åã®ã·ã¹ãã ãç°¡åã«ç§»è¡ã§ããŸãã
- ClickHouseã¯SQLã䜿çšããŸãããOLAPã·ã¹ãã ã«å žåçãªã¯ãšãªã«ã¯ããããªéãããããŸãã éçŽé¢æ°ã®åŒ·åãªã·ã¹ãã ãALL / ANY JOINãé¢æ°å ã®ã©ã ãåŒãããã³ã»ãšãã©ãã¹ãŠã®åæã¯ãšãªãäœæã§ãããã®ä»ã®SQLæ¡åŒµæ©èœããããŸãã
- ClickHouseã¯ãã¬ããªã±ãŒã·ã§ã³ã ã¯ã©ãŒã©ã èšé² ãã¯ã©ãŒã©ã èªã¿åãããµããŒãããŠããŸãã ä¿¡é Œã§ããããŒã¿ã¹ãã¬ãŒãžã«ã¯ã¯ã©ãŒã©ã æžã蟌ã¿ãå¿ èŠã§ããINSERTã¯ãClickHouseããšã©ãŒãªãã§æå®ãããæ°ã®ã¬ããªã«ã«ããŒã¿ãæžã蟌ãããšãã§ããå Žåã«ã®ã¿æåããŸãã
ClickHouseæ©èœã®è©³çŽ°ã«ã€ããŠã¯ã ããã¥ã¡ã³ããã芧ãã ããã
ClickHouseã䜿çšããæ©èœ
äž»ããŒãšããŒãã£ã·ã§ã³ããŒã®éžæã
äž»ããŒãšããŒãã£ã·ã§ã³ããŒãéžæããæ¹æ³ ããããããã¯ãæ°ããããŒãã«ãäœæãããšãã«çããæåã®è³ªåã§ãã äž»ããŒãšããŒãã£ã·ã§ã³ããŒã®éžæã¯ãéåžžãããŒã¿ã«å¯ŸããŠå®è¡ãããã¯ãšãªã«ãã£ãŠæ±ºãŸããŸãã åæã«ãäž¡æ¹ã®æ¡ä»¶ã䜿çšããã¯ãšãªãæãå¹æçã§ããããšãããããŸãããäž»ããŒãšããŒãã£ã·ã§ã³ããŒã«ãããã®ã§ãã
ãã®å Žåãã¡ã€ã³ããŒãã«ã¯ããã¹ããå®è¡ããããã®ãããªãã¯ã¹ã§ãã ãã®ãããªããŒã¿æ§é ã§ã¯ãäžæ¹ã®ãã€ãã¹é åºãè¡çªå·ã®å¢å é ã«ãä»æ¹ã®ãã€ãã¹é åºãåçªå·ã®å¢å é ã«ãªãããã«ãããŒãéžæããå¿ èŠããããšèããã®ãè«ççã§ãã
äž»ããŒããã€ãã¹ããä»ã®åã®åäžã®å€ã¯ããŒãã«å ã®ã¹ããŒã¹ãã»ãšãã©å æããªããããäž»ããŒã®éžæã¯ããŒã¿ã¹ãã¬ãŒãžã®ã³ã³ãã¯ãæ§ã«åçã«åœ±é¿ããå¯èœæ§ãããããšã«çæããããšãéèŠã§ãã ãããã£ãŠãããšãã°ãç§ãã¡ã®å Žåããã¹ãã®ç¶æ ã¯ã³ãããããã³ãããã«ã»ãšãã©å€ãããŸããã ãã®äºå®ã«ãããäž»ããŒïŒãã¹ãèå¥åãšã³ãããçªå·ã®ãã¢ïŒã®éžæãæ¬è³ªçã«äºåã«æ±ºå®ãããŸããã ãŸãããã®é åºã§ã
ããŒãã£ã·ã§ã³ããŒã«ã¯2ã€ã®ç®çããããŸãã äžæ¹ã§ãããŒãã£ã·ã§ã³å ã®ããŒã¿ããã§ã«å€ããªã£ãŠãããããããŒãã£ã·ã§ã³ããã¢ãŒã«ã€ããããŠããªããžããªããæ°žä¹ ã«åé€ã§ããããã«ããŸãã äžæ¹ãããŒãã£ã·ã§ã³ããŒã¯ã»ã«ã³ããªã€ã³ããã¯ã¹ã§ããã€ãŸããããŒãã£ã·ã§ã³ããŒã«åŒãååšããå Žåãã¯ãšãªãé«éåã§ããŸãã
ãããªãã¯ã¹ã§ã¯ãããŒãã£ã·ã§ã³ããŒãšããŠã³ãããçªå·ãéžæããã®ã¯éåžžã«èªç¶ãªããšã§ãã ãã ããããŒãã£ã·ã§ã³ããŒã®åŒã«ãªããžã§ã³å€ãèšå®ãããšããã®ãããªããŒãã«ã«ã¯äžåçã«å€ãã®ããŒãã£ã·ã§ã³ãååšããã¯ãšãªã®ããã©ãŒãã³ã¹ãäœäžããŸãã ãããã£ãŠãããŒãã£ã·ã§ã³ããŒã®åŒã§ã¯ãããšãã°PARTITION BY intDivïŒrevisionã2000ïŒã®ããã«ããªããžã§ã³å€ãããã€ãã®å€§ããªæ°å€ã«åå²ããŠããŒãã£ã·ã§ã³ã®æ°ãæžããããšãã§ããŸãã ãã®æ°ã¯ãããŒãã£ã·ã§ã³ã®æ°ãæšå¥šå€ãè¶ ããªãããã«åå倧ããããå¿ èŠããããŸããã1ã€ã®ããŒãã£ã·ã§ã³ã«å€§éã®ããŒã¿ãå ¥ãããããŒã¿ããŒã¹ãããŸãå€ãã®ããŒã¿ãèªã¿åãå¿ èŠããªãããã«ååã«å°ããããå¿ èŠããããŸãã
UPDATEããã³DELETEãå®è£ ããæ¹æ³
éåžžã®æå³ã§ã¯ãUPDATEããã³DELETEã¯ClickHouseã§ã¯ãµããŒããããŠããŸããã ãã ããUPDATEããã³DELETEã®ä»£ããã«ãããŒãžã§ã³ä»ãã®åãããŒãã«ã«è¿œå ããç¹å¥ãªReplacingMergeTreeãšã³ãžã³ã䜿çšã§ããŸãïŒåãäž»ããŒå€ãæã€éè€ã¬ã³ãŒããåé€ããŸãïŒã å Žåã«ãã£ãŠã¯ãããŒãžã§ã³ã¯æåããããŒãã«ã«èªç¶ã«ååšããŸããããšãã°ããã¹ãã®çŸåšã®ç¶æ ã«å¯Ÿå¿ããããŒãã«ãäœæããå Žåããã®ããŒãã«ã®ããŒãžã§ã³ãã³ãããçªå·ã«ãªããŸãã
CREATE TABLE current_tests ( test_id UInt64, value Nullable(String), version UInt64 ) ENGINE = ReplacingMergeTree(version) ORDER BY test_id
ã¬ã³ãŒããå€æŽãããå Žåãåé€ã®å Žåã¯NULLå€ïŒãŸãã¯ããŒã¿ã§èŠã€ãããªãä»ã®ç¹å¥ãªå€ïŒã䜿çšããŠãæ°ããå€ã§ããŒãžã§ã³ãè¿œå ããŸãã
æ°ããã¹ãã¬ãŒãžã§äœãéæããŸãããïŒ
ClickHouseã«åãæ¿ããäž»ãªç®æšã®1ã€ã¯ããã¹ãå±¥æŽãé·æéïŒæ°å¹Žãææªã®å Žåã¯å°ãªããšã1幎ïŒã«ããã£ãŠä¿åããæ©èœã§ããã ãã§ã«ãããã¿ã€ãã®æ®µéã§ãå°ãªããšã3幎ã®å±¥æŽãä¿åããããã«ãµãŒããŒå ã®æ¢åã®SSDãåé¿ã§ããããšãæããã«ãªããŸããã åæã¯ãšãªãå€§å¹ ã«é«éåããããããããŒã¿ããã¯ããã«æçšãªæ å ±ãæœåºã§ããããã«ãªããŸããã RPSããŒãžã³ãå¢å ããŸããã ããã«ããã®å€ã¯ãClickHouseã¯ã©ã¹ã¿ãŒã«æ°ãããµãŒããŒãè¿œå ããããšã§ã»ãŒç·åœ¢ã«ã¹ã±ãŒãªã³ã°ãããŸãã ClickHouseããŒã¿ããŒã¹çšã®æ°ããããŒã¿ãŠã§ã¢ããŠã¹ãäœæããããšã¯ã倧éã®ããŒã¿ãä¿åããã³åŠçããæ©èœã®ãããã§ãæ°ããæ©èœãè¿œå ããéçºãå éããã³ç°¡çŽ åãããšãããããéèŠãªç®æšã«åãããšã³ããŠãŒã¶ãŒã«ãšã£ãŠã¯ã»ãšãã©ç®ç«ããªãã¹ãããã§ãã
ç§ãã¡ã«æ¥ãŠ
ç§ãã¡ã®éšéã¯åžžã«æ¡å€§ããŠããŸãã è€éã§èå³æ·±ãã¿ã¹ã¯ãšã¢ã«ãŽãªãºã ã«åãçµã¿ããå Žåã¯ã åœç€Ÿãã芧ãã ãã ã ã質åãããå Žåã¯ãPMã§çŽæ¥ãåãåãããã ããã
䟿å©ãªãªã³ã¯
ã¹ããªãŒã åŠç
- ãã°ïŒãã¹ãŠã®ãœãããŠã§ã¢ãšã³ãžãã¢ããªã¢ã«ã¿ã€ã ããŒã¿ã®çµ±åæœè±¡åã«ã€ããŠç¥ã£ãŠããã¹ãããš ã
- ããããè¶ ããäžçïŒã¹ããªãŒãã³ã°101
- ããŒã¿éçŽåã¢ããªã±ãŒã·ã§ã³ãèšèšããããã¯-O'Reilly Mediaã
河童建ç¯
ClickHouseïŒ