接前面,这次重点分析 ExecScan:

其for 循环内部:

    for (;;){
        TupleTableSlot *slot;CHECK_FOR_INTERRUPTS(); slot = ExecScanFetch(node, accessMtd, recheckMtd);/** if the slot returned by the accessMtd contains NULL, then it means* there is nothing more to scan so we just return an empty slot,* being careful to use the projection result slot so it has correct* tupleDesc.*/if (TupIsNull(slot)){if (projInfo)return ExecClearTuple(projInfo->pi_slot);elsereturn slot;}        ...}

接着来看 ExecScanFetch:

/** ExecScanFetch -- fetch next potential tuple** This routine is concerned with substituting a test tuple if we are* inside an EvalPlanQual recheck.    If we aren't, just execute* the access method's next-tuple routine.*/
static inline TupleTableSlot *
ExecScanFetch(ScanState *node,ExecScanAccessMtd accessMtd,ExecScanRecheckMtd recheckMtd)
{EState       *estate = node->ps.state;if (estate->es_epqTuple != NULL){/** We are inside an EvalPlanQual recheck.  Return the test tuple if* one is available, after rechecking any access-method-specific* conditions.*/Index        scanrelid = ((Scan *) node->ps.plan)->scanrelid;Assert(scanrelid > 0);if (estate->es_epqTupleSet[scanrelid - 1]){TupleTableSlot *slot = node->ss_ScanTupleSlot;/* Return empty slot if we already returned a tuple */if (estate->es_epqScanDone[scanrelid - 1])return ExecClearTuple(slot);/* Else mark to remember that we shouldn't return more */estate->es_epqScanDone[scanrelid - 1] = true;/* Return empty slot if we haven't got a test tuple */if (estate->es_epqTuple[scanrelid - 1] == NULL)return ExecClearTuple(slot);/* Store test tuple in the plan node's scan slot */ExecStoreTuple(estate->es_epqTuple[scanrelid - 1],slot, InvalidBuffer, false);/* Check if it meets the access-method conditions */if (!(*recheckMtd) (node, slot))ExecClearTuple(slot);    /* would not be returned by scan */return slot;}}/** Run the node-type-specific access method function to get the next tuple*/return (*accessMtd) (node);
}

上述的 <(estate->es_epqTuple != NULL)> 条件未能得到满足,所以

直接奔这个去了: return (*accessMtd) (node);

前面已经知道,因为没有index,所以就执行了:static TupleTableSlot * SeqNext(SeqScanState *node)

本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/archive/2013/05/31/3110493.html,如需转载请自行联系原作者

PostgreSQL在何处处理 sql查询之三十九相关推荐

  1. PostgreSQL在何处处理 sql查询之三十八

    这里又遇到了函数指针: executor.h头文件中,定义了 ExecScanAccessMtd 指针,或者定义了一个ExecScanAccessMtd 函数原型的指针 /** prototypes ...

  2. PostgreSQL在何处处理 sql查询之五十二

    开始 /** Ready to do the primary planning.*/final_rel = make_one_rel(root, joinlist); 展开: /** make_one ...

  3. PostgreSQL在何处处理 sql查询之五十四

    接前面,从 cheapeast_path 的角度,关注 query_planner 函数,对其进行简化: void query_planner(PlannerInfo *root, List *tli ...

  4. PostgreSQL在何处处理 sql查询之四十六

    接前面,再上溯:set_base_rel_pathlists --> set_rel_pathlist /** set_base_rel_pathlists* Finds all paths a ...

  5. PostgreSQL在何处处理 sql查询之十二

    接前面,对 subquery_planner,进行进一步的分析: /*--------------------* subquery_planner* Invokes the planner on a ...

  6. PostgreSQL在何处处理 sql查询之六十六

    继续分析 /** final_cost_hashjoin* Final estimate of the cost and result size of a hashjoin path.** Note: ...

  7. PostgreSQL在何处处理 sql查询之六十二

    对 RelOptInfo * make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2) 函数进行研究: 看看 inner ...

  8. SAP UI5 应用开发教程之三十九 - SAP UI5 应用出现白屏的一些常见错误和分析方法分享试读版

    一套适合 SAP UI5 初学者循序渐进的学习教程 教程目录 SAP UI5 本地开发环境的搭建 SAP UI5 应用开发教程之一:Hello World SAP UI5 应用开发教程之二:SAP U ...

  9. 零基础带你学习MySQL—多子句查询(十九)

    零基础带你学习MySQL-多子句查询(十九)

最新文章

  1. 2020未来科学大奖获奖名单揭晓
  2. html需要电脑什么配置,配置一台电脑需要什么 选择配置一台好的台式电脑
  3. Kali Linux 安全渗透教程第一更
  4. Remoting 技术
  5. 网络配置之ifconfig及Ip命令详解
  6. MySQL高级 - 日志 - 错误日志
  7. PHP中的stdClass 【转】
  8. Kubesphere V2.1.1安装后开启可拔插组件DevOps
  9. ios fixed定位后内容不显示_记录CSS中 position:fixed 踩的坑
  10. c语言输入数字字母个数字是什么意思,请问这个用c怎么做:输入一串字符,分别统计其中数字和字母的个数...
  11. 关于Android中获取Intent里的数据
  12. 1月4日 每次安装都有新问题
  13. spring中IOC的简单使用
  14. 学习3 二维游戏动画合成(侠客行)
  15. 海康威视工业相机SDK二次开发(VS+Opencv+QT+海康SDK+C++)(二)
  16. laypage分页java例子_基于LayUI分页和LayUI laypage分页的使用示例
  17. 热敏电阻制作温度传感器的c语言,NTC热敏电阻温度测量和控制系统.doc
  18. 小度计算机笔记,开售告罄、口碑炸裂、高语音交互率的小度耳机全新升级语音笔记...
  19. 背景颜色、字体等的不透明区别 (opacity、transparent以及rgba的区别)
  20. Android高德混淆问题

热门文章

  1. linux改变该进程优先级,linux – 是nice()用于更改线程优先级或进程优先级吗?
  2. 浅析Java中的final关键字
  3. java基本数据类型_Java面试题Java中有几种基本数据类型?它们分别占多大字节?...
  4. html监听页面关闭事件,JS针对浏览器窗口关闭事件的监听方法集锦
  5. MYSQL二级表的管理_MySQL分区表的管理~2
  6. 为什么整数集合使用Z来表示?
  7. 2021年春季学期-信号与系统-第十四次作业参考答案-第五小题参考答案
  8. RASPBERRY PI PICO 树莓派PICO开发板双核高性能低功耗RP2040芯片
  9. CH451 点阵LED显示模块
  10. 使用BH1750测量激光发射器的强度