博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PostgreSQL在何处处理 sql查询之三十九
阅读量:5152 次
发布时间:2019-06-13

本文共 2717 字,大约阅读时间需要 9 分钟。

接前面,这次重点分析 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);            else                return 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)

转载于:https://www.cnblogs.com/gaojian/archive/2013/05/31/3110493.html

你可能感兴趣的文章
处理程序“PageHandlerFactory-Integrated”在其模块列表中有一个错误模块“Manag
查看>>
01: socket模块
查看>>
mysql触发器
查看>>
淌淌淌
查看>>
web页面实现指定区域打印功能
查看>>
win10每次开机都显示“你的硬件设置已更改,请重启电脑……”的解决办法
查看>>
C++有关 const & 内敛 & 友元&静态成员那些事
查看>>
函数积累
查看>>
Swift 入门之简单语法(六)
查看>>
〖Python〗-- IO多路复用
查看>>
栈(括号匹配)
查看>>
Java学习 · 初识 面向对象深入一
查看>>
源代码如何管理
查看>>
vue怎么将一个组件引入另一个组件?
查看>>
bzoj1040: [ZJOI2008]骑士
查看>>
LeetCode 74. Search a 2D Matrix(搜索二维矩阵)
查看>>
利用SignalR来同步更新Winfrom
查看>>
反射机制
查看>>
CocoaPod
查看>>
BZOJ 1251: 序列终结者 [splay]
查看>>