千家信息网

PostgreSQL中PlannedStmt的跟踪分析

发表于:2026-11-01 作者:千家信息网编辑
千家信息网最后更新 2026年11月01日,这篇文章主要为大家展示了"PostgreSQL中PlannedStmt的跟踪分析",内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下"PostgreSQL中Pla
千家信息网最后更新 2026年11月01日PostgreSQL中PlannedStmt的跟踪分析

这篇文章主要为大家展示了"PostgreSQL中PlannedStmt的跟踪分析",内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下"PostgreSQL中PlannedStmt的跟踪分析"这篇文章吧。

计划树

二、数据结构

Plan

 /* ----------------  *      Plan node  *  * All plan nodes "derive" from the Plan structure by having the  * Plan structure as the first field.  This ensures that everything works  * when nodes are cast to Plan's.  (node pointers are frequently cast to Plan*  * when passed around generically in the executor)  *  * We never actually instantiate any Plan nodes; this is just the common  * abstract superclass for all Plan-type nodes.  * ----------------  */ typedef struct Plan {     NodeTag     type;      /*      * estimated execution costs for plan (see costsize.c for more info)      */     Cost        startup_cost;   /* cost expended before fetching any tuples */     Cost        total_cost;     /* total cost (assuming all tuples fetched) */      /*      * planner's estimate of result size of this plan step      */     double      plan_rows;      /* number of rows plan is expected to emit */     int         plan_width;     /* average row width in bytes */      /*      * information needed for parallel query      */     bool        parallel_aware; /* engage parallel-aware logic? */     bool        parallel_safe;  /* OK to use as part of parallel plan? */      /*      * Common structural data for all Plan types.      */     int         plan_node_id;   /* unique across entire final plan tree */     List       *targetlist;     /* target list to be computed at this node */     List       *qual;           /* implicitly-ANDed qual conditions */     struct Plan *lefttree;      /* input plan tree(s) */     struct Plan *righttree;     List       *initPlan;       /* Init Plan nodes (un-correlated expr                                  * subselects) */      /*      * Information for management of parameter-change-driven rescanning      *      * extParam includes the paramIDs of all external PARAM_EXEC params      * affecting this plan node or its children.  setParam params from the      * node's initPlans are not included, but their extParams are.      *      * allParam includes all the extParam paramIDs, plus the IDs of local      * params that affect the node (i.e., the setParams of its initplans).      * These are _all_ the PARAM_EXEC params that affect this node.      */     Bitmapset  *extParam;     Bitmapset  *allParam; } Plan;

Limit

 /* ----------------  *      limit node  *  * Note: as of Postgres 8.2, the offset and count expressions are expected  * to yield int8, rather than int4 as before.  * ----------------  */ typedef struct Limit {     Plan        plan;     Node       *limitOffset;    /* OFFSET parameter, or NULL if none */     Node       *limitCount;     /* COUNT parameter, or NULL if none */ } Limit;

Sort

 /* ----------------  *      sort node  * ----------------  */ typedef struct Sort {     Plan        plan;     int         numCols;        /* number of sort-key columns */     AttrNumber *sortColIdx;     /* their indexes in the target list */     Oid        *sortOperators;  /* OIDs of operators to sort them by */     Oid        *collations;     /* OIDs of collations */     bool       *nullsFirst;     /* NULLS FIRST/LAST directions */ } Sort;

Append

 /* ----------------  *   Append node -  *      Generate the concatenation of the results of sub-plans.  * ----------------  */ typedef struct Append {     Plan        plan;     List       *appendplans;      /*      * All 'appendplans' preceding this index are non-partial plans. All      * 'appendplans' from this index onwards are partial plans.      */     int         first_partial_plan;      /* RT indexes of non-leaf tables in a partition tree */     List       *partitioned_rels;      /* Info for run-time subplan pruning; NULL if we're not doing that */     struct PartitionPruneInfo *part_prune_info; } Append;

NestLoop

 /* ----------------  *      nest loop join node  *  * The nestParams list identifies any executor Params that must be passed  * into execution of the inner subplan carrying values from the current row  * of the outer subplan.  Currently we restrict these values to be simple  * Vars, but perhaps someday that'd be worth relaxing.  (Note: during plan  * creation, the paramval can actually be a PlaceHolderVar expression; but it  * must be a Var with varno OUTER_VAR by the time it gets to the executor.)  * ----------------  */ typedef struct NestLoop {     Join        join;     List       *nestParams;     /* list of NestLoopParam nodes */ } NestLoop;  typedef struct NestLoopParam {     NodeTag     type;     int         paramno;        /* number of the PARAM_EXEC Param to set */     Var        *paramval;       /* outer-relation Var to assign to Param */ } NestLoopParam;  /*  * ==========  * Join nodes  * ==========  */ /* ----------------  *      merge join node  *  * The expected ordering of each mergeable column is described by a btree  * opfamily OID, a collation OID, a direction (BTLessStrategyNumber or  * BTGreaterStrategyNumber) and a nulls-first flag.  Note that the two sides  * of each mergeclause may be of different datatypes, but they are ordered the  * same way according to the common opfamily and collation.  The operator in  * each mergeclause must be an equality operator of the indicated opfamily.  * ----------------  */ typedef struct MergeJoin {     Join        join;     bool        skip_mark_restore;  /* Can we skip mark/restore calls? */     List       *mergeclauses;   /* mergeclauses as expression trees */     /* these are arrays, but have the same length as the mergeclauses list: */     Oid        *mergeFamilies;  /* per-clause OIDs of btree opfamilies */     Oid        *mergeCollations;    /* per-clause OIDs of collations */     int        *mergeStrategies;    /* per-clause ordering (ASC or DESC) */     bool       *mergeNullsFirst;    /* per-clause nulls ordering */ } MergeJoin;  /* ----------------  *      hash join node  * ----------------  */ typedef struct HashJoin {     Join        join;     List       *hashclauses; } HashJoin;  /* ----------------  *      Join node  *  * jointype:    rule for joining tuples from left and right subtrees  * inner_unique each outer tuple can match to no more than one inner tuple  * joinqual:    qual conditions that came from JOIN/ON or JOIN/USING  *              (plan.qual contains conditions that came from WHERE)  *  * When jointype is INNER, joinqual and plan.qual are semantically  * interchangeable.  For OUTER jointypes, the two are *not* interchangeable;  * only joinqual is used to determine whether a match has been found for  * the purpose of deciding whether to generate null-extended tuples.  * (But plan.qual is still applied before actually returning a tuple.)  * For an outer join, only joinquals are allowed to be used as the merge  * or hash condition of a merge or hash join.  *  * inner_unique is set if the joinquals are such that no more than one inner  * tuple could match any given outer tuple.  This allows the executor to  * skip searching for additional matches.  (This must be provable from just  * the joinquals, ignoring plan.qual, due to where the executor tests it.)  * ----------------  */ typedef struct Join {     Plan        plan;     JoinType    jointype;     bool        inner_unique;     List       *joinqual;       /* JOIN quals (in addition to plan.qual) */ } Join;

SeqScan

 /*  * ==========  * Scan nodes  * ==========  */ typedef struct Scan {     Plan        plan;     Index       scanrelid;      /* relid is index into the range table */ } Scan;  /* ----------------  *      sequential scan node  * ----------------  */ typedef Scan SeqScan;

以上是"PostgreSQL中PlannedStmt的跟踪分析"这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注行业资讯频道!

分析 跟踪 内容 篇文章 学习 帮助 数据 数据结构 易懂 更多 条理 知识 结构 编带 行业 资讯 资讯频道 频道 研究 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 喔噻互联网科技有限公司 广州为想互联网科技有限公司 广州百单互联网科技有限公司 北京互联网科技有限公司 九亚互联网科技 猫创互联网科技 互联网科技公司名称 科技大学互联网专业好不好 互联网科技公司招聘 新华互联网科技2019 阿大互联网科技有限公司 江苏苏星互联网科技有限公司 互联网与数字科技关系 互联网科技包装股份有限公司上市 互联网金融运营模式中的金融科技 中国互联网公司的科技投入 安徽零酒互联网科技有限公司 广西泛欧互联网科技有限公司 第三届互联网大会安防黑科技 瑞安市蟠桃会互联网科技有限公司 瑰夏咖啡 互联网科技公司 蓝思科技飞鸽互联网 互联网科技logo设计 阿里互联网科技企业 广东工业互联网大赛深圳学泰科技 互联网风格科技公司名称 半导体行业属于互联网高科技类吗 现代互联网科技公司 互联网科技创业有什么好项目
0