PostgreSQL在何处处理 sql查询之十二
接前面,对 subquery_planner,进行进一步的分析:
/*--------------------* subquery_planner* Invokes the planner on a subquery. We recurse to here for each* sub-SELECT found in the query tree.** glob is the global state for the current planner run.* parse is the querytree produced by the parser & rewriter.* parent_root is the immediate parent Query's info (NULL at the top level).* hasRecursion is true if this is a recursive WITH query.* tuple_fraction is the fraction of tuples we expect will be retrieved.* tuple_fraction is interpreted as explained for grouping_planner, below.** If subroot isn't NULL, we pass back the query's final PlannerInfo struct;* among other things this tells the output sort ordering of the plan.** Basically, this routine does the stuff that should only be done once* per Query object. It then calls grouping_planner. At one time,* grouping_planner could be invoked recursively on the same Query object;* that's not currently true, but we keep the separation between the two* routines anyway, in case we need it again someday.** subquery_planner will be called recursively to handle sub-Query nodes* found within the query's expressions and rangetable.** Returns a query plan.*--------------------*/ Plan * subquery_planner(PlannerGlobal *glob, Query *parse,PlannerInfo *parent_root,bool hasRecursion, double tuple_fraction,PlannerInfo **subroot) { .../** Do the main planning. If we have an inherited target relation, that* needs special processing, else go straight to grouping_planner.*/if (parse->resultRelation &&rt_fetch(parse->resultRelation, parse->rtable)->inh)plan = inheritance_planner(root);else{ plan = grouping_planner(root, tuple_fraction);/* If it's not SELECT, we need a ModifyTable node */if (parse->commandType != CMD_SELECT){List *returningLists;List *rowMarks;/** Set up the RETURNING list-of-lists, if needed.*/if (parse->returningList)returningLists = list_make1(parse->returningList);elsereturningLists = NIL;/** If there was a FOR UPDATE/SHARE clause, the LockRows node will* have dealt with fetching non-locked marked rows, else we need* to have ModifyTable do that.*/if (parse->rowMarks)rowMarks = NIL;elserowMarks = root->rowMarks; plan = (Plan *) make_modifytable(parse->commandType,parse->canSetTag,list_make1_int(parse->resultRelation),list_make1(plan),returningLists,rowMarks,SS_assign_special_param(root));}} ...return plan; }
当表所对应的文件不在时,在 grouping_planner处就会报错。
grouping_planner
本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/archive/2013/05/23/3094667.html,如需转载请自行联系原作者
PostgreSQL在何处处理 sql查询之十二相关推荐
- PostgreSQL在何处处理 sql查询之五十二
开始 /** Ready to do the primary planning.*/final_rel = make_one_rel(root, joinlist); 展开: /** make_one ...
- PostgreSQL在何处处理 sql查询之六十二
对 RelOptInfo * make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2) 函数进行研究: 看看 inner ...
- PostgreSQL在何处处理 sql查询之五十四
接前面,从 cheapeast_path 的角度,关注 query_planner 函数,对其进行简化: void query_planner(PlannerInfo *root, List *tli ...
- PostgreSQL在何处处理 sql查询之四十六
接前面,再上溯:set_base_rel_pathlists --> set_rel_pathlist /** set_base_rel_pathlists* Finds all paths a ...
- PostgreSQL在何处处理 sql查询之三十九
接前面,这次重点分析 ExecScan: 其for 循环内部: for (;;){ TupleTableSlot *slot;CHECK_FOR_INTERRUPTS(); slot = ExecSc ...
- PostgreSQL在何处处理 sql查询之三十八
这里又遇到了函数指针: executor.h头文件中,定义了 ExecScanAccessMtd 指针,或者定义了一个ExecScanAccessMtd 函数原型的指针 /** prototypes ...
- PostgreSQL在何处处理 sql查询之六十六
继续分析 /** final_cost_hashjoin* Final estimate of the cost and result size of a hashjoin path.** Note: ...
- 第九章 SQL查询数据库(二)
文章目录 第九章 SQL查询数据库(二) 调用用户定义函数的查询 查询串行对象属性 查询集合 使用说明和限制 调用文本搜索的查询 伪字段 查询元数据 快速查询 查询和企业缓存协议Enterprise ...
- 记录mysql查询过去十二个月中每个月的数据情况(含本月)
思路:创建视图,查询过去的12个月:当然,也可以使用存储过程遍历的把12个月插入到一个临时表中. 一.以视图的形式实现 1.1创建过去十二个月的视图SQL 可直接copy执行 CREATE ALGOR ...
最新文章
- Android RelativeLayout属性
- 有了阿里云服务器如何运行Javaweb项目【安转JDK】【安装mysql】【安装Tomcat】【永久运行】
- ashx误删后,未能创建类型
- 关于vs编码格式UTF8中文处理方式
- Java connot reduce_Java8: Reduce方法
- LA 4254 贪心
- struts2-简单登录实现
- 飞思卡尔c语言,飞思卡尔MCU的C语言编程框架
- pc端ui图片尺寸_聊聊PC端页面适配
- 2020.07-Study_update.5
- IP协议详解之IPv6头部结构简介
- ROC和DO的双重设计:打造出支付领域的重磅产品
- 未明学院:3月喜报,未明学员拿下BU、USC、NYC等世界名校offer!
- 2022年网络安全行业的几个关注点
- 通过刷DD-WRT固件的路由器访问猫
- 2023江苏大学计算机考研信息汇总
- 宁芝普拉姆键盘说明书
- 学习ARM开发(4)
- 沪铅上市十周年 “铅华”与本色尽显
- 王者荣耀移速计算器(已弃坑)
热门文章
- 简单验证码识别 tessnet2
- Hyperic 脚本服务(Script service)配置
- Android布局整合include界面控件 示例
- 王元编辑口语资料-中国传统之节日
- jQuery Autocomplete
- python 匹配段落_Python3 如何使用正则表达式匹配段落开头?
- ios 超签签名服务器搭建(超签)
- #软件更新#Visual Studio更新到16.3.8
- Xamarin.Forms教程开发Xamarin.Forms应用程序需要的工具
- python开发效率最高_公认8个效率最高的爬虫框架