1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時(shí)間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
      PostgreSQL中PlannedStmt結(jié)構(gòu)的日志分析

      這篇文章主要介紹了PostgreSQL中PlannedStmt結(jié)構(gòu)的日志分析,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

      我們提供的服務(wù)有:成都網(wǎng)站制作、網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè)、微信公眾號(hào)開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、義縣ssl等。為成百上千家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的義縣網(wǎng)站制作公司

      PostgreSQL中PlannedStmt結(jié)構(gòu)的日志分析

      APPEND->appendplans

      APPEND->appendplans是鏈表結(jié)構(gòu),有2個(gè)元素,每個(gè)元素的類型為T_NESTLOOP(內(nèi)嵌循環(huán)),通常的信息與其他節(jié)點(diǎn)類型類似,重點(diǎn)是lefttree和righttree均不為空,jointype為0表示INNER_JOIN

      LIMIT->SORT->APPEND->appendplans->head
      lefttree
      進(jìn)入第一個(gè)元素的左樹

                    :lefttree 
                        {SEQSCAN /T_SEQSCAN類型的Node,順序掃描
                        :startup_cost 0.00 
                        :total_cost 12.00 
                        :plan_rows 1 //涉及的行數(shù)
                        :plan_width 256 //平均行寬
                        :parallel_aware false 
                        :parallel_safe true 
                        :plan_node_id 5 //Plan id
                        :targetlist (...) //省略
                        :qual (
                           {OPEXPR 
                           :opno 98  //PG_OPERATOR OID of the operator,texteq字符串相等
                           :opfuncid 67 //PG_PROC OID of underlying function,texteq字符串相等
                           :opresulttype 16 //PG_TYPE OID of result value,bool值
                           :opretset false 
                           :opcollid 0 //pg_collation
                           :inputcollid 100 //輸入的collation(default)
                           :args (//參數(shù),鏈表類型
                              {RELABELTYPE //第1個(gè)參數(shù)為RelabelType類型
                              :arg //指向Expr的指針,實(shí)際類型為VAR
                                 {VAR //第
                                 :varno 4 //在rtable中處于第4個(gè)位置的RTE
                                 :varattno 2 //屬性編號(hào)
                                 :vartype 1043 //類型,pg_type OID,varchar
                                 :vartypmod 14 
                                 :varcollid 100 
                                 :varlevelsup 0 
                                 :varnoold 4 //原始的varno
                                 :varoattno 2 //原始的varattno
                                 :location 110//token位置(在SQL語句中)
                                 }
                              :resulttype 25 
                              :resulttypmod -1 
                              :resultcollid 100 
                              :relabelformat 2 
                              :location -1
                              }
                              {CONST //第2個(gè)參數(shù)為Const類型
                              :consttype 25 //pg_type OID
                              :consttypmod -1 //
                              :constcollid 100 //
                              :constlen -1 
                              :constbyval false //傳值?如為false,則constvalue中的前4個(gè)字節(jié)為value的說明,在這個(gè)案例中,為32(即2的4次方),從第5個(gè)字節(jié)開始,長(zhǎng)度為4的字符串
                              :constisnull false 
                              :location 205 //token所在位置
                              :constvalue 8 [ 32 0 0 0 49 48 48 49 ]//即字符串"1001"
                              }
                           )
                           :location -1
                           }
                        )
                        :lefttree <> //左樹為空
                        :righttree <> //右樹為空
                        :initPlan <> //無初始化Plan
                        :extParam (b)
                        :allParam (b)
                        :scanrelid 4 //掃描第4號(hào)RTE
                        }

      rigthtree
      進(jìn)入第一個(gè)元素的右樹

                     :righttree 
                        {HASHJOIN //NestLoop右樹節(jié)點(diǎn)類型是HashJoin(t_grxx join t_jfxx)
                        :startup_cost 16.15 
                        :total_cost 36.12 
                        :plan_rows 7 //涉及的行數(shù)
                        :plan_width 180 //平均行大小
                        :parallel_aware false 
                        :parallel_safe true 
                        :plan_node_id 6 //計(jì)劃節(jié)點(diǎn)id
                        :targetlist (...) //投影列,省略
                        :qual <> //表達(dá)式
                        :lefttree //左樹,暫時(shí)折疊
                           {...}
                        :righttree //右樹,暫時(shí)折疊
                           {...}
                        :initPlan <> //初始化Plan
                        :extParam (b)
                        :allParam (b)
                        :jointype 0 //INNER_JOIN
                        :inner_unique false //非唯一inner join
                        :joinqual <> 
                        :hashclauses (//hash信息,類型為OpExpr
                           {OPEXPR 
                           :opno 98 //pg_operator Oid,"=",texteq
                           :opfuncid 67 //pg_proc Oid,texteq
                           :opresulttype 16 
                           :opretset false 
                           :opcollid 0 //default collation
                           :inputcollid 100 
                           :args (//參數(shù)鏈表
                              {RELABELTYPE//第1個(gè)元素 RelabelType
                              :arg 
                                 {VAR //VAR類型
                                 :varno 65001 //TODO
                                 :varattno 1 //第1列
                                 :vartype 1043 //字符串,varchar
                                 :vartypmod 14 
                                 :varcollid 100 
                                 :varlevelsup 0 
                                 :varnoold 7 //原varno,7號(hào)RTE,即t_jfxx
                                 :varoattno 1 //原屬性no
                                 :location 171//SQL語句中的token位置
                                 }
                              :resulttype 25 
                              :resulttypmod -1 
                              :resultcollid 100 
                              :relabelformat 2 
                              :location -1
                              }
                              {RELABELTYPE //第1個(gè)元素 RelabelType
                              :arg 
                                 {VAR //VAR類型
                                 :varno 65000 
                                 :varattno 1 
                                 :vartype 1043 
                                 :vartypmod 14 
                                 :varcollid 100 
                                 :varlevelsup 0 
                                 :varnoold 5 //5號(hào)RTE,即t_grxx
                                 :varoattno 2 //2號(hào)屬性
                                 :location 157
                                 }
                              :resulttype 25 
                              :resulttypmod -1 
                              :resultcollid 100 
                              :relabelformat 2 
                              :location -1
                              }
                           )
                           :location -1
                           }
                        )
                        }
                     :initPlan <> //無初始化Plan
                     :extParam (b)
                     :allParam (b)
                     :jointype 0 //INNER_JOIN
                     :inner_unique false 
                     :joinqual <> 
                     :nestParams <>

      下面考察HashJoin的左樹和右樹,首先看左樹
      ...head(Plan)->righttree(HashJoin)->lefttree

                        :lefttree 
                           {SEQSCAN //順序掃描
                           :startup_cost 0.00 
                           :total_cost 17.20 
                           :plan_rows 720 
                           :plan_width 84 
                           :parallel_aware false 
                           :parallel_safe true 
                           :plan_node_id 7 //計(jì)劃id
                           :targetlist (...)
                           :qual <> 
                           :lefttree <> 
                           :righttree <> 
                           :initPlan <> 
                           :extParam (b)
                           :allParam (b)
                           :scanrelid 7//編號(hào)為7的RTE即t_jfxx
                           }

      再看HashJoin右樹
      ...head(Plan)->righttree(HashJoin)->righttree

                        :righttree 
                           {HASH //Hash操作(創(chuàng)建Hash表)
                           :startup_cost 16.12 
                           :total_cost 16.12 
                           :plan_rows 2 //涉及2行
                           :plan_width 134 
                           :parallel_aware false 
                           :parallel_safe true 
                           :plan_node_id 8 
                           :targetlist (...)
                           :qual <> 
                           :lefttree //左樹也是一個(gè)Plan
                              {SEQSCAN //左樹為順序掃描
                              :startup_cost 0.00 
                              :total_cost 16.12 
                              :plan_rows 2 
                              :plan_width 134 
                              :parallel_aware false 
                              :parallel_safe true 
                              :plan_node_id 9 
                              :targetlist (...)
                              :qual (
                                 {OPEXPR //OpExpr類型
                                 :opno 98 
                                 :opfuncid 67 
                                 :opresulttype 16 
                                 :opretset false 
                                 :opcollid 0 
                                 :inputcollid 100 
                                 :args (
                                    {RELABELTYPE 
                                    :arg 
                                       {VAR 
                                       :varno 5 //5號(hào)RTE,即t_grxx
                                       :varattno 1 //第1個(gè)列,即dwbh
                                       :vartype 1043 
                                       :vartypmod 14 
                                       :varcollid 100 
                                       :varlevelsup 0 
                                       :varnoold 5 
                                       :varoattno 1 
                                       :location 124
                                       }
                                    :resulttype 25 
                                    :resulttypmod -1 
                                    :resultcollid 100 
                                    :relabelformat 2 
                                    :location -1
                                    }
                                    {CONST 
                                    :consttype 25 
                                    :consttypmod -1 
                                    :constcollid 100 
                                    :constlen -1 
                                    :constbyval false //非參數(shù)傳遞
                                    :constisnull false 
                                    :location 205 
                                    :constvalue 8 [ 32 0 0 0 49 48 48 49 ]//字符串"1001"
                                    }
                                 )
                                 :location -1
                                 }
                              )
                              :lefttree <> //子左樹的左樹為空
                              :righttree <> //子左樹的右樹為空
                              :initPlan <> 
                              :extParam (b)
                              :allParam (b)
                              :scanrelid 5//掃描的RTE,5號(hào)即t_grxx
                              }
                           :righttree <> //右樹為空
                           :initPlan <> 
                           :extParam (b)
                           :allParam (b)
                           :skewTable 16397 //HashJoin的表Oid
                           :skewColumn 1 //列序號(hào)
                           :skewInherit false 
                           :rows_total 0
                           }

      LIMIT->SORT->APPEND->appendplans->head->next

      子查詢中的第2個(gè)NestLoop
      參照LIMIT->SORT->APPEND->appendplans->head即可,
      條件變?yōu)閐wbh="1002",其他與鏈表中的head元素?zé)o異,不再累述

      三、小結(jié)

      1、計(jì)劃樹結(jié)構(gòu):通過日志輸出分析計(jì)劃樹結(jié)構(gòu);
      2、重要的數(shù)據(jù)結(jié)構(gòu):RTE、Plan等。

      四、附錄

      如何開啟跟蹤日志?postgresql.conf配置文件設(shè)置參數(shù):

      log_destination = 'csvlog'
      log_directory = 'pg_log' #與postgresql.conf文件在同一級(jí)目錄
      log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
      log_rotation_age = 2d
      log_rotation_size = 100MB
      #
      debug_print_parse = on  #打印parse樹
      debug_print_rewritten = on #打印parse rewrite樹
      debug_print_plan = on #打印plan樹
      debug_pretty_print = on #以pretty方式顯示

      感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“PostgreSQL中PlannedStmt結(jié)構(gòu)的日志分析”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來學(xué)習(xí)!


      標(biāo)題名稱:PostgreSQL中PlannedStmt結(jié)構(gòu)的日志分析
      URL網(wǎng)址:http://www.ef60e0e.cn/article/igpois.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        古田县| 玛多县| 台东市| 霍邱县| 从江县| 宜昌市| 永春县| 桦南县| 澎湖县| 扎鲁特旗| 黄骅市| 乾安县| 英吉沙县| 朔州市| 宁南县| 孟州市| 安新县| 合作市| 宁南县| 温泉县| 临漳县| 德庆县| 井研县| 乐昌市| 嘉祥县| 海门市| 门源| 海安县| 甘泉县| 瑞丽市| 滨海县| 文山县| 鄂尔多斯市| 宁河县| 册亨县| 定结县| 突泉县| 资溪县| 灵台县| 舞阳县| 荣昌县|