subPlan

【测试sql】

select * from t1 where id not in (select id from t2);

 

【执行计划】

根节点是顺序扫描t1

其中:qual,SUBPLAN

【执行逻辑】

 

【文本】

 :commandType 1 
 :queryId 0 
 :hasReturning false 
 :hasModifyingCTE false 
 :canSetTag true 
 :transientPlan false 
 :dependsOnRole false 
 :parallelModeNeeded false 
 :jitFlags 0 
 :planTree 
    {SEQSCAN 
    :startup_cost 41.88 
    :total_cost 83.75 
    :plan_rows 1275 
    :plan_width 4 
    :parallel_aware false 
    :parallel_safe true 
    :plan_node_id 0 
    :targetlist (
       {TARGETENTRY 
       :expr 
          {VAR 
          :varno 1 
          :varattno 1 
          :vartype 23 
          :vartypmod -1 
          :varcollid 0 
          :varlevelsup 0 
          :varnoold 1 
          :varoattno 1 
          :location 7
          }
       :resno 1 
       :resname id 
       :ressortgroupref 0 
       :resorigtbl 16384 
       :resorigcol 1 
       :resjunk false
       }
    )
    :qual (
       {BOOLEXPR 
       :boolop not 
       :args (
          {SUBPLAN 
          :subLinkType 2 
          :testexpr 
             {OPEXPR 
             :opno 96 
             :opfuncid 65 
             :opresulttype 16 
             :opretset false 
             :opcollid 0 
             :inputcollid 0 
             :args (
                {VAR 
                :varno 1 
                :varattno 1 
                :vartype 23 
                :vartypmod -1 
                :varcollid 0 
                :varlevelsup 0 
                :varnoold 1 
                :varoattno 1 
                :location 23
                }
                {PARAM 
                :paramkind 1 
                :paramid 0 
                :paramtype 23 
                :paramtypmod -1 
                :paramcollid 0 
                :location -1
                }
             )
             :location 26
             }
          :paramIds (i 0)
          :plan_id 1 
          :plan_name SubPlan\ 1 
          :firstColType 23 
          :firstColTypmod -1 
          :firstColCollation 0 
          :useHashTable true 
          :unknownEqFalse false 
          :parallel_safe true 
          :setParam <> 
          :parParam <> 
          :args <> 
          :startup_cost 41.88 
          :per_call_cost 0.00
          }
       )
       :location -1
       }
    )
    :lefttree <> 
    :righttree <> 
    :initPlan <> 
    :extParam (b)
    :allParam (b)
    :scanrelid 1
    }
 :rtable (
    {RTE 
    :alias <> 
    :eref 
       {ALIAS 
       :aliasname t1 
       :colnames ("id")
       }
    :rtekind 0 
    :relid 16384 
    :relkind r 
    :tablesample <> 
    :lateral false 
    :inh false 
    :inFromCl true 
    :requiredPerms 2 
    :checkAsUser 0 
    :selectedCols (b 9)
    :insertedCols (b)
    :updatedCols (b)
    :securityQuals <>
    }
    {RTE 
    :alias <> 
    :eref 
       {ALIAS 
       :aliasname t2 
       :colnames ("id")
       }
    :rtekind 0 
    :relid 16387 
    :relkind r 
    :tablesample <> 
    :lateral false 
    :inh false 
    :inFromCl true 
    :requiredPerms 2 
    :checkAsUser 0 
    :selectedCols (b 9)
    :insertedCols (b)
    :updatedCols (b)
    :securityQuals <>
    }
 )
 :resultRelations <> 
 :nonleafResultRelations <> 
 :rootResultRelations <> 
 :subplans (
    {SEQSCAN 
    :startup_cost 0.00 
    :total_cost 35.50 
    :plan_rows 2550 
    :plan_width 4 
    :parallel_aware false 
    :parallel_safe true 
    :plan_node_id 1 
    :targetlist (
       {TARGETENTRY 
       :expr 
          {VAR 
          :varno 2 
          :varattno 1 
          :vartype 23 
          :vartypmod -1 
          :varcollid 0 
          :varlevelsup 0 
          :varnoold 2 
          :varoattno 1 
          :location 41
          }
       :resno 1 
       :resname id 
       :ressortgroupref 0 
       :resorigtbl 16387 
       :resorigcol 1 
       :resjunk false
       }
    )
    :qual <> 
    :lefttree <> 
    :righttree <> 
    :initPlan <> 
    :extParam (b)
    :allParam (b)
    :scanrelid 2
    }
 )
 :rewindPlanIDs (b)
 :rowMarks <> 
 :relationOids (o 16384 16387)
 :invalItems <> 
 :paramExecTypes (o 23)
 :utilityStmt <> 
 :stmt_location 0 
 :stmt_len 52
 }

  

posted @ 2022-01-01 11:03  stupidstan2019  阅读(83)  评论(0编辑  收藏  举报