PostgreSQL在何处处理 sql查询之六
前面说过 PortalStart明确执行策略后,要执行 ExecutorStart。
那么ExecutorStart 到底作了什么呢。以下是缩略:
/* ----------------------------------------------------------------* ExecutorStart** This routine must be called at the beginning of any execution of any* query plan** Takes a QueryDesc previously created by CreateQueryDesc (which is separate* only because some places use QueryDescs for utility commands). The tupDesc* field of the QueryDesc is filled in to describe the tuples that will be* returned, and the internal fields (estate and planstate) are set up.** eflags contains flag bits as described in executor.h.** NB: the CurrentMemoryContext when this is called will become the parent* of the per-query context used for this Executor invocation.** We provide a function hook variable that lets loadable plugins* get control when ExecutorStart is called. Such a plugin would* normally call standard_ExecutorStart().** ----------------------------------------------------------------*/ void ExecutorStart(QueryDesc *queryDesc, int eflags) {if (ExecutorStart_hook)(*ExecutorStart_hook) (queryDesc, eflags);elsestandard_ExecutorStart(queryDesc, eflags); }void standard_ExecutorStart(QueryDesc *queryDesc, int eflags) { .../** If non-read-only query, set the command ID to mark output tuples with*/switch (queryDesc->operation){...}/** Copy other important information into the EState*/estate->es_snapshot = RegisterSnapshot(queryDesc->snapshot);estate->es_crosscheck_snapshot = RegisterSnapshot(queryDesc->crosscheck_snapshot);estate->es_top_eflags = eflags;estate->es_instrument = queryDesc->instrument_options;/** Initialize the plan state tree*/InitPlan(queryDesc, eflags);/** Set up an AFTER-trigger statement context, unless told not to, or* unless it's EXPLAIN-only mode (when ExecutorFinish won't be called).*/if (!(eflags & (EXEC_FLAG_SKIP_TRIGGERS | EXEC_FLAG_EXPLAIN_ONLY)))AfterTriggerBeginQuery();MemoryContextSwitchTo(oldcontext); }
核心一条就是,对 QueryDesc 型指针所指向的结构,进行了设置,以备后面的使用(ExecutorRun)。
上述代码的注释中已经说明:使用了CreateQueryDesc时产生的 QueryDesc,设置其tupDesc。
PostgreSQL在何处处理 sql查询之六相关推荐
- PostgreSQL在何处处理 sql查询之六十六
继续分析 /** final_cost_hashjoin* Final estimate of the cost and result size of a hashjoin path.** Note: ...
- PostgreSQL在何处处理 sql查询之六十二
对 RelOptInfo * make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2) 函数进行研究: 看看 inner ...
- PostgreSQL在何处处理 sql查询之五十一
继续分析 query_planner: /** query_planner* Generate a path (that is, a simplified plan) for a basic quer ...
- PostgreSQL在何处处理 sql查询之五十二
开始 /** Ready to do the primary planning.*/final_rel = make_one_rel(root, joinlist); 展开: /** make_one ...
- PostgreSQL在何处处理 sql查询之四十七
再次上溯: /*--------------------* subquery_planner* Invokes the planner on a subquery. We recurse to her ...
- PostgreSQL在何处处理 sql查询之二十二
接前面. 回到程序调用关系上来: estimate_rel_size -> RelationGetNumberOfBlocks->RelationGetNumberOfBlocksINFo ...
- PostgreSQL在何处处理 sql查询
如果我开一个psql窗口,来输入sql文,它在数据库的何处被解析?在何处被"真正"处理? postgres.c 的 int PostgresMain(int argc, char ...
- PostgreSQL在何处处理 sql查询之五十四
接前面,从 cheapeast_path 的角度,关注 query_planner 函数,对其进行简化: void query_planner(PlannerInfo *root, List *tli ...
- PostgreSQL在何处处理 sql查询之二
在exec_simple_query中,代码如下: 1 /* 2 * exec_simple_query 3 * 4 * Execute a "simple Query" prot ...
最新文章
- 在SQL Server中分页结果的最佳方法是什么
- Flink JAR包上传和运行逻辑
- tensorflow入门之损失函数
- Intellij IDEA中安装使用PlantUML画时序图、类图等
- 时间序列研(part9)--均衡与误差修正机制
- C++实现dijkstra单源最短路径
- 谷歌逐步取消对IE6的支持
- hive double 转decimal_大白话详解大数据hive知识点,老刘真的很用心(3)
- linux内核实时调度,基于Linux内核的实时调度机制的研究和实现
- 【数据结构和算法笔记】分别用vector数组和链表实现图的邻接表
- Axure授权码,2021年11月11日亲测有效
- [翻译] LaTeX Error: Can be used only in preamble
- 计算机网络和现场总线的区别,现场总线系统的特点和组成
- java 滑杆和进度条_进度条 和 滑条
- 人生在世,最大的笑话莫过于自作多情...
- 科研 | 心理学在线科研历史,你真的了解它吗?
- 科班出身程序员和培训出来的程序员区别在哪?
- windows下使用nvcc和nvprof
- 开源5款工具漏洞扫描,打包带走吧!
- 机器学习四 数据的差异性
热门文章
- 脚本示例 (Reporting Services)Microsoft Visual Basic .NET
- outlook搜索不到历史邮件内容
- JMS的两种消息模型(Point-to-Point(P2P)和Publish/Subscribe(Pub/Sub))应用举例
- “短路求值(Short-Circuit Evaluation)
- [Dubbo开发]配置简单的生产者和消费者
- ASP.NET MVC学习:MVC 特性作用(二)
- 九度oj题目1385:重建二叉树
- Java Web学习(二)数据加密
- Android进阶知识:绘制流程(上)
- 第0章:战胜恐惧和懊悔