PostgreSQL代码分析,查询优化部分。

这里把规范谓词表达式的部分就整理完了,阅读的顺序例如以下:

一、PostgreSQL代码分析,查询优化部分,canonicalize_qual

二、PostgreSQL代码分析,查询优化部分,pull_ands()和pull_ors()

三、PostgreSQL代码分析,查询优化部分,process_duplicate_ors

*************************************************************************************************************************************************************

pull_ands()和pull_ors()的代码比較便于理解,就是把树状结构的AND操作拉平,下图是pull_ands的样例,pull_ors逻辑同样:

/*
* pull_ands
* Recursively flatten nested AND clauses into a single and-clause list.
*
* Input is the arglist of an AND clause.
* Returns the rebuilt arglist (note original list structure is not touched).
*/
static List *
pull_ands(List *andlist)
{
List *out_list = NIL;
ListCell *arg; foreach(arg, andlist)
{
Node *subexpr = (Node *) lfirst(arg); /*
* Note: we can destructively concat the subexpression's arglist
* because we know the recursive invocation of pull_ands will have
* built a new arglist not shared with any other expr. Otherwise we'd
* need a list_copy here.
*/
if (and_clause(subexpr))
out_list = list_concat(out_list,
pull_ands(((BoolExpr *) subexpr)->args));
else
out_list = lappend(out_list, subexpr);
}
return out_list;
} /*
* pull_ors
* Recursively flatten nested OR clauses into a single or-clause list.
*
* Input is the arglist of an OR clause.
* Returns the rebuilt arglist (note original list structure is not touched).
*/
static List *
pull_ors(List *orlist)
{
List *out_list = NIL;
ListCell *arg; foreach(arg, orlist)
{
Node *subexpr = (Node *) lfirst(arg); /*
* Note: we can destructively concat the subexpression's arglist
* because we know the recursive invocation of pull_ors will have
* built a new arglist not shared with any other expr. Otherwise we'd
* need a list_copy here.
*/
if (or_clause(subexpr))
out_list = list_concat(out_list,
pull_ors(((BoolExpr *) subexpr)->args));
else
out_list = lappend(out_list, subexpr);
}
return out_list;
}

张大明确的blog:http://blog.csdn.net/shujiezhang

PostgreSQL代码分析,查询优化部分,pull_ands()和pull_ors()的更多相关文章

  1. PostgreSQL代码分析,查询优化部分,canonicalize_qual

    这里把规范谓词表达式的部分就整理完了.阅读的顺序例如以下: 一.PostgreSQL代码分析,查询优化部分,canonicalize_qual 二.PostgreSQL代码分析,查询优化部分,pull ...

  2. SonarQube-5.6.3 代码分析平台搭建使用

    python代码分析 官网主页: http://docs.sonarqube.org/display/PLUG/Python+Plugin Windows下安装使用: 快速使用: 1.下载jdk ht ...

  3. 静态代码分析工具sonarqube+sonar-runner的安装配置及使用

    配置成功后的代码分析页面: 可以看到对复杂度.语法使用.重复度等等都做了分析,具体到了每一个方法和每一句代码. 四种使用方式: sonarqube + sonar-runner sonarqube + ...

  4. PostgreSQL内核分析——BTree索引

    文中附图参考至<PostgreSQL数据库内核分析> (一)概念描述 B+树是一种索引数据结构,其一个特征在于非叶子节点用于描述索引,而叶子节点指向具体的数据存储位置.在PostgreSQ ...

  5. 2017.4.18 静态代码分析工具sonarqube+sonar-runner的安装配置及使用

    配置成功后的代码分析页面: 可以看到对复杂度.语法使用.重复度等等都做了分析,具体到了每一个方法和每一句代码. 四种使用方式: sonarqube + sonar-runner sonarqube + ...

  6. Android代码分析工具lint学习

    1 lint简介 1.1 概述 lint是随Android SDK自带的一个静态代码分析工具.它用来对Android工程的源文件进行检查,找出在正确性.安全.性能.可使用性.可访问性及国际化等方面可能 ...

  7. pmd静态代码分析

    在正式进入测试之前,进行一定的静态代码分析及code review对代码质量及系统提高是有帮助的,以上为数据证明 Pmd 它是一个基于静态规则集的Java源码分析器,它可以识别出潜在的如下问题:– 可 ...

  8. [Asp.net 5] DependencyInjection项目代码分析-目录

    微软DI文章系列如下所示: [Asp.net 5] DependencyInjection项目代码分析 [Asp.net 5] DependencyInjection项目代码分析2-Autofac [ ...

  9. [Asp.net 5] DependencyInjection项目代码分析4-微软的实现(5)(IEnumerable<>补充)

    Asp.net 5的依赖注入注入系列可以参考链接: [Asp.net 5] DependencyInjection项目代码分析-目录 我们在之前讲微软的实现时,对于OpenIEnumerableSer ...

随机推荐

  1. 读书与写论文的引导书——leo鉴书60

    我是专科直接考的研究生.在论文写作方面基本能够算是初级.MBA毕业那会儿要写论文,在网上找了不少这方面的书,<论文与治学>是当中之中的一个. 这本那时为应景儿卖的书,成了我之后学习与工作的 ...

  2. ASP.NET - 缓存(Cache)

    页面缓存: 给页面添加<%@ OutPutCache Duration = “15” VaryByParam = “none” %> 这样就可以启用页面缓存了,那么在规定的时间内,页面之访 ...

  3. 初入Android--Activate生命周期

    Activate的主要生命周期 (注意:这只是主要的生命周期,而不是完整的生命周期方法,其中的两个周期之间可能还执行了其他的一些方法) 每个时刻在屏幕上的状态 进入onCreate方法:Activat ...

  4. cocos2dx3.2 异步载入和动态载入

    半个月没有更新博客,从这个项目開始学习了非常多细节的东西,都不太成系统.可是却是开发上线中必须经历的东西.比方超级玛丽系列(一)中的正确的异步载入,正确的分层.正确的合成和载入plist.及时的移除未 ...

  5. 九度OJ 1065 输出梯形 (模拟)

    题目1065:输出梯形 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3745 解决:2043 题目描写叙述: 输入一个高度h.输出一个高为h.上底边为h的梯形. 输入: 一个整数h(1& ...

  6. UVA 725 – Division

    Description   Write a program that finds and displays all pairs of 5-digit numbers that between them ...

  7. [WP8] Binding时,依照DataType来选择DataTemplate

    原文 [WP8] Binding时,依照DataType来选择DataTemplate 范例下载 范例程序代码:点此下载 问题情景 在开发WPF.WP8...这类应用程序的时候,透过Binding机制 ...

  8. 邮件应用Acompli和日历应用Sunrise(传微软曾考虑以80亿美元收购企业通讯公司Slack)

    http://tech.163.com/16/0305/10/BHCU8EHO000915BD.html http://www.cnbeta.com/articles/480835.htm

  9. 积累的VC编程小技巧之视图

    1.如何得到视图指针 [问题提出]    现在你有一个多线程的Demo,你想在多线程里处理视图指针里的函数,我们给这个函数起个名字:Put();该如何实现呢?   //有两种方法可以实现你的要求:   ...

  10. 【Demo 0003】Java基础-数组

    本章学习要点:       1.  了解数组的基本概念:       2.  掌握数组使用方法:  一.数组的基本概念     1.  数组定义:              同一数据类型数据的集合,在 ...