注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

中吴南顾惟一笑

成功法则就是那19个字

 
 
 

日志

 
 

Query Processing: A Systems View  

2010-06-17 09:24:21|  分类: dbms |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
Physical (execution) plan
 A complex query may involve multiple tables and various query processing processing algorithms
     E.g., table scan, index nested-loop join, sort-merge join, hash-based duplicate elimination…
 A physical plan for a query tells the DBMS query processor how to execute the query
     A tree of physical plan operators
     Each operator implements a query processing algorithm
     Each operator accepts a number of input tables/streams and produces a single output table/stream

Physical plan execution
 How are intermediate results passed from child operators to parent operators?
 1).Temporary files
      Compute the tree bottom-up
      Children write intermediate results to temporary files
      Parents read temporary files
 2).Iterators
      Do not materialize intermediate results
      Children pipeline their results to parents    

Iterator interface
 Every physical operator maintains its own execution state and implements the following methods:
 1). open():
      Initialize state and get ready for processing
 2). getNext():
      Return the next tuple in the result (or a null pointer if there are no more tuples);
      adjust state to allow subsequent tuples to be obtained
 3). close():
      Clean up

An iterator for nested-loop join
    R: An iterator for the left subtree
    S: An iterator for the right subtree
  1).open()
  R.open(); S.open(); r = R.getNext();
  2).getNext()
    do {
        s = S.getNext();
        if (s == null) {
        S.close(); S.open(); s = S.getNext(); if (s == null) return null;
        r = R.getNext(); if (r == null) return null;
        }
    } until (r joins with s);
    return rs;
  3). close()
    R.close(); S.close();

Blocking vs. non-blocking iterators
 1).A blocking iterator must call getNext() exhaustively (or nearly exhaustively) on its children
before returning its first output tuple
     Examples: sort, aggregation
 2).A non-blocking iterator expects to make only a few getNext() calls on its children before returning its first (or next) output tuple
     Examples: filter, merge join with sorted inputs

Reference: Query Processing: A Systems View (CPS 216 Advanced Database Systems)
  评论这张
 
阅读(115)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017