zoukankan      html  css  js  c++  java
  • PostgreSQL在何处处理 sql查询之十一

    接前面,继续进行分析:

    前面已经说过,在planner函数运行时,发生了实际物理磁盘访问。

    /*****************************************************************************
     *
     *       Query optimizer entry point
     *
     * To support loadable plugins that monitor or modify planner behavior,
     * we provide a hook variable that lets a plugin get control before and
     * after the standard planning process.  The plugin would normally call
     * standard_planner().
     *
     * Note to plugin authors: standard_planner() scribbles on its Query input,
     * so you'd better copy that data structure if you want to plan more than once.
     *
     *****************************************************************************/
    PlannedStmt *
    planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
    {
        PlannedStmt *result;
    
        if (planner_hook)
            result = (*planner_hook) (parse, cursorOptions, boundParams);
        else
            result = standard_planner(parse, cursorOptions, boundParams);
        return result;
    }
    
    PlannedStmt *
    standard_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
    {
        ...
    /* primary planning entry point (may recurse for subqueries) */
        top_plan = subquery_planner(glob, parse, NULL,
                                    false, tuple_fraction, &root);
        ...
        top_plan = set_plan_references(root, top_plan);
        ...
        forboth(lp, glob->subplans, lr, glob->subroots)
        {
            Plan       *subplan = (Plan *) lfirst(lp);
            PlannerInfo *subroot = (PlannerInfo *) lfirst(lr);
    
            lfirst(lp) = set_plan_references(subroot, subplan);
        }
    /* build the PlannedStmt result */
        result = makeNode(PlannedStmt);
        ...
        return result;
    }

    接着,要分析 subquery_planner

  • 相关阅读:
    类似qq弹窗,自动消失
    词法分析实验报告
    编译原理
    开发中遇到的杂七杂八
    Gradle+Jetty实现静态资源的热部署
    Eclipse中进行Gradle+Jetty部署的web项目的断点调试
    俳句与短歌收藏
    影评收藏
    诗歌与词曲收藏
    歌词收藏
  • 原文地址:https://www.cnblogs.com/gaojian/p/3094444.html
Copyright © 2011-2022 走看看