• 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

  • 相关阅读:
    Struts2之Action基础与配置
    关于Struts2的类型转换详解
    Struts2自定义类型转换器
    MyEclipse 快捷键
    Struts2中的ActionContext
    struts2中的action访问web对象
    5.9每日一题题解
    5.8 每日一题题解
    5.7 每日一题题解
    5.6 每日一题题解
  • 原文地址:https://www.cnblogs.com/gaojian/p/3094444.html
Copyright © 2020-2023  润新知