文章 2022-02-16 来自:开发者社区

PostgreSQL在何处处理 sql查询之四十七

再次上溯: /*-------------------- * subquery_planner * Invokes the planner on a subquery. We recurse to here for each * sub-SELECT found in the query tree. * * glob is the global state f...

文章 2022-02-16 来自:开发者社区

PostgreSQL在何处处理 sql查询之四十九

接前面,继续对 subquery_planner来分析: 下面这一段都是对 表达式进行处理的,对我的简单查询,可以忽略。 /* * Do expression preprocessing on targetlist and quals, as well as other * random expressions in the querytree. Note th...

文章 2022-02-16 来自:开发者社区

PostgreSQL在何处处理 sql查询之五十一

继续分析 query_planner: /* * query_planner * Generate a path (that is, a simplified plan) for a basic query, * which may involve joins but not any fancier features. * * Since query_plann...

文章 2022-02-16 来自:开发者社区

PostgreSQL在何处处理 sql查询之五十四

接前面,从 cheapeast_path 的角度,关注 query_planner 函数,对其进行简化: void query_planner(PlannerInfo *root, List *tlist, double tuple_fraction, double limit_tuples, Path **cheapest_path,...

文章 2022-02-16 来自:开发者社区

PostgreSQL在何处处理 sql查询之五十五

接前面。 从 cheapest_total_path 来看: query_planner 会先调用  build_simple_rel,这里完成了  cheapest_total_path 的初始化。 (query_planner --> add_base_rels_to_query --> query_planner) 然后,query_planner 再在后面调...

文章 2022-02-16 来自:开发者社区

PostgreSQL在何处处理 sql查询之五十六

接前面,继续分析 : cheapest_startup_path = cheapest_total_path = NULL; have_parameterized_paths = false; foreach(p, parent_rel->pathlist) { Path *path = (Path *) lfirst(p)...

文章 2022-02-16 来自:开发者社区

PostgreSQL在何处处理 sql查询之五十七

接着追踪 ->pathlist: 初始化可能是在这里完成的? /* * add_path * Consider a potential implementation path for the specified parent rel, * and add it to the rel's pathlist if it is worthy of considera...

文章 2022-02-16 来自:开发者社区

PostgreSQL在何处处理 sql查询之五十九

由于用单纯的SQL语句来探查代码,看得还是不够清楚。 所以我再采用如下的方法: postgres=# explain select dept.no_emps,emp.age from dept,emp where emp.name = dept.mgr and dept.dept_name = 'shoe'; QUERY PLAN ...

文章 2022-02-16 来自:开发者社区

PostgreSQL在何处处理 sql查询之六十一

对Join的成本计算的调用路径: make_one_rel   ->make_rel_from_joinlist        ->standard_join_search              -> join_search_one_level  ...

文章 2022-02-16 来自:开发者社区

PostgreSQL在何处处理 sql查询之六十二

对 RelOptInfo * make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2) 函数进行研究: 看看 inner join 时候发生的事情: RelOptInfo * make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2) ...

本页面内关键词为智能算法引擎基于机器学习所生成,如有任何问题,可在页面下方点击"联系我们"与我们沟通。

产品推荐

数据库

分享数据库前沿,解构实战干货,推动数据库技术变革

+关注