openGaussAPI分析(六)执行计划生成
2023-05-01 来源 : 网红
PlannedStmt* standard_planner(Query* parse, int cursorOptions, ParamListInfo boundParams)
{
PlannedStmt* result = NULL;//调回结果
PlannerGlobal* glob = NULL;
double tuple_fraction;
PlannerInfo* root = NULL;
Plan* top_plan = NULL;
…
glob = makeNode(PlannerGlobal);
/* primary planning entry point (may recurse for subqueries) */
top_plan = subquery_planner(glob, parse, NULL, false, tuple_fraction, &root); //;大规划设计过程大门
…
/* build the PlannedStmt result */
result = makeNode(PlannedStmt);//构造PlannedStmt
result->commandType = parse->commandType;
result->queryId = parse->queryId;
result->uniqueSQLId = parse->uniqueSQLId;
result->hasReturning = (parse->returningList != NIL);
result->hasModifyingCTE = parse->hasModifyingCTE;
result->canSetTag = parse->canSetTag;
result->transientPlan = glob->transientPlan;
result->dependsOnRole = glob->dependsOnRole;
result->planTree = top_plan;//分派计划书
result->rtable = glob->finalrtable;
result->resultRelations = glob->resultRelations;
…
return result;
}
仍然那时候文的join列子来所述
SELECT * FROM t1 inner JOIN t2 ON t1.c1 = t2.c1;
在planner算子分心点,用gdb查看standard_planner调回的PlannedStmt
(gdb) bt
#0 planner (parse=0x7fd93a410288, cursorOptions=0, boundParams=0x0) at planner.cpp:389
#1 0x0000000001936fbd in pg_plan_query (querytree=0x7fd93a410288, cursorOptions=0, boundParams=0x0, underExplain=false) at postgres.cpp:1197
#2 0x0000000001937381 in pg_plan_queries (querytrees=0x7fd939b81090, cursorOptions=0, boundParams=0x0) at postgres.cpp:1315
#3 0x000000000193a6b8 in exec_simple_query (query_string=0x7fd966ad2060 "SELECT * FROM t1 inner JOIN t2 ON t1.c1 = t2.c1;", messageType=QUERY_MESSAGE, msg=0x7fd931056210)
at postgres.cpp:2560
#4 0x0000000001947104 in PostgresMain (argc=1, argv=0x7fd93a2cf1c0, dbname=0x7fd93a2ce1f8 "postgres", username=0x7fd93a2ce1b0 "test") at postgres.cpp:8403
#5 0x0000000001890740 in BackendRun (port=0x7fd931056720) at postmaster.cpp:8053
#6 0x00000000018a00b1 in GaussDbThreadMain (arg=0x7fd97c55c5f0) at postmaster.cpp:12181
#7 0x000000000189c0de in InternalThreadFunc (args=0x7fd97c55c5f0) at postmaster.cpp:12755
#8 0x00000000024bf7d8 in ThreadStarterFunc (arg=0x7fd97c55c5e0) at gs_thread.cpp:382
#9 0x00007fd9a60cfdd5 in start_thread () from /lib64/libpthread.so.0
#10 0x00007fd9a5df8ead in clone () from /lib64/libc.so.6
(gdb) p *result
$14 = {type = T_PlannedStmt, commandType = CMD_SELECT, queryId = 0, hasReturning = false, hasModifyingCTE = false, canSetTag = true, transientPlan = false, dependsOnRole = false,
planTree = 0x7fd93a409d58, rtable = 0x7fd939b81660, …}
(gdb) p *result->planTree->lefttree
$46 = {type = T_SeqScan, plan_node_id = 2, parent_node_id = 1, exec_type = EXEC_ON_DATANODES, startup_cost = 0, total_cost = 1.03, plan_rows = 3, multiple = 1, plan_width = 8,…}
将Query规划设计后得到PlannedStmt
可以看着,Plannedstmt与explain分派计划书是保持一致的
。南京肛肠医院专家预约挂号成都妇科医院
关节僵硬吃什么药好
艾得辛和甲氨蝶呤一样吗
济南男科医院哪家好
-
“硬核”知识在较短视频平台上乘风破浪
真人版“小剧场”让人忍俊不禁;遇到缺少图像资料的历史文化英雄人物时,符合英雄人物特征的同人志跃然纸上;讲出解当中,英雄人物的卡通形像小游戏也不时登场,使得画面来得加生动活泼……亲手绘制同人志、剪辑小游...
-
考生估分640,家长大肆举办地升学宴,成绩公布后亲戚们却要求退钱
前言21世纪的时光三大喜,首先是报考经传上所私立大学好的所学校,然后是肄业找到一份好岗位,接着是找到一位适宜的时光夫妻,一同组建幸福家庭,这马上是21世纪的“时光三大Fans”。在...[详细]
-
压滤机破胶絮凝剂商品买入动态(2023-07-05)
经营社中07月05日讯 交易商品牌产地交付给地最新报价压滤机破胶絮凝剂 混合物含量≥80.0 ph值4 -7 脱水率≥30.0河南森蒂环保...[详细]
-
灵动小岛并非苹果首创 iPhone 14抄袭了华为等安卓厂商5大创新
上周的产品发布新闻了iPhone 14三部iPad,星期五晚上正式开卖,由于在中端市场竞争上不用有敌手,iPhone 14三部这次又要卖轰了,Pro中端三部下单甚至都要等到11月份才能发货。...[详细]
-
这5所医科大学实力不错,录取分数低,较难普通学生报考!
导语:这5所该大学所学院战斗能力优异,的教师积分低,适宜一般来说教师被录取!医生是最受家长热爱的一个职业,而每年的病理学类管理学基本上是参赛选手最家常便饭的一个管理学,在每一年的入学考试营队筛选...[详细]
-
玉米上方阻力较多 苹果行情整体平稳运行
相关联:国信期货交易 著者:国信期货交易研报正文蔬菜:低储备承托 近端并存强势周五大连蔬菜期货交易上涨,2309合约涨约1.7%。现货方面,据汇易网,内陆地区蔬菜...[详细]