暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

openGauss CStoreIndexScan算子

openGauss小助手 2021-10-22
309

CStoreIndexScan算子用于使用索引对表进行扫描,如果过滤条件中涉及索引,可以使用该算子加速元组获取,对应的代码源文件是“veccstoreindexscan.cpp”。CStoreIndexScan算子对应的主要数据结构是CStoreIndexScanState,CStoreIndexScanState继承于CStoreScanState。具体定义代码如下:

typedef struct CStoreIndexScanState : CStoreScanState {

CStoreScanState* m_indexScan;

CBTreeScanState* m_btreeIndexScan;

CBTreeOnlyScanState* m_btreeIndexOnlyScan;

List* m_deltaQual;

bool index_only_scan;

/* 扫描索引并从基表中得到以下信息 */

int* m_indexOutBaseTabAttr;

int* m_idxInTargetList;

int m_indexOutAttrNo;

cstoreIndexScanFunc m_cstoreIndexScanFunc;

} CStoreIndexScanState;

CStoreIndexScan算子的相关函数包括:ExecInitCStoreIndexScan(初始化节点)、ExecCStoreIndexScanT(执行节点)、ExecEndCStoreIndexScan(退出节点)、ExecReScanCStoreIndexScan(重置节点)。

ExecInitCStoreIndexScan函数用于初始化CStoreIndexScan算子。主要执行流程是:首先创建CStoreScan执行节点scanstate,之后根据scanstate创建CStoreIndexScanState节点。最后打开相关的relation和index。

ExecCStoreIndexScanT函数是CStoreIndexScan算子的主体函数。主要执行流程是:首先会从计划节点中获取Btree的相关信息,设置runtime扫描关键词,最后循环地获取结果集,直到执行结束。

ExecEndCStoreIndexScan函数用于在执行结束时清理CStoreIndexScan算子。主要执行流程是:首先清理相应的CStoreScan算子,之后关闭相应的index、relation。

ExecReScanCStoreIndexScan函数用于重新执行扫描计划。主要执行流程是:首先重新扫描m_indexscan,之后重新扫描相关节点信息。

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论