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

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

如此: 接前面,看 add_base_rels_to_query函数: /* * add_base_rels_to_query * * Scan the query's jointree and create baserel RelOptInfos for all * the base relations (ie, table, subquery, and fun...

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

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

接着分析:build_simple_rel 函数 /* * build_simple_rel * Construct a new RelOptInfo for a base relation or 'other' relation. */ RelOptInfo * build_simple_rel(PlannerInfo *root, int relid, RelOptKin...

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

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

继续: /* * estimate_rel_size - estimate # pages and # tuples in a table or index * * We also estimate the fraction of the pages that are marked all-visible in * the visibility map, for use in est...

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

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

接前面,由于看到对 BasicOpenFile 函数的调用。 自然想到,如果两个进程同时访问一个表(即同一文件),会否有冲突或效率的问题。 开两个psql客户端,连接数据库后,后台生成两个进程, 分别运行 select * from tst01 进行观察...发现各进程之间互相不干扰。 我实验的方法,加入调试代码: /* * BasicOpenFile --- same as open(...

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

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

接前面: 回到mdopen上来,看看是谁调用了 mdopen,又获得了什么。 /* * mdnblocks() -- Get the number of blocks stored in a relation. * * Important side effect: all active segments of the relation are opened * ...

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

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

接前面,再次上溯一个层次,看代码(planmain.c :query_planner): void query_planner(PlannerInfo *root, List *tlist, double tuple_fraction, double limit_tuples, Path **cheapest_path, Path **...

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

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

接前面,仔细看这个 :这 add_base_rels_to_query 是个递归调用嘛。 想像一下: select  * from tst01  where id in (select sid from tst02)  or id in (select sid from tst03) 之类的,此函数将层层深入,构造一个二叉树式样的语法树。 void add_base_...

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

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

接前面,继续分析 ChoosePortalStrategy: /* * ChoosePortalStrategy * Select portal execution strategy given the intended statement list. * * The list elements can be Querys, PlannedStmts, or utili...

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

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

回到上一个层面,继续看 PortalStart的处理: void PortalStart(Portal portal, ParamListInfo params, int eflags, bool use_active_snapshot) { ... PG_TRY(); { ... /* * ...

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

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

接前面,继续观察 PortalStart,其中有: /* * Create QueryDesc in portal's context; for the moment, set * the destination to DestNone. */ ...

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

产品推荐

数据库

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

+关注