Nested Loop Join
ãå®ã¯ãMySQLãå®è£ ãã¦ããJOINã®ã¢ã«ã´ãªãºã ã¯ãNested Loop Joinï¼ä»¥ä¸NLJï¼ã¨ãã®å¤åå½¢ã ãã§ãããMySQL 5.6.3ã§æ°ãã«å ãã£ãBKA JOINããããæ¡ä»¶ä¸ã«ããã¦NLJãé«éåããã¢ã«ã´ãªãºã ã§ããã¨è¦åããã¨ãã§ãããä»ã®RDBMSã§ã¯ãã¼ã¸ã½ã¼ãJOINãããã·ã¥JOINã¨ãã£ãã¢ã«ã´ãªãºã ãå®è£ ããã¦ãããã®ãå¤ãããMySQLã¯ãããã®ã¢ã«ã´ãªãºã ã«ã¯ä»ã®ã¨ããç¡ç¸ã§ããã
ãNLJã¨ã¯ä¸ä½ãããªãã¢ã«ã´ãªãºã ã§ããããæ¬ç¨¿ã®èªè ã®å¤ãã¯ãåç¥ã®ãã¨ã ããããJOINã®æé©åãèããä¸ã§ã¢ã«ã´ãªãºã ã®ç解ã¯æ¬ ãããªãã®ã§ãããã§æ¹ãã¦è§£èª¬ããããNLJã«ã¤ãã¦çç¥ãã¦ãã人ã¯èªã¿é£ã°ãã¦é ãã¦çµæ§ã ã
ãNLJã¯ãã®åã示ãããã«ãåºæ¬ã¨ãªãã¢ã«ã´ãªãºã ã¯ã«ã¼ãã§ãããt1ã¨t2ã¨ããï¼ã¤ã®ãã¼ãã«ãæ¡ä»¶ãæå®ããã«çµåããå ´åãã¤ã¾ãç´ç©ï¼Productï¼ãå®è¡ããå ´åã®ã¢ã«ã´ãªãºã ã¯æ¬¡ã®ããã«ãªãã
for each row in t1 { for each row in t2 { send joined row to client } }
ããã®ããã«NLJã®å¦çã¯ã«ã¼ãã«ãªã£ã¦ããããã¼ãã«æ°ãå¢ããã°ã«ã¼ãã®ãã¹ããã©ãã©ãæ·±ããªããé常ãç´ç©ãå¿ è¦ã¨ãªãã±ã¼ã¹ã¯ç¨ã§ãããçµåã®æ¡ä»¶ãæå®ããããããããã®ãã¼ãã«ãããã§ããããè¡ã«ã¤ãã¦æ¡ä»¶ãæå®ãããããNLJã®ã¢ã«ã´ãªãºã ã¯æ¬¡ã®ããã«ãªãã
for each row in t1 matching where condition { for each row in t2 matching join and where condition { send joined row to client } }