ããã¯ããã®èšäºã§ããŒã¿ããŒã¹ã®éžæãããå
èãåŸ
ã£ãŠãããšããããšã§ã¯ãªããããŒã¿ããŒã¹ã®æåããã®è©±ã«å ããŠã
Ilya Kosmodemyansky ïŒ
@hydrobiont ïŒãéèŠã§ãããšæããã詳现ã«ã€ããŠå°ã詳ãã説æããŠããŸãã ãããŠããããããã§ãããšä¿¡ããããããçç±ããããŸãã
ãã®èšäºã¯ãè¯ã人çããçãŸãããã®ã§ã¯ãããŸããã å€ãã®å Žåãåå¿è
ã®éçºè
ã ãã§ãªããéåžžã«é«åºŠãªéçºè
ããåºæ¬çãªããšãç¥ããªã-倧åŠã§é·ãéå匷ãããã以æ¥å¿ããŠããŸã£ãããæ£åžžã«æ©èœãããããçè«ã«æ·±ãå
¥ãå¿
èŠããªããããããŸããã
ãã ãã
æŽæ°ããã«ã¯çè«çãªç¥èã圹ç«ã€å ŽåããããŸãã ããã¯ãç¹ã«è¡ããŸãã
è¬æŒè
ã«ã€ããŠïŒã€ãªã€ã»ã³ã¹ã¢ããã£ã³ã¹ããŒCEOããã³Data Egretã®ã³ã³ãµã«ã¿ã³ããããŒã¿ããŒã¹ã¹ãã·ã£ãªã¹ãPostgreSQLãOracleãDB2ã ããã«ã圌ã¯Postgresãã¯ãããžãŒã®ããã¢ãŒã·ã§ã³ãæ
åœããã«ã³ãã¡ã¬ã³ã¹ã§è¬æŒãã人ã
ã«ããããšã®é£æºæ¹æ³ãäŒããŠããŸãã
以äžã¯ã
RIT ++ 2017ã§ã®Ilyaã®ã¬ããŒãã«é¢ããè³æã§ããç¹å®ã®ããŒã¿ããŒã¹ãšã¯é¢ä¿ãããŸããã§ããããå€ãã®äž»èŠãªåŽé¢ãã«ããŒããŠããŸãã
ãªããããç¥ãå¿
èŠãããã®ã§ããïŒ
ã¹ãã¬ãŒãžãšããŒã¿åŠçã¯ãã³ã³ãã¥ãŒã¿ãŒã·ã¹ãã ã®
ããã·ã§ã³ã¯ãªãã£ã«ã«ãªã¿ã¹ã¯ã§ã ã
äžéšã®ããŒã¿ããŒã¹äœæè
ãããã§ããããã«ããã§ã«30幎ã«ããã£ãŠããã¹ããã¡ã€ã«ã«é¢ããã€ã³ã¿ãŒãããäžã®ããã°ãæã£ãŠããå Žåã§ãããšã«ãããã®ããã¹ããã¡ã€ã«ã¯å®éã«ã¯éåžžã«åçŽãªããŒã¿ããŒã¹ã§ãã
誰ããããŒã¿ããŒã¹ãçºæããããšããŠããŸã ã äŒè°ã®è¬æŒè
ã®äžäººã¯ãã20幎åã«ããŒã¿ããŒã¹ãæžãããããããäœã§ãããç¥ããªãã£ãïŒããšèšã£ãããã®åŸåã¯äžçã§éåžžã«çºéããŠããã 誰ããããããããšããŠããŸãã
ããŒã¿ãæ±ãã«ã¯
ãããŒã¿ããŒã¹ãéåžžã«äŸ¿å©ã§ã ã å€ãã®ããŒã¿ããŒã¹ã¯éåžžã«å€ãæè¡ã§ãã ãããã¯éå»åäžçŽã«ããã£ãŠéçºãããŠããŸããã70幎代ã«ã¯ãçŸåšãšåæ§ã®åçã§æ©èœããããŒã¿ããŒã¹ãæ¢ã«ååšããŠããŸããã
ãããã®
ããŒã¿ããŒã¹ã¯éåžžã«ããèããããŠäœæãããŠãããããããã°ã©ãã³ã°èšèªãéžæããŠãå
±éã®äŸ¿å©ãªããŒã¿åŠçã€ã³ã¿ãŒãã§ã€ã¹ã䜿çšã§ããŸãã ãããã£ãŠãããŒã¿ãäœããã®æ¹æ³ã§åŠçãããããšãæããããšãªããæšæºåãããæ¹æ³ã§ããŒã¿ãåŠçããããšãå¯èœã§ãã
ããã°ã©ãã³ã°èšèªã¯å€åããŠããããšãèŠããŠãããšäŸ¿å©ã§ããæšæ¥ã¯Python 2ã§ããããä»æ¥ã¯Python 3ã§ããã ããŒã¿ãæäœããäœæ¥ããšãã¥ã¬ãŒãããã³ãŒããæã£ãŠãããããããŸããããçè«çã«ã¯ããŒã¿ããŒã¹ã§ãããè¡ãå¿
èŠãããã次ã«äœããã¹ããããããŸããã
ã»ãšãã©ã®ããŒã¿ããŒã¹ã§ã¯ã
ã€ã³ã¿ãŒãã§ã€ã¹ã¯éåžžã«ä¿å®çã§ãã PostgreSQLãŸãã¯Oracleã䜿çšããå Žåãã¿ã³ããªã³ã䜿çšããã°ãæ°ããããã°ã©ãã³ã°èšèªã®éåžžã«å€ãããŒãžã§ã³ã§ãäœæ¥ã§ããŸããããã¯çŽ æŽãããããšã§ãã
ããããã¿ã¹ã¯ã¯å®éã«ã¯ç°¡åã§ã¯ãããŸããã çµæãä¿¡é ŒããŠåŠçã§ããããã«ãããŒã¿ããæã¡è² ãããããšãã§ããªãæ¹æ³ã®æ·±ããã©ãã ãéããå¹ççã«ããããŠæãéèŠãªããšãæãå§ããããããã¯é£ããããšã§ããããšãããããŸãã
åçŽãªæ°žç¶ã¹ãã¬ãŒãžãæžã蟌ãããšãããšããã¹ãŠã¯æåã®15åã ãã«ãªããŸãã ãã®åŸãããã¯ãªã©ãå§ãŸããŸããããæç¹ã§ãããããã©ãããŠãããªããšãããã®ïŒã
ããã«ã€ããŠã話ããŸãã
ããŒã¿ã¬ãã«
ãããã£ãŠãããŒã¿ã®æäœã«ã¯ããŸããŸãªã¬ãã«ããããŸãã
- ããã°ã©ãã³ã°èšèªãã䜿çšããã®ã«äŸ¿å©ãªããŒã¿ã¢ã¯ã»ã¹å±€ ã
- ã¹ãã¬ãŒãžå±€ ã ããã¯å¥ã®ã¬ã€ã€ãŒã§ããããŒã¿ã䜿çšãã以å€ã®æ¹æ³ã§ããŒã¿ãä¿åããã®ãé垞䟿å©ã§ããããã§ãïŒã¡ã¢ãªããå¹ççã«ãæŽåãããã£ã¹ã¯ã«ãã©ãŒã«ãããŸãã ããã¯ãã¹ããŒãã¬ã¹ã«é¢ãã質åã§ããä¿åã容æã§ãã¢ã¯ã»ã¹ã容æã§ã¯ãªãã¹ããŒãã§ãã
- ã Iron ãã¯ããŒã¿ãé
眮ãããå±€ã§ããããªãã¬ãŒãã£ã³ã°ã·ã¹ãã ããã£ã¹ã¯ã管çãããã©ã€ããŒãä»ããŠã®ã¿éä¿¡ãããããããŒã¿ã¯3çªç®ã®æ¹æ³ã§æŽçãããŸãã ãã®ã¬ãã«ã«ã€ããŠã¯ããŸãæãäžããŸããã
ããŒã¿
ã¢ã¯ã»ã¹å±€ã«ã¯ãäœæ¥ã䟿å©ã«ããããã«ãäŒè°ã«é¢å¿
ããããšãã
èŠä»¶ ããã ãŸã ã
- æ±çšæ§ ãããã«ãããä»»æã®ãã¯ãããžãŒã䜿çšããŠããŒã¿ãèŠæ±ã§ããŸãã
- ãã®ã¯ãšãªã®æé©æ§ ã ã¢ã¯ã»ã¹æ¹æ³ã¯ãããŒã¿ããŒã¹ããããŒã¿ãååŸããã®ã«é©ãããã®ã§ããå¿
èŠããããŸãã
- åæå®è¡æ§ïŒãã¹ãŠãã¹ã±ãŒã©ãã«ã«ãªã£ããããç°ãªããµãŒããŒãåãããŒã¿ã®ããŒã¿ããŒã¹ã«åæã«ã¢ã¯ã»ã¹ããŸãã ãã®æ¹æ³ã§åæå®è¡ã®å©ç¹ãæ倧éã«æŽ»çšããããŒã¿ãããéãåŠçããããšã確èªããå¿
èŠããããŸãã
ã¹ãã¬ãŒãžã¬ã€ã€ãŒã«ã€ããŠã¯ ã
å
ã®äžŠåæ§ãç¶æ
ããŠããã¹ãŠã®ããŒã¿ãç ŽæããããäžæžããããããæŠããããããªãããã«ããããšãéèŠã§ãã
åæã«ã
å®å
šã«ä¿ç®¡ãã確å®ã«åçŸ
ããå¿
èŠããããŸãã ã€ãŸããããŒã¿ããŒã¹ã«äœããèšé²ããå Žåãããã確å®ã«åãæ»ãå¿
èŠããããŸãã
FoxProãªã©ã®å€ãããŒã¿ããŒã¹ã䜿çšããå Žåãç ŽæããããŒã¿ãé »ç¹ã«è¡šç€ºãããããšãããããŸãã MongoDBãCassandraãªã©ã®æ°ããããŒã¿ããŒã¹ã§ã¯ããã®ãããªåé¡ãçºçããŸãã å€ãã®ããŒã¿ããããæ°ã¥ãã«ããã®ã§ã圌ãã¯åžžã«æ°ã¥ããŠãããšã¯éããŸããã
ããŒããŠã§ã¢ã«ãšã£ãŠ ãä¿¡é Œæ§ã¯æ¬åœã«éèŠã§ãã ããã§ãçè«çãªããšã«ã€ããŠè©±ãããã®ã§ãããã¯ä»®å®ã§ãã ç§ãã¡ã®ã¢ãã«ã§ã¯ãäœãããã£ã¹ã¯ã«ä¹ã£ãå Žåããã¹ãŠãããã«ãããšä¿¡ããŠããŸãã RAIDã®ãã£ã¹ã¯ãæééãã«äº€æããæ¹æ³ã¯ãä»æ¥ã®ç®¡çè
ã®é¢å¿äºã§ãã ãã®åé¡ã«ã€ããŠæ·±ãæãäžããããšã¯ãããã¹ãã¬ãŒãžãç©ççã«ã©ã®çšåºŠå¹ççã«ç·šæãããŠãããã«ã€ããŠã¯å®è³ªçã«è§ŠããŸããã
ãããã®åé¡ã解決ããããã«ãããŸããŸãªããŒã¿ã¹ãã¢ã§éåžžã«ãã䌌ãã¢ãããŒããããã€ããããŸãïŒæ°ãããã®ãšå€å
žçãªãã®ã®äž¡æ¹ïŒã
ãŸãã
ããŒã¿ãžã®æ®éçã§æé©ãª
ã¢ã¯ã»ã¹ãæäŸããããã«ãã¯ãšãªèšèªããããŸãã ã»ãšãã©ã®å Žåãããã¯
SQLã§ã ïŒçç±ã¯åŸè¿°ã
ãŸã ïŒããä»ã¯ãã¬ã³ãã«æ³šæãæãããã ãã§ãã æåã¯ãããªãé·ãéSQLããããŸãã-ãã¡ããã以åã¯ãããŸããããããã«ãããããããSQLãé·ãéæ¯é
ããŠããŸããã ãã®åŸãããããçš®é¡ã®Key-Value-StorageãåºçŸãå§ããŸãããããã¯ãSQLããªããŠãæ©èœããã¯ããã«åªããŠãããšèšããŸãã
å€ãã®Key-value-storageã¯ãäž»ã«ãæ°ã«å
¥ãã®ããã°ã©ãã³ã°èšèªããããŒã¿ã«ç°¡åã«ã¢ã¯ã»ã¹ã§ããããã«ããããã«äœæããããã®ã§ãSQLã¯ãæ°ã«å
¥ãã®ããã°ã©ãã³ã°èšèªã«ããŸãé©åããŸããã ããã¯é«ã¬ãã«ã§å®£èšåã§ããããªããžã§ã¯ã
ãå¿
èŠãªã®ã§ã
SQLã¯å¿
èŠãªããšããèãã
æµ®ãã³ãŸãã ã
ãããããããã®æè¡ã®ã»ãšãã©ã¯ãå®éã«ã¯äœããã®ã¯ãšãªèšèªãå®éã«æãã€ããŸãã Hibernateã¯ç¬èªã®ã¯ãšãªèšèªãéçºããŠããã誰ããLuaã䜿çšããŠããŸãã 以åã«Luaã䜿çšããããšããã人ã§ããSQLã®å®è£
ãè¡ã£ãŠããŸãã ã€ãŸããçŸåšã®åŸåã¯æ¬¡ã®ãšããã§ããã»ãããæäœããããã®äººéãèªãã䟿å©ãªèšèªããŸã å¿
èŠã§ããããã
SQLãåã³æ»ã£ãŠããŠããŸãã
ããã«ãããŒãã«ãã¥ãŒã¯åŒãç¶ã䟿å©ã§ãã ããçšåºŠãŸã§ãå€ãã®ããŒã¿ããŒã¹ã«ã¯ãŸã å
åããããããã¯å¶ç¶ã§ã¯ãããŸãã-ãã®ããã«ãããšãã¯ãšãªãæé©åããã®ãç°¡åã«ãªããŸãã
ãã¹ãŠã®æé©åæ°åŠã¯ãªã¬ãŒã·ã§ãã«ä»£æ°ã«
çµã³ä»ããããŠãã ãSQLãšããŒãã«ãããå Žåãäœæ¥ãã¯ããã«ç°¡åã«ãªããŸãã
ã·ãªã¢ã«åãªã©
ã®æŠå¿µã¯ã
ã¹ãã¬ãŒãžå±€ã«è¡šç€ºãããŸãã 䞊è¡æ§ãšç«¶äºåã®ããã¢ã¯ã»ã¹ãããå Žåãããã»ããµäžãŸãã¯ãã£ã¹ã¯äžã§ãããçšåºŠäºæž¬å¯èœãªé åºã§å°çããããã«ããå¿
èŠããããŸãã ããã«ã¯ãã¹ãã¬ãŒãžã¬ã€ã€ãŒã«å®è£
ãããã·ãªã¢ã«åã¢ã«ãŽãªãºã ãå¿
èŠã§ãã
ç¹°ãè¿ããŸãããäœãåé¡ãçºçããŠããŒã¿ããŒã¹ãã¯ã©ãã·ã¥ããå Žåã¯ãããã«ãããæŸãå¿
èŠããããŸãã
100ïŒ
ä¿¡é Œæ§ã®ãããã§ãŒã«ã»ãŒãã¹ãã¬ãŒãžãäœæããããšã¯å¯èœã ãšæããŸããïŒ ãããããããŒã¿ããŒã¹ãã¯ã©ãã·ã¥ããå Žåã«ããã«ãããäžããã¡ã«ããºã ãããå Žåã«ã®ã¿ãããŒã¿ããŒã¹ã確å®ã«æ©èœããããšãç¥ã£ãŠããŸãã
ããã«ã¯åŸ©å
ãå¿
èŠã§ããäœãããã«ããŠããã©ããã«åŒ±ããªã³ã¯ãšéåžžã«å€§ããªåæãªãŒããŒããããããããã§ãã 100å°ã®ãµãŒããŒã«100åã®ã³ããŒãäœæã§ããŸãããã®çµæãé»æºãŸãã¯äœããã®ã¹ã€ãããçãå°œããŠããŸããã²ã©ãçã¿ã䌎ããŸãã
å®éã
ããŒããŠã§ã¢ã®å Žå ãããŒã¿ããŒã¹ãOSãšããŸãçµ±åãããå¹ççã«åäœããæ£ããsyscallãåŒã³åºããããŒã¿ãé«éã«åŠçããããã«ãã¹ãŠã®ã«ãŒãã«æ©èœããµããŒãããããšãéèŠã§ãã
ã¹ãã¬ãŒãžå±€
ã¹ãã¬ãŒãžã¬ã€ã€ãŒããå§ããŸãããã ã©ã®ããã«æ©èœããããç解ããããšã¯ãäžäœå±€ã§äœãèµ·ãã£ãŠããããç解ããã®ã«åœ¹ç«ã¡ãŸãã
ã¹ãã¬ãŒãžã¬ã€ã€ãŒã¯ä»¥äžãæäŸããŸãã
â
䞊è¡æ§ãšå¹çãèšãæããã°ãããã¯ç«¶äºåã®ããã¢ã¯ã»ã¹ã§ãã ã€ãŸãã䞊è¡æ§ã®æ©æµãåããããšãããšãå¿
ç¶çã«ç«¶åã¢ã¯ã»ã¹ã®åé¡ãçºçããŸãã åæã«ã誀ã£ãŠèšé²ãããå¯èœæ§ã®ãã1ã€ã®ãªãœãŒã¹ãæ¢ããèšé²äžã«ããŒããæã¡ããããŠä»ã«äœã解決ããããå°çã¯ç¥ã£ãŠããŸãã
â
ä¿¡é Œæ§ïŒçœå®³åŸ©æ§ã2çªç®ã®åé¡ã¯çªç¶ã®å€±æã§ãã ä¿¡é Œæ§ã確ä¿ããããšãããã¯æãæ²æšãªãœãªã¥ãŒã·ã§ã³ãæäŸããã ãã§ãªããäœããçºçããå Žåã«è¿
éã«å埩ã§ããããšãéèŠã§ãã
競äºåã®ããã¢ã¯ã»ã¹
æŽåæ§ãå€éšããŒãªã©ã«ã€ããŠè©±ããšãã誰ããã©ããããããããããããŠãã³ãŒãã¬ãã«ã§ããããã¹ãŠãã§ãã¯ãããšèšããŸãã ããããããªããææ¡ãããããã«ïŒãããŠãããªãã®çµŠæã®äŸãæããŸãããïŒ çµŠäžã¯ããªãã«ç§»ãããŸãããããã¯æ¥ãŸããã§ããããäœããã®çç±ã§ãããã¯ããã«æããã«ãªããŸãã çç±ã¯ããããŸããããããã«ç®ããã©ãã©ããå€éšããŒãå¶çŽã®ãããã¯ã«èå³ããããŸãã
以äžã¯ãååšããªãããã°ã©ãã³ã°èšèªã®ã³ãŒãã§ãã
account_a { balance = 1000, curr = 'RUR' } send_money(account_a, account_b, 100); send_money(account_a, account_c, 200); account_a->balance = ???
1,000ã«ãŒãã«ã®æ®é«ãããéè¡å£åº§ãããã2ã€ã®æ©èœããããšããŸãã ããããå
éšã«ã©ã®ããã«é
眮ãããŠãããã¯ä»ã®ãšããéèŠã§ã¯ãããŸããããããã®é¢æ°ã¯100ãã200ã«ãŒãã«ãå£åº§
aããä»ã®éè¡å£åº§ã«è»¢éããŸãã
泚æãåé¡ã¯ãã¢ã«ãŠã³ã
aã®æ®é«ã«çµæãšããŠã©ã®ãããã®ãéã衚瀺ãããã
ãšããããšã§ãã ã»ãšãã©ã®å Žåã700ã«çããŸãã
åé¡
ããã§ç§ã®èšèªãçºæããããããããŒã¿
ãžã®ç«¶äºçã¢ã¯ã»ã¹ã®åé¡ãå§ãŸããŸãããããã©ã®ããã«å®è£
ããããããããã®æ©èœãåæã«å®è¡ããããã©ããããããŠããããã©ã®ããã«å
éšã«é
眮ããããã¯å®å
šã«æ確ã§ã¯ãããŸããã
send_moneyïŒïŒæäœã¯åºæ¬çãªã¢ã¯ã·ã§ã³ã§ã¯ãªããšèããããŸãã å¶åŸ¡1ãš2ãå®è¡ããã«ã¯ãæ®é«ãšæ®é«ã®è»¢éå
ã確èªããå¿
èŠããããŸãããããã¯ãæéããããåºæ¬çãªæäœã§ã¯ãããŸããã ãããã£ãŠããããã®å
éšã§åºæ¬æäœãå®è¡ããé åºã¯éèŠã§ãã
ã貞å察ç
§è¡šã®å€ãèªããããå¥ã®è²žå察ç
§è¡šã«èšé²ãããããšããã·ãŒã±ã³ã¹ã§ã¯ã質åãéèŠã§ãããã®è²žå察ç
§è¡šããã€èªãã ã®ã§ããããã åæã«ãããè¡ããšã競åãçºçããŸãã äž¡æ¹ã®æ©èœã¯ã»ãŒäžŠè¡ããŠå®è¡ãããŸããã€ãŸããæ®é«ã®åãå€ãèªã¿åããééãããããããæžãçããŸãã
800ã«ãŒãã«ãããã¹ã700ã«ãŒãã«ããŸãã¯ãã©ã³ã¹ã·ãŒãã«äœããã¶ã€ããããã©ã³ã¹ã·ãŒãããã«ã§ããããšãå€æããçµæãäžé£ã®ç«¶åãçºçããå¯èœæ§ããããŸãã æ®å¿µãªããããããååã«æ³šæããŠåŠçããªããšçºçããŸãã ããã«å¯ŸåŠããæ¹æ³ãç§ãã¡ã¯è©±ããŸãã
çè«çã«ã¯ããã¹ãŠãåçŽã§ã-次ã
ãšå®è¡ã§ãããã¹ãŠãããŸããããŸãã å®éã«ã¯ããããã®æäœã¯å€æ°ååšããå¯èœæ§ããããå³å¯ã«é£ç¶ããŠå®è¡ãããšåé¡ãçºçããå¯èœæ§ããããŸãã
èŠããŠãããªããæ°å¹ŽåãSberbankãOracleãããããããã«ãŒãåŠçãåæ¢ãããšãã話ããããŸããã ãã®åŸãäžè¬ã®äººã
ã«ã¢ããã€ã¹ãæ±ããããŒã¿ããŒã¹ãæžã蟌ããã°ã®æ°ã倧ãŸãã«ç€ºããŸããã ãããã¯èšå€§ãªæ°ãšç«¶äºäžã®åé¡ã§ãã
æäœãå³å¯ã«é£ç¶ããŠå®è¡ãããããšã¯ãå€ãã®æäœãååšãããšããåçŽãªçç±ãã
åŸçã§ã¯ãããŸããããŸããåæå®è¡ã®å©ç¹ã¯ãããŸããã ãã¡ãããæäœãäºãã«ç«¶åããªãã°ã«ãŒãã«åå²ã§ããŸãã ãã®ãããªã¢ãããŒããååšããŸããããããã¯çŸä»£ã®ããŒã¿ããŒã¹ã«ãšã£ãŠããŸãå€å
žçã§ã¯ãããŸããã
ãã€ãã®äº€éèŠå¶ã«ã¯èå³æ·±ã話ã1ã€ãããŸãã éè·¯ãçããªããšãã«ãŒã«ã§ã¯æåŸãŸã§å°éããå¿
èŠãããããã®åŸã¯
äžåºŠã«1ã€ãã€åæ§ç¯ãã次ã®è»ãééããå¿
èŠããããŸãã ãã¹ãŠã次ã
ã«å³å¯ã«åæ§ç¯ãããŠããŸã-ãã®ãããªå
åã¯ããã«ã€ããŠèªã£ãŠããŸãã
ããã¯ãã«ãŒã«ãå°éããå¿
èŠãããããšã倧è¡ã«é·ãéæããŠãããšãã®ãå¯èœãªã·ãªã¢ã©ã€ãŒãŒã·ã§ã³ã®çããäŸã§ãã ã¢ã¹ã¯ã¯ã§è»ãé転ãã人ã¯çããã®åçãã©ãã»ã©çæ³çã§ãªãããç解ããŠãããšæããŸãã
åºæ¬çã«ããã£ã¹ã¯ã«æžã蟌ãããŒã¿ã«å¯ŸããŠåãããšãè¡ãå¿
èŠããããŸãã
ç¶æ³ãæ¹åããã«ã¯ïŒ
âæäœã¯äºãã«ç¬ç«ããŠããå¿
èŠããããŸã-
åé¢ ã
çŽç²ã«çè«çã«å¶åŸ¡ãããæ¹æ³ã§ãæäœã¯å€éšã§äœãèµ·ãã£ãŠããããç¥ãå¿
èŠããããŸãã ããæäœãäœããå€æŽãããšããã«ããã®çµââæãããã«å¥ã®æäœã«èŠããããã«ãªãããšã¯ã§ããŸããã ããã€ãã®ã«ãŒã«ãå¿
èŠã§ãã
ããã¯ããã©ã³ã¶ã¯ã·ã§ã³åé¢ãšåŒã°ããŸãã æãåçŽãªã±ãŒã¹ã§ã¯ããã©ã³ã¶ã¯ã·ã§ã³ã¯è¿é£ã®ãã©ã³ã¶ã¯ã·ã§ã³ã§äœãèµ·ãã£ãŠããã®ããç¥ããŸããã ãããã¯ãããèªäœãã¢ã¯ã·ã§ã³ã§ããã1ã€ã®æ©èœã®ç¯å²å
ã§ãçµäºãããŸã§å€éšãšã®å¯Ÿè©±ã¯ãããŸããã
âæäœã¯ãããã¹ãŠãŸãã¯ç¡ãã®åå-
ååæ§ã§è¡ãããŸãã
ã€ãŸããæäœå
šäœãå®äºãããã®çµæãèšé²ãããããäœãåé¡ãçºçããå Žåã¯ãçŸç¶ãè¿ãããšãã§ããã¯ãã§ãã ãã®ãããªæäœã¯å埩å¯èœã§ãªããã°ãªãããå埩å¯èœã§åé¢ãããŠããå Žåã¯ã¢ãããã¯ã§ãã ããã¯åºæ¬çãªæäœã§ãããçµæã®ããã«å²ãåããŸããã éäžã§ééããããšã¯ã§ããŸããããå®å
šã«ééããããå®å
šã«ééããŸããã
âãã¹ãŠãæ£ããè¡ãããããšã確èªããã¡ã«ããºã ãã€ãŸã
äžè²«æ§ãå¿
èŠã§ãã
ç§ãã¡ã®äŸã§ã¯ã貞å察ç
§è¡šããã©ããããã®ãéãæ¥ãã®ããå°ããŸããããäœããã®çç±ã§700ãšèšããŸãããç§ãã¡ã¯çãéè¡ãäŒèšå£«ãäœããããªãããã«ç£èŠããç¯çœªæ³éæ³ã åæ³ã¯ãäžè²«æ§ã®ãã©ã€ããŒãããŒãžã§ã³ã®1ã€ã§ãã ããŒã¿ããŒã¹ã«ã€ããŠè©±ããšãå€éšããŒãå¶çŽããã®ä»ãã¹ãŠã®ãã®ããããŸãã
ACIDãã©ã³ã¶ã¯ã·ã§ã³
ååæ§ãäžè²«æ§ãåé¢ãããã³èä¹
æ§ã®ããããã£ãæã€ããŒã¿ãæã€ã¢ã¯ã·ã§ã³ã¯ãACIDãã©ã³ã¶ã¯ã·ã§ã³ã®å®çŸ©ã§ãã
D-
èä¹
æ§ã¯ãç§ã話ããŠããã¢ãã«ã§ããããŒã¿ãæ¢ã«ãã£ã¹ã¯ã«æžã蟌ãŸããŠããå Žåããããã¯ããã«ãããå®å
šã«èšé²ãããã©ãã«ãè¡ããªããšä¿¡ããŠããŸãã å®éãããã¯ããã§ã¯ãããŸãããããšãã°ãããŒã¿ãããã¯ã¢ããããå¿
èŠããããŸããããã®ã¢ãã«ã§ã¯ããã¯éèŠã§ã¯ãããŸããã
æ²ããããšã«ããããã®ããããã£ã¯ããã¯ã䜿çšããŠã®ã¿å®çŸã§ããŸãã
ãã©ã³ã¶ã¯ã·ã§ã³ã®ã¹ã±ãžã¥ãŒãªã³ã°ã«ã¯ãäž»ã«3ã€ã®ã¢ãããŒãããããŸãã
- æ²èŠ³çãªã·ã§ããŒ;
- 楜芳çãªã·ã§ããŒ;
- ãã€ããªããã·ã§ããŒãšé²è¡äžã®ãã©ã³ã¶ã¯ã·ã§ã³ã®ã¿ã€ã ã¹ã¿ã³ãããŒã¹ã®é åºä»ãã
ã·ã§ãã©ãŒã¯ ããã©ã³ã¶ã¯ã·ã§ã³ã®
ã·ãªã¢ã«åãšé©åãªå®è¡
ãä¿èšŒããã³ã³ããŒãã³ãã§ã ã
ã¿ã€ã ã¹ã¿ã³ãã®é åºã«ã€ããŠã¯èª°ããç¥ã£ãŠããŸãã1ã€ã®ãã©ã³ã¶ã¯ã·ã§ã³ã®æéãå¥ã®ãã©ã³ã¶ã¯ã·ã§ã³ã®æéãæåã«èµ·ãã人ããã®ã¹ãªããã調ã¹ãŸãã å®éãã»ãšãã©ã®æ·±å»ãªã·ã¹ãã ã§ã¯ããã®ã¢ãããŒãã«ã¯å€ãã®åé¡ããããŸãããªããªããåå¿è
ã«ãšã£ãŠã¯ããµãŒããŒã®æéãéè¡ããããã¹ããããããééã£ããããããšãããããã§ãã
ãããæ¹åããã«ã¯ããŸããŸãªæ¹æ³ããããŸããããã©ã³ã¶ã¯ã·ã§ã³ãåæãã1ã€ã®æ¹æ³ãšããŠã¯æ©èœããŸããã ãã¯ãã«æèšãã©ã³ããŒãæèšããããŸã-圌ãã¯ãã®ãããªçšèªãèããããšãããã¯ãã§ã-ãããã圌ãã¯ãŸããç¬èªã®å¶éããããŸãã
楜芳çãªã¢ãããŒãã¯ãéè¡å£åº§ã§èª¬æãããããªççŸããªãããšãæå³ããŸãã ãããã楜芳çãªãªãã·ã§ã³ã䜿çšããŠããã€ãã®æäœãå®è¡ããã®ã«åœ¹ç«ã€å®è£
ããããŸãããå®éã«ã¯ãããã¯ããŸãããŸãæ©èœããŸããã
ããŒã¿ããŒã¹ãæ±ã人ã
ãšããŠãç§ãã¡ã¯åžžã«æ²èŠ³çã§ãã ããã°ã©ããŒãæªãã³ãŒããæžãããµãã©ã€ã€ãŒãæªãããŒããŠã§ã¢ãæäŸããMary Ivannaãåºãæé€ãããšãã«å£ã®ã³ã³ã»ã³ããããµãŒããŒã®ãã©ã°ãæãããšãæåŸ
ããŠããŸãã
ãããã£ãŠã
æ²èŠ³çãªãã©ã³ã¶ã¯ã·ã§ã³ã·ã§ãã£ã³ã°ãã€ãŸãããã¯ã®å©ããå¿
èŠã§ãã ããã¯ãããŒã¿ããŒã¹ã®æŽåæ§ãä¿èšŒããå¯äžã®
ä¿èšŒãããæ¹æ³ã§ãã 蚌æããã³å®èšŒã§ãã察å¿ãã
å®çããããŸãã
ããã¯ãšããã¯è§£é€ã«å¹æçãªã¢ã«ãŽãªãºã ãå¿
èŠã§ããå¿
èŠãªãã®ããã¹ãŠãããã¯ããã ãã§ã¯ããã¹ãŠã®æäœãå³å¯ã«é£ç¶ããŠå®è¡ãããšãéåžžã«æããªããŒãžã§ã³ã«ãªãå¯èœæ§ãé«ãããã§ãã ãã§ã«ç¥ã£ãŠããããã«ãããã¯åæ䜿çšçãææ°ã®CPUããµãŒããŒæ°ãªã©ã®ç¹ã§å¹æçã§ã¯ãããŸããã
ãšã«ãã©ã³ã®ã»ãã³ãã£ã¯ã¹
次ã«èµ·ããããšãç解ããã®ã«åœ¹ç«ã€å°ããªåæ
çãªäœè«ã
ãžã£ãã¯ã»ãšã«ãã©ã³ã¯ã20äžçŽååã®ãã©ã³ã¹ã®æ°åŠè
ã§ãããå¶ç¶ã«ãååž°ãçºæããŸããã 圌ã¯æ¬¡ã®æ¹æ³ã§ãã©ã³ã¶ã¯ã·ã§ã³ã瀺ãããã«ã³ã³ãã¥ãŒã¿ãŒä»¥åã®æ代ã«æãã€ããïŒ
ããã§ã
Sã¯ãã¹ã±ãžã¥ãŒã«ããšããåèªã®äžéšã§ãã ãã©ã³ã¶ã¯ã·ã§ã³ã¹ã±ãžã¥ãŒã«ã«ã¯ãæäœ
-r ïŒèªã¿åã-èªã¿åãïŒãŸãã¯
w ïŒæžã蟌ã¿-æžã蟌ã¿ïŒãå«ãŸããŸãã
b ïŒéå§ïŒã
c ïŒã³ãããïŒãªã©ãçºçããŸãã
ããã¯äŸ¿å©ã§ã-2ã€ã®ãã©ã³ã¶ã¯ã·ã§ã³ïŒçªå·1ãš2ïŒããããŸãã 1ã€ã®ãã©ã³ã¶ã¯ã·ã§ã³ã¯ãªãœãŒã¹ïŒ
x ïŒããããŒã¿ãèªã¿åãã2çªç®ã®ãã©ã³ã¶ã¯ã·ã§ã³ããããèªã¿åãã
xã®ããã2ã€ã®èªã¿åãã«åºã¥ããŠèšç®ãè¡ãã
yã«äœããæžã蟌ã¿ãŸãã
éåžžã«äŸ¿å©-ãã©ã³ã¶ã¯ã·ã§ã³ã¯åºæ¬çãªèªã¿æžãã¢ã¯ã·ã§ã³ãèªã¿æžãã¢ã¯ã·ã§ã³ã§æ§æãããŠããŸãã scheduleãªæ°åŠã®å©ããåããŠãæçµçãªã¹ã±ãžã¥ãŒã«ãäœæãã競åããããã©ããã確èªããŠããã¹ãŠãæ£åžžã§å®å
šã§ããããšãä¿èšŒã§ããŸãã
ããã¯äœã®ããã§ããïŒ
äºçžããã¯
ææ°ã®ããŒã¿ããŒã¹ã®åºæ¬çãªã¢ã«ãŽãªãºã ã®1ã€ã¯ããããã2ãã§ãŒãºããã¯ãŸãã¯
2PL ïŒ2ãã§ãŒãºããã¯ïŒã§ãã
ããŒã¿ããŒã¹ã®ããã¯ãšããã¯è§£é€ãæé©åããããã«ã2ã€ã®ã¹ãããã§ãããè¡ãã®ã䟿å©ã§ããããšã«æ°ã¥ãããããããã¯2ãã§ãŒãºã§ãã
- ãŸããçŸåšããŒã¿ããŒã¹ã«ãããã©ã³ã¶ã¯ã·ã§ã³ã®é
åã«å¯ŸããŠèªã¿åããŸãã¯æžã蟌ã¿ãå¿
èŠãªãã¹ãŠã®ãªãœãŒã¹ã«ããã¯ãèšå®ããŸãã
- å¿
èŠãªããã¯ããã¹ãŠèšå®ããããŸã§ãåäžã®ããã¯ã¯è§£é€ãããŸããã
ããã«ããããã©ã³ã¶ã¯ã·ã§ã³ãããå¹ççã«åŠçããŠãåŸ
æ©ããªãããã«ããããšãã§ããŸãã
å³3ã§ã¯ãããŒã¯ãã©ã³ã¶ã¯ã·ã§ã³ãšãã®å®è¡æéã瀺ããŠããŸãã ãªãœãŒã¹
xã®æåã®ãã©ã³ã¶ã¯ã·ã§ã³ã§ã®æžã蟌ã¿æäœã¯ãèšé²ã«æéããããããããã£ã¹ã¯ãå転ãããŸã§ãããŒãžãããã«ç§»åãããªã©ã®çç±ã§ããŒã以å€ã®æéããããŸãã
éå§æã«ã¯ããã®ã¢ãã«ã«ã¯ä»ã®ãã©ã³ã¶ã¯ã·ã§ã³ããªããããèšé²ãéå§ãããæžã蟌ãŸããŸãã ãã ãã2çªç®ã®ãã©ã³ã¶ã¯ã·ã§ã³ã
xãèªã¿åãå¿
èŠããããŸãã
xãçŸåšå¥ã®ãã©ã³ã¶ã¯ã·ã§ã³ã«ãã£ãŠæžã蟌ãŸããŠãããšããåçŽãªçç±ã«ããããã®ãã©ã³ã¶ã¯ã·ã§ã³ã¯
xã®èªã¿åããããã¯ã§ããŸããã ç·ãç Žç·ã«ãªããŸã-ããã¯ããã©ã³ã¶ã¯ã·ã§ã³
t 1ãèšå®ããããã¯ããã©ã³ã¶ã¯ã·ã§ã³ãåŸ
æ©ããŠããããšãæå³ããŸãã
ãã©ã³ã¶ã¯ã·ã§ã³
t 2ããããå®è¡ããããã«å¿
èŠãªãã¹ãŠã®ããã¯ãååŸãããšããã«-圌女ã¯ãŸã
yã®ããã¯ãš
zã®ããã¯ãå¿
èŠãšããŠããŸã-ãããã圌女ã¯ãããã解æŸãå§ããããšãã§ããŸãã ãã®æç¹ã§ã次ã®ãã©ã³ã¶ã¯ã·ã§ã³ã®ããã¯ã解é€ãããæåŸãŸã§å®è¡ãããŸãã
ãã®èãæ¹ã«ããããã©ã³ã¶ã¯ã·ã§ã³ã®å¹çãåäžããåºæ¬æäœããããã¯ããã競åããå Žåã«ã®ã¿åŸ
æ©ããããã«ãåãæäœã®ã¿ã䞊åã«é
眮ã§ããŸãã
ãTransactional Information SystemsãïŒGerhard WeikumãGottfried VossenïŒãšããæ¬ããå§ãããŸããããã¯ãååŒçè«ã«é¢ããåºæ¬çãªæç§æžã§ãã
äºçžããããã³ã°ã®äœãæªãã®ã§ããïŒ
1ã€ã®åçŽãªéæ³ã®ã¢ã«ãŽãªãºã ã§ãã¹ãŠã®ããŒã¿ããŒã¹ã®åé¡å
šäœã解決ã§ããªãã®ã¯ãªãã§ããïŒ
â第äžã«ããã®ãããªããã¯ã§ã¯ãé¶ãåµã®ããã«éæã§ãªãå Žåãå¿
ç¶çã«ãããããã¯ãçºçããŸãã
ãããã©ã³ã¶ã¯ã·ã§ã³ã¯ãªãœãŒã¹
xãå¿
èŠãšããå¥ã®ãã©ã³ã¶ã¯ã·ã§ã³ã¯ããããããã¯ãã次ã«åããªãœãŒã¹ã暪æ¹åã«å¿
èŠãšãã誰ãæåã«ããã¯ã解é€ãã¹ããã¯æ確ã§ã¯ãããŸããã ãããè¡ãããã«ãããŒã¿ããŒã¹ã«ã¯ããããããã¯ãšãããããããããã¯ã·ã¥ãŒãã£ã³ã°ãå¶åŸ¡ããããã®ç¹å¥ãªã·ã¹ãã ããããŸãã ãããããã¯ãå¹³åçã«è§£æ±ºããããšã¯ã§ããŸãããããã©ã³ã¶ã¯ã·ã§ã³ã®1ã€ãããŒã«ããã¯ããã ãã§ãã
éåžžããããããã¯æ€åºå
ã®æ°åŠã¯ãããããã¯ã°ã©ãã§ããããã©ã³ã¶ã¯ã·ã§ã³IDãé ç¹ã«ç€ºãããæåãšããžãã©ã®ãããã¯ãã©ã®ãããã¯ããã®ããããã³ã°ãåŸ
æ©ããŠãããã瀺ããŸãã ãã®ã°ã©ãã§ã¯ããããã®é ç¹ã®1ã€ããã®å°ããªãµãã°ã©ãã匷調衚瀺ãããŠããŸããããšãã°ã1ã€ã®ãã©ã³ã¶ã¯ã·ã§ã³ãéåžžã«å€æ°ã®ãã©ã³ã¶ã¯ã·ã§ã³ãåŸ
æ©ããŠããå Žåããã®ãã©ã³ã¶ã¯ã·ã§ã³ãéä»ãã«ãªããŸãã
ãããããããããã¯æ€åºã§æ€çŽ¢ã§ããä»ã®çŸããæ°åŠçã¢ãããŒãããããŸãã
â2çªç®ã®ãã€ã³ãã¯
é
ã -誰ãããã¯ãåŸ
ã¡ãããªãã
ãªãœãŒã¹ãé·æé䜿çšãããã©ã³ã¶ã¯ã·ã§ã³ããããŸããããšãã°ãäžéšã®ã¬ããŒãã¯ãªãœãŒã¹ã䜿çšãããšã¿ãªããä»ã®ãã¹ãŠã®ãŠãŒã¶ãŒã¯åŸ
æ©ããå¿
èŠããããŸãã ãããé²ãããã«ã圌ãã¯ããã€ãã®æ¹åãæãä»ããŸãããããã«ã€ããŠã¯å°ãåŸã§èª¬æããŸãã
âãããããã®æ¹æ³ã§
ã·ãªã¢ã«åãä¿èšŒãããŸãã
2ãã§ãŒãºããããã³ã°ããªãå Žåãã·ãªã¢ã«åã¯è¡ãããŸããã ã€ãŸããåŸ
æ©æéãççž®ããããã«ã2ãã§ãŒãºããããã³ã°ãæ¹åããæ¹æ³ãç解ããå¿
èŠããããŸãã
ææ°ã®ããŒã¿ããŒã¹ã§ã¯ãããŒãžã§ã³ä»ãããŒã¿ããŒã¹ã«ã€ããŠè©±ããŠããå Žåã§ãã2ãã§ãŒãºããã¯ãæŽåæ§ãšã·ãªã¢ã«åãä¿èšŒããäž»ãªæ¹æ³ã§ãã
å®éãååãšããŠ2PLã§è§£æ±ºã§ããªã競åãããã競åãããã©ã³ã¶ã¯ã·ã§ã³ã®1ã€ãããŒã«ããã¯ãããŸãã éåžžãã¡ã«ããºã ã¯ããŒã¿ããŒã¹ã«å®è£
ãããŸããããŒã¿ããŒã¹ããã°ããåŸ
æ©ããäžéšã®ãã©ã³ã¶ã¯ã·ã§ã³ãããã¯ãé·æéåŸ
æ©ããŠããããšãããã³ç«¶åã解決ããæ¹æ³ããªãããšãèªèãããšãããŒã¿ããŒã¹ã¯ãã®ãããªãã©ã³ã¶ã¯ã·ã§ã³ã匷å¶çµäºããŸãã ããã¯ãŸããªç¶æ³ã§ããã次ã®ã¢ã«ãŽãªãºã ã䜿çšãããšããããã®ç«¶åã®äžéšã解決ã§ããŸãã
MVCC-ãã«ãããŒãžã§ã³åæå®è¡å¶åŸ¡
ããŒã¿ã®ããŒãžã§ã³ç®¡çã¯ãããŒã¿ãé«éåããããã ãã§ãªããçºçããå¯èœæ§ã®ããããã€ãã®ã¿ã€ãã®ç«¶åã解決ããããã«ãå¿
èŠã§ãã
âçŽæçã«ããã¹ãŠãæ確ã§ã-ããã¯ãåŸ
ããªãããã«ã以åã®ããŒãžã§ã³ã䜿çšããŸãã
äžéšã®ãªãœãŒã¹ããããã¯ãããŠããå Žåãå€ãããŒãžã§ã³ã確èªããŠäœæ¥ãéå§ã§ããŸãã ããšãã°ããããã¯ããããã©ã³ã¶ã¯ã·ã§ã³ããã®ãªãœãŒã¹ã§äœãå€æŽããªããããªããã¯ã§ãã£ãå Žåããã©ã³ã¶ã¯ã·ã§ã³ãå®è¡ãç¶ããããšãã§ããŸãã å€æŽããããæ°ãããããæ°ããããŒãžã§ã³ã®ããŒã¿ã衚瀺ãããå Žåããã©ã³ã¶ã¯ã·ã§ã³ã¯å床ãã®ããŒã¿ãå床èªã¿åãå¿
èŠããããŸãã
ãããã«ãããããã¯éåžžãããã¯ãé·æéåŸ
ã€ãããé«éã§ãã å€ãMS SQL ServerãšDB2ã®å€ãããŒãžã§ã³ãèŠããŠãããªããããã¯ã²ã©ãããšã§ãããããŠãå€ãã®ããã¯ããã£ãå Žåããããã¯ãšã¹ã«ã¬ãŒãããŸã-ãã¹ãŠãããŸããããŸããã§ããã
âææ°ã®DBMSã¯ãã¹ãŠããŒãžã§ã³ç®¡çãããŠããŸã
OracleãPostgreSQLãMySQLã¯ãã¹ãŠæ£çŽã«ãããŒãžã§ã³ç®¡çããããŠããŸãã DB2ã¯ãã®ãããã¯ã«é¢ããŠããå°ãç¬åµçã§ãããç¬èªã®ã¡ã«ããºã ããããŸã-以åã®ããŒãžã§ã³ã1ã€ã ãä¿åããŸãã
ããã¯ä»¥åã«æããã¹ã±ãžã¥ãŒã«ã§ãããããè€éã§ãã ããå€ãã®ãã©ã³ã¶ã¯ã·ã§ã³ïŒ3åïŒãããå€ãã®ãªãœãŒã¹ïŒãŸã
zããããŸãïŒãããã³2ã€ã®ã³ãããããããŸãã ã€ãŸããäž¡æ¹ã®ãã©ã³ã¶ã¯ã·ã§ã³ãã³ãããã§çµäºããŸãã
æ°åŠè
ããã®ãããªå Žåã«èšãããã«ããæ°ã¥ãããã...ã-ç§ã¯ããã倧奜ãã§ããç¹ã«åŒãååã®ããŒãã§ãããšãã å®éãããã§1ã€ã®ããšã«æ°ä»ãã®ã¯ç°¡åã§ãã 宿é¡ãšããŠããªãããã«æ°ä»ããããã®ããç解ããŠãã ããã
æããŸã
yã®åã®ããŒãžã§ã³ã䜿çšã§ããªãå Žåãæäœ
r 1 ïŒyïŒã競åãå Žåã«ãã£ãŠã¯ãããããã¯ãåŒãèµ·ãããšããåçŽãªçç±ã§ããã®ã¹ã±ãžã¥ãŒã«ã¯æ±ºããŠã·ãªã¢ã«åãããŸããã
ã€ãŸãã
yã®ä»¥åã®ããŒãžã§ã³ãããã§å©çšã§ããå Žåããã©ã³ã¶ã¯ã·ã§ã³ã¯æ£åžžã«å®äºããåé¡ã¯ãããŸããã
yã®ãã®ããŒãžã§ã³
ãããã§ãªãå Žåãæäœã¯ç«¶åããŸãã
ã©ã®ããã«æ©èœããŸããïŒ
ãã®å³ã¯ã2çžãããã¯ãšã»ãŒåãã§ãã ããã¯ãããŒãžã§ã³ãã©ã³ã¶ã¯ã·ã§ã³ã¹ã±ãžã¥ãŒãªã³ã°ã®äžçš®ã§ããã€ãŸãããŸã 2ãã§ãŒãºããããã³ã°ã¢ã«ãŽãªãºã ã§ããããã«ãããŒãžã§ã³ã¢ã«ãŽãªãºã ã®ã¿ã§ãã
å¥ã®æ©èœãæ·»ãåãšããŠè¿œå ãããŸã-0ã1ã2-ããã¯ããŒãžã§ã³çªå·ã§ãã
- ãã©ã³ã¶ã¯ã·ã§ã³t 1ãå®è¡ããããšãããšãèªã¿åãå€x 0ããããŸãã éåžžã«ãªãªãžãã«ã®ããŒãžã§ã³ã
- ããã«t 2ã§ã¯ ãããŒãžã§ã³ãå€æŽããããããç°ãªãããŒãžã§ã³ã®yã®æžã蟌ã¿ãéå§ããŸãã
- yã®æžã蟌ã¿ãéå§ããåã«éå§ãããã©ã³ã¶ã¯ã·ã§ã³t 1ã§ã¯ã t 2ããŸã å®äºããŠããªãããã y 0ã®ä»¥åã®ããŒãžã§ã³ã衚瀺ããããŸãŸã§ãããå®å
šã«äœæ¥ãéå§ã§ããŸãã
- ãã©ã³ã¶ã¯ã·ã§ã³t 1ã¯w 2 ïŒ y 2 ïŒãããæ©ãçµäºããããã yã®åèªã¿åããçºçãããã©ã³ã¶ã¯ã·ã§ã³t 2ã§éåžžã®ââæäœãå®è¡ãããä»ã®ãã©ã³ã¶ã¯ã·ã§ã³ã¯æ£åžžã«çµäºããŸãã
以åã®ããŒãžã§ã³ããªããšæ³åããããšãããšãé·ãç¹ç·ãããã«å§ãŸããŸãã
yãèªã¿åãå¿
èŠãããå Žåã
w 2 ïŒ
y ïŒã¯
t 1ãå®äºãããŸã§åŸ
æ©ãããããå®ç·ã¯éå§ããããç¹ç·ãéå§ãããŸãã ãããã£ãŠãã¹ã±ãžã¥ãŒã«ã®å¹
ãè
é£ãããã¹ãŠãé
ããªããŸãã
ããã¯å€§ããªãã©ã¹MVCCã§ãã ãã«ãããŒãžã§ã³ã¯å®éã«ã¯ããããã³ã°ãããé«éã§ãããåãªãããŒã±ãã£ã³ã°æ©èœã§ã¯ãããŸããã
ãããããã©ã³ã¶ã¯ã·ã§ã³ã®æéãæããã«ãŒãã§ã¯ãªãå Žåãããšãã°ãããŒããã©ã€ããããŒã¿ããŒã¹ã®äžã§ãã©ãã©ã«ãªã£ãããã¯ã€ã€ããµãŒããŒããåŒãåºãããããããšãé害ãçºçããŸãã
å®éããã©ã³ã¶ã¯ã·ã§ã³ã¯ãã®ããã«å®è¡ããããããããã«å¯Ÿå¿ã§ããŸãã æœè±¡ããŒã¿ããŒã¹ãèããŸãïŒ
ã¯ã©ã€ã¢ã³ãæ¥ç¶ãåŠçãããããŸããŸãªããã»ã¹ãŸãã¯ã¹ã¬ããéã§ãœãŒã·ã£ã«åãããäžå®éã®ã¡ã¢ãªããããŸãã ã¹ã¬ããã«ã¯ãSQLã¯ãšãªãå°çããç¬èªã®ã¡ã¢ãªéããããŸãã ãã®ã¡ã¢ãªéã§ãSQLã¯ãšãªïŒãŸãã¯å¥ã®èšèªã®ã¯ãšãªïŒãäœããã®æ¹æ³ã§ããªã³ã³ãã€ã«ã解éãåæ§ç¯ãããŸãã
次ã«ã圌ã¯èªã¿åããå€æŽããå¿
èŠãããããŒã¿ãæ¢ããŸãã ãã£ã¹ã¯äžã®ãã®ããŒã¿ã¯ç¹å¥ãªæ¹æ³ã§ãã ã¹ãã¬ãŒãžãããã«æ·±ãèŠããšãPostgreSQLã®åºå®éšåïŒããŒãžïŒã¯8Kbã§ãããOracleã§ã¯ããŸããŸãªãµã€ãºã䜿çšã§ããŸãã ããŸããŸãªæ¹æ³ã§ããŸããŸãªããŒã¿ããŒã¹ã«ã
ãã®ããŒãžã«ã¯ãããŸããŸãªããŒã¿ãå€æ°å«ãŸããŠãããšããç¹ã§éåžžã«äŸ¿å©ã§ãïŒå®éã«ã¯ãã¿ãã«ïŒã¿ãã«ïŒãå«ãŸããŠããŸããã€ãŸãããã¬ãŒããããããã®äžã«è¡ãããããããã®è¡ã¯å€§ããªããŒãžã«è©°ã蟌ãŸããŸãã
ãªã¯ãšã¹ããããŒãžã®1ã€ããã®ããŒã¿ãå¿
èŠãšããå Žåããã®ããŒãžãã¡ã¢ãªã«ç§»åããã ãã§ããã¹ãŠã®ã¯ãŒã«ãŒãã¹ã¬ãããããã³ããŒã¿ããŒã¹ããã»ã¹ãã¢ã¯ã»ã¹ã§ããŸãã ããªããããããå¿
èŠãªå Žåã圌ã¯ããã€ããçºçãããŸãã ãããã¯ãã£ãã·ã¥ãããŸã-ããã¯äŸ¿å©ã§çç£çã§ã-ã¡ã¢ãªã¯ãã¹ãŠã®ãã£ã¹ã¯ãããé«éã§ãã
å°ãªããšã1ã€ã®ããŒãžã§å°ãªããšã1ã€ã®ãšã³ããªãå€æŽããå¿
èŠãããå ŽåãããŒãžå
šäœããããããããŒãã£ããšããŠããŒã¯ãããŸãã ããã¯ãã䟿å©ã ããã§ãã å³ã«
xããã³
yãªãœãŒã¹ãæç»ããŸãã-ãããã¯ããã®ããŒãžã§ãã
å®éãããŒã¿ããŒã¹ã¯ãåäžã®ã¬ã³ãŒããå«ããã詳现ãªã¬ãã«ã§ãããã¯ã§ããŸãã ãããä»ãç§ãã¡ã¯ããæ·±ãçè«ã®ããšã«ã€ããŠè©±ããŠããã®ã§ãã£ãŠãæ·±ãèªèã®è€éãã«ã€ããŠã¯è©±ããŠããŸããã
ãããã£ãŠãããŒãžã¯ãããŒãã£ããšããŠããŒã¯ãããåé¡ããããŸããããã¯ãã¡ã¢ãªäžã®å°è±¡ããã£ã¹ã¯äžã®å°è±¡ãšç°ãªããšããããšã§ãã ä»èœã¡ãå Žåãã¡ã¢ãªã¯æ°žç¶çã§ã¯ãªãããããŒãã£ãããŒãžã«é¢ããæ
å ±ã倱ããŸãã
: - , , , , , , , .
, , Write Ahead Log. , â WAL , , data- .
â . - , Write Ahead Log , «». .
, , , , , , .
ARIES . 1992 .
â Write Ahead Log Write Ahead Log. . - :
- MySQL InnoDB,
- PostgreSQL , 10 WAL PGX-Log;
- Oracle Redo Log;
- DB2 â WAL.
, - â , WAL.
, , WAL. , .
Checkpoint
Checkpoint â «» . , Checkpoint. , , , .
â , , . Word , .
. . , , .
, , , - - . , . â , .
,
A B . , . , engine , , .
, SQL, . sequential scan
A B â , â .
, , JOIN, - , .
? : - Python , , JOIN 90% . â , , . , . , JOIN, , .. , , full sequential scan, , , , .
.
çµè«
SQL - ,
. SQL , . , SQL .
. : , , -. , , . , , . , , .
. . â .
, , . , , .
!
, ,
. , â SQL, , , , .
â , , , , , .
., , - - : « â , , !»
. , . noSQL - , , , . , , , , ..
, , ,
.
Percona server, MariaDB, MySQL 8, , .
, , ?
⊠++ , , Highload++ Siberia , - .
, :