很久没复习,居然连PostgreSQL的五层逻辑架构都忘记了,下面就复习一下吧
parse -> rewrite -> plan/optimizer -> executor -> access -> storage
parser: 负责词法语法解析, 生成原始query tree
rewrite The rewrite system takes the query tree created by the parser stage and looks for any rules (stored in the system catalogs) to apply to the query tree. It performs the transformations given in the rule bodies, One application of the rewrite system is in the realization of views. Whenever a query against a view (i.e., a virtual table) is made, the rewrite system rewrites the user’s query to a query that accesses the base tables given in the view definition instead.
plan/optimizer The planner/optimizer takes the (rewritten) query tree and creates a query plan that will be the input to the executor
executor: The executor recursively steps through the plan tree and retrieves rows in the way represented by the plan. The executor makes use of the storage system while scanning relations, performs sorts and joins, evaluates qualifications and finally hands back the rows derived.
access: 存取层,也就是常说的access method, \dA可以查看AM
storage: 存储层,
后面整理


