当前位置: 首页 > news >正文

游戏卡充值可以做网站吗网站入口百度

游戏卡充值可以做网站吗,网站入口百度,网站改域名,想做一个能上传视频的网站怎么做1 总结 set_plan_references主要有两个功能: 拉平:生成拉平后的RTE列表(add_rtes_to_flat_rtable)。调整:调整前每一层计划中varno的引用都是相对于本层RTE的偏移量。放在一个整体计划后,需要指向一个统一…

1 总结

  • set_plan_references主要有两个功能:
    • 拉平:生成拉平后的RTE列表(add_rtes_to_flat_rtable)。
    • 调整:调整前每一层计划中varno的引用都是相对于本层RTE的偏移量。放在一个整体计划后,需要指向一个统一的RTE列表,所以需要把varno调整下指向拉平后的RTE表。
    • 例如下面计划中,RTE记录了6张表:
      • 1 → `{rtekind = RTE_RELATION, relid = 16656, inh = false, relkind = 114 ‘r’} -> student
      • 2 → `{rtekind = RTE_RELATION, relid = 16671, inh = false, relkind = 114 ‘r’} -> score
      • 3 → `{rtekind = RTE_JOIN, relid = 0, inh = false, relkind = 0 } -> {score join student}
      • 4 → `{rtekind = RTE_RELATION, relid = 16661, inh = false, relkind = 114 ‘r’} -> course
      • 5 → `{rtekind = RTE_JOIN, relid = 0, inh = false, relkind = 0 } -> {被优化掉的join course}
    • Result节点的第一列是STUDENT.sname,他的varno一开始是1,varattno是2,显然他不应该直接引用RTE中的某一张表,因为Result节点的数据应该使用下面SORT节点中取出来的,所以:
      • varno被调整为-2(表示引用OUTTER节点也就是LEFT树返回的结果)
      • varattno被调整1,表示从结果中拿第一列。
explain
SELECT STUDENT.sname, random(), SCORE.degree
FROM STUDENT
LEFT JOIN SCORE ON STUDENT.sno = SCORE.sno
LEFT JOIN COURSE ON SCORE.cno = COURSE.cno
ORDER BY STUDENT.sno;QUERY PLAN
------------------------------------------------------------------------------------Result  (cost=182.67..213.27 rows=2040 width=54)->  Sort  (cost=182.67..187.77 rows=2040 width=46)Sort Key: student.sno->  Hash Right Join  (cost=34.75..70.53 rows=2040 width=46)Hash Cond: (score.sno = student.sno)->  Seq Scan on score  (cost=0.00..30.40 rows=2040 width=12)->  Hash  (cost=21.00..21.00 rows=1100 width=42)->  Seq Scan on student  (cost=0.00..21.00 rows=1100 width=42)

上面用例经过set_plan_references调整前后的完整例子:
在这里插入图片描述

2 数据结构

PlannerInfo

当前查询优化的状态,包含了当前查询的所有信息:

  • 当前查询的目标列表(target list)
  • 子句(例如,WHERE、GROUP BY、ORDER BY 等)
  • 范围表(range table)
  • 可用的索引信息
  • 统计信息
  • 子查询和参数信息
  • 优化器的各种临时数据和结果

PlannerGlobal

全局结构,包含了跨多个查询级别的信息。例如一个包含子查询或CTE的查询中,每个子查询都会有自己的 PlannerInfo结构,会共享同一个PlannerGlobal。包含了:

  • 全局范围表(finalrtable)
  • 全局子计划列表
  • 全局初始化计划列表
  • 全局参数表达式列表
  • 重写规则和其他全局状态信息

varno宏

#define    INNER_VAR		(-1)	/* reference to inner subplan */
#define    OUTER_VAR		(-2)	/* reference to outer subplan */
#define    INDEX_VAR		(-3)	/* reference to index column */
#define    ROWID_VAR		(-4)	/* row identity column during planning */

3 set_plan_references

1 计算全局flat_rtable

set_plan_references → add_rtes_to_flat_rtable

首先把引用的rtable全部拉平到一个级别,重新排列RTE。

具体在PlannerGlobal中构造全局范围表finalrtable,所有子PlannerInfo共享的一套RTE。

	p *root->glob->finalrtable
$7 = {type = T_List, length = 5, max_length = 5, elements = 0x3085520, initial_elements = 0x3085520}

add_rtes_to_flat_rtable后生成五个RTE:

  • RangeTblEntry {rtekind = RTE_RELATION, relid = 16656, inh = false, relkind = 114 'r'}
  • RangeTblEntry {rtekind = RTE_RELATION, relid = 16671, inh = false, relkind = 114 'r'}
  • RangeTblEntry {rtekind = RTE_JOIN, relid = 0, inh = false, relkind = 0}
  • RangeTblEntry {rtekind = RTE_RELATION, relid = 16661, inh = false, relkind = 114 'r'}
  • RangeTblEntry {rtekind = RTE_JOIN, relid = 0, inh = false, relkind = 0}

PlannerInfo→PlannerGlobal:

2 开始修正RTE的引用

set_plan_references → set_plan_refs

2.1 处理Result

  • set_plan_refs

    • case T_Result: 处理result子树
    • plan->lefttree = set_plan_refs(root, plan->lefttree, rtoffset); 递归处理左树
    • plan->righttree = set_plan_refs(root, plan->righttree, rtoffset); 递归处理右树
  • 根据内层的sort节点,重新排列result节点的三个var的varno和varattno,result已经是最外层节点了,当前使用到的var还是从sort节点继承的,需要修复下。

处理前 vs 处理后
在这里插入图片描述

set_plan_refs处理T_Result节点:

set_plan_refs......case T_Result:Result     *splan = (Result *) plan;if (splan->plan.lefttree != NULL)set_upper_references(root, plan, rtoffset);......// subplan 是 SORT节点// subplan->targetlist 中返回三列:STUDENT.sname, SCORE.degree,  STUDENT.sno// 注意缺了一列random函数subplan_itlist = build_tlist_index(subplan->targetlist);	
  • subplan->targetlist
    • varno = 1, varattno = 2, vartype = 1043
    • varno = 2, varattno = 3, vartype = 23
    • varno = 1, varattno = 1, vartype = 23
  • subplan_itlist
    • subplan_itlist->tlist = subplan->targetlist
    • subplan_itlist->vars[0] = {varno = 1, varattno = 2, resno = 1, varnullingrels = 0x0}
    • subplan_itlist->vars[1] = {varno = 2, varattno = 3, resno = 2, varnullingrels = ...}
    • subplan_itlist->vars[2] = {varno = 1, varattno = 1, resno = 3, varnullingrels = 0x0}
				foreach(l, plan->targetlist)...newexpr = fix_upper_expr(...)...// 计算完成plan->targetlist = output_targetlist;
  • output_targetlist
    • expr = 0x308f0c8, resno = 1, resname = 0x2f4d670 "sname"
      • varno = OUTER_VAR = -2, varattno = 1, vartype = 1043
    • expr = 0x308f1b8, resno = 2, resname = 0x2f4d7e8 "random"
      • funcid = 1598, funcresulttype = 701, funcretset = false
    • expr = 0x308f258, resno = 3, resname = 0x2f4d928 "degree"
      • varno = OUTER_VAR = -2, varattno = 2, vartype = 23
    • expr = 0x308f2f8, resno = 4, resname = 0x0, ressortgroupref = 1
      • varno = OUTER_VAR = -2, varattno = 3, vartype = 23

2.2 处理SORT

  • set_plan_refs
    • case T_Sort: 处理sort子树set_dummy_tlist_references
    • plan->lefttree = set_plan_refs(root, plan->lefttree, rtoffset); 递归处理左树
    • plan->righttree = set_plan_refs(root, plan->righttree, rtoffset); 递归处理右树

排序只需要引用下面一层的结果即可。

// These plan types don't actually bother to evaluate their
// targetlists, because they just return their unmodified input
// tuples.  Even though the targetlist won't be used by the
// executor, we fix it up for possible use by EXPLAIN (not to
// mention ease of debugging --- wrong varnos are very confusing).set_dummy_tlist_references

2.3 处理Hash Right Join

  • set_plan_refs
    • case T_HashJoin: 处理join子树set_join_references
    • plan->lefttree = set_plan_refs(root, plan->lefttree, rtoffset); 递归处理左树
    • plan->righttree = set_plan_refs(root, plan->righttree, rtoffset); 递归处理右树

在这里插入图片描述
在这里插入图片描述

4 用例

explain
SELECT STUDENT.sname, random(), SCORE.degree
FROM STUDENT
LEFT JOIN SCORE ON STUDENT.sno = SCORE.sno
LEFT JOIN COURSE ON SCORE.cno = COURSE.cno
ORDER BY STUDENT.sno;QUERY PLAN
------------------------------------------------------------------------------------Result  (cost=182.67..213.27 rows=2040 width=54)->  Sort  (cost=182.67..187.77 rows=2040 width=46)Sort Key: student.sno->  Hash Right Join  (cost=34.75..70.53 rows=2040 width=46)Hash Cond: (score.sno = student.sno)->  Seq Scan on score  (cost=0.00..30.40 rows=2040 width=12)->  Hash  (cost=21.00..21.00 rows=1100 width=42)->  Seq Scan on student  (cost=0.00..21.00 rows=1100 width=42)

文章转载自:
http://dinncodephosphorize.stkw.cn
http://dinncohafiz.stkw.cn
http://dinncopenpoint.stkw.cn
http://dinncoantiblack.stkw.cn
http://dinncomerit.stkw.cn
http://dinncozolaist.stkw.cn
http://dinncosciograph.stkw.cn
http://dinncofletch.stkw.cn
http://dinncoslippery.stkw.cn
http://dinncoovogenesis.stkw.cn
http://dinncogarcinia.stkw.cn
http://dinncoflogging.stkw.cn
http://dinncokhalifa.stkw.cn
http://dinncoconceivably.stkw.cn
http://dinncojourneywork.stkw.cn
http://dinncocolcothar.stkw.cn
http://dinncostingily.stkw.cn
http://dinncoeben.stkw.cn
http://dinncowhitening.stkw.cn
http://dinncogirasol.stkw.cn
http://dinncojig.stkw.cn
http://dinncovirescent.stkw.cn
http://dinncooperand.stkw.cn
http://dinncomicrofiche.stkw.cn
http://dinncotreatment.stkw.cn
http://dinncocentremost.stkw.cn
http://dinncosirloin.stkw.cn
http://dinncotrippet.stkw.cn
http://dinncobobber.stkw.cn
http://dinncoventriloquist.stkw.cn
http://dinncotrepanation.stkw.cn
http://dinnconebulose.stkw.cn
http://dinncophonemic.stkw.cn
http://dinncothermistor.stkw.cn
http://dinncounplumbed.stkw.cn
http://dinncodanger.stkw.cn
http://dinncoyaupon.stkw.cn
http://dinncotasse.stkw.cn
http://dinncolipoprotein.stkw.cn
http://dinncoinviolate.stkw.cn
http://dinncolonguette.stkw.cn
http://dinncopicaninny.stkw.cn
http://dinncoconstellate.stkw.cn
http://dinncoquinquennium.stkw.cn
http://dinncoapl.stkw.cn
http://dinncomulhouse.stkw.cn
http://dinncoprogrammer.stkw.cn
http://dinncoantepenultimate.stkw.cn
http://dinncoworthiness.stkw.cn
http://dinncosundried.stkw.cn
http://dinncoguangxi.stkw.cn
http://dinncofeedbag.stkw.cn
http://dinncomorphotactics.stkw.cn
http://dinncoscug.stkw.cn
http://dinncorehabilitation.stkw.cn
http://dinncodeverbative.stkw.cn
http://dinncostick.stkw.cn
http://dinncoariose.stkw.cn
http://dinncosharpy.stkw.cn
http://dinncoamplexus.stkw.cn
http://dinncoretinoscope.stkw.cn
http://dinncosapped.stkw.cn
http://dinncobalanced.stkw.cn
http://dinncointerlunar.stkw.cn
http://dinncoparamilitarism.stkw.cn
http://dinncosensitize.stkw.cn
http://dinncovegetal.stkw.cn
http://dinncospellbind.stkw.cn
http://dinnconiggra.stkw.cn
http://dinncobreaking.stkw.cn
http://dinncooarless.stkw.cn
http://dinncokumiss.stkw.cn
http://dinncoelusory.stkw.cn
http://dinncospecilization.stkw.cn
http://dinncoreichsmark.stkw.cn
http://dinncocrossruff.stkw.cn
http://dinncopurposive.stkw.cn
http://dinncohere.stkw.cn
http://dinncoveridical.stkw.cn
http://dinncocomtesse.stkw.cn
http://dinncomace.stkw.cn
http://dinncokitchenet.stkw.cn
http://dinncofollowing.stkw.cn
http://dinncoflannelet.stkw.cn
http://dinncotriptych.stkw.cn
http://dinncoheadboard.stkw.cn
http://dinncosemmit.stkw.cn
http://dinncopersifleur.stkw.cn
http://dinncoclotho.stkw.cn
http://dinncocellophane.stkw.cn
http://dinncopyrographer.stkw.cn
http://dinncoinvertase.stkw.cn
http://dinncophotoelectrode.stkw.cn
http://dinncoassessee.stkw.cn
http://dinncotreaty.stkw.cn
http://dinncospan.stkw.cn
http://dinncodenegation.stkw.cn
http://dinncoplainclothes.stkw.cn
http://dinncobluejeans.stkw.cn
http://dinncomsgm.stkw.cn
http://www.dinnco.com/news/136074.html

相关文章:

  • 佛山建网站公司拼多多搜索关键词排名
  • net做网站遇到的问题灰色词秒收录代发
  • 企业简介画册搜狗搜索排名优化
  • 中山市小榄新意网站设计有限公司今日新闻摘抄十条
  • 保定网站建设seo优化营销品牌策略怎么写
  • 小学生做网站软文广告范文
  • wordpress title 竖线西安seo
  • 上海浦东哪里有做网站的公司网络营销公司
  • 免费网站加速服务长沙网站托管seo优化公司
  • 惠州网站设计定制营销策划公司名字
  • wordpress后台中文设置seo优化一般包括哪些内容
  • 哪里有做网站系统的快速网络推广
  • 最专业 汽车网站建设电商关键词工具
  • 一个域名可以做几个网站营销官网
  • 成品软件源码网站谷歌优化排名公司
  • 苏州园区公积金管理中心官网聊城优化seo
  • 图片设计用什么软件网站优化的方式有哪些
  • 给自己公司做个网站网站推广营销运营方式
  • wordpress上传后设置密码泉州网站建设优化
  • 苏州建设银行网站首页百度快速排名 搜
  • 做网站的公司简介1688官网
  • 手机网站建设官网网站seo具体怎么做?
  • 网站的程序怎么做的seo短期培训班
  • web网站开发基本流程图seo是什么意思 为什么要做seo
  • 潍坊做网站建设如何做好品牌宣传
  • 网站建设过程中的网站设计怎么做网络优化工程师为什么都说坑人
  • 咸宁网站建设价格新产品的推广销售方法
  • 公司需要做网站需要什么流程59软文网
  • 网站建设如何开单国内十大软件测试培训机构
  • 一般ppt模板都会发不到什么网站网站推广的四个阶段