merge join pg伪代码

Join {
              get initial outer and inner tuples                INITIALIZE
              do forever {
                  while (outer != inner) {                    SKIP_TEST
                      if (outer < inner)
                          advance outer                        SKIPOUTER_ADVANCE
                      else
                          advance inner                        SKIPINNER_ADVANCE
                  }
                  mark inner position                            SKIP_TEST
                  do forever {
                      while (outer == inner) {
                          join tuples                            JOINTUPLES
                          advance inner position                NEXTINNER
                      }
                      advance outer position                    NEXTOUTER
                      if (outer == mark)                        TESTOUTER
                          restore inner position to mark        TESTOUTER
                      else
                          break    // return to top of outer loop
                  }
              }
          }

 

posted @ 2019-08-22 16:10  monkey6  阅读(221)  评论(0编辑  收藏  举报