广告
返回顶部
首页 > 资讯 > 数据库 >PostgreSQL源码学习--执行器#9
  • 681
分享到

PostgreSQL源码学习--执行器#9

PostgreSQL源码学习--执行器#9 2018-01-07 06:01:56 681人浏览 绘本
摘要

本节介绍ExecutePlan函数 相关数据结构 typedef enum ScanDirection { BackwardScanDirection = -1, NoMovementScanDirection = 0, Forwar

PostgreSQL源码学习--执行器#9

本节介绍ExecutePlan函数

相关数据结构

typedef enum ScanDirection
{
	BackwardScanDirection = -1,
	NoMovementScanDirection = 0,
	ForwardScanDirection = 1
} ScanDirection;

ExecutePlan函数

static void
ExecutePlan(EState *estate,
			PlanState *planstate,
			bool use_parallel_mode,
			CmdType operation,
			bool sendTuples,
			uint64 numberTuples,
			ScanDirection direction,
			DestReceiver *dest,
			bool execute_once);

执行查询计划,直到获取到numberTuples个元组,并且处理时朝direction方向移动。

//src/backend/executor/execMain.c


current_tuple_count = 0;


estate->es_direction = direction;


if (!execute_once)
	use_parallel_mode = false;

estate->es_use_parallel_mode = use_parallel_mode;
if (use_parallel_mode)
	EnterParallelMode();


for (;;)
{
	
	ResetPerTupleExprContext(estate);
	
	
	slot = ExecProcNode(planstate);
	
	
	if (TupIsNull(slot))
	{
		
		if (!(estate->es_top_eflags & EXEC_FLAG_BACKWARD))
			(void) ExecShutdownNode(planstate);
		break;
	}
	
	
	if (estate->es_junkFilter != NULL)
		slot = ExecFilterJunk(estate->es_junkFilter, slot);
	
	
	if (sendTuples)
	{
		
		if (!dest->receiveSlot(slot, dest))
			break;
	}
	
	
	if (operation == CMD_SELECT)
		(estate->es_processed)++;
	
	
	current_tuple_count++;
	if (numberTuples && numberTuples == current_tuple_count)
	{
		
		if (!(estate->es_top_eflags & EXEC_FLAG_BACKWARD))
			(void) ExecShutdownnode(planstate);
		break;
	}
}

if (use_parallel_mode)
	ExitParallelMode();
您可能感兴趣的文档:

--结束END--

本文标题: PostgreSQL源码学习--执行器#9

本文链接: https://www.lsjlt.com/news/6676.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作