zoukankan      html  css  js  c++  java
  • PostgreSQL在何处处理 sql查询之六十二

    RelOptInfo *
    make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2) 函数进行研究:

    看看 inner join 时候发生的事情:

    RelOptInfo *
    make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
    {
       ...
       SpecialJoinInfo *sjinfo;
       ...
       /* Check validity and determine join type. */
       if (!join_is_legal(root, rel1, rel2, joinrelids,
                          &sjinfo, &reversed))
       ...
       /*
        * If it's a plain inner join, then we won't have found anything in
        * join_info_list.    Make up a SpecialJoinInfo so that selectivity
        * estimation functions will know what's being joined.
        */
       if (sjinfo == NULL)
       {
            sjinfo = &sjinfo_data;
            sjinfo->type = T_SpecialJoinInfo;
            sjinfo->min_lefthand = rel1->relids;
            sjinfo->min_righthand = rel2->relids;
            sjinfo->syn_lefthand = rel1->relids;
            sjinfo->syn_righthand = rel2->relids;
            sjinfo->jointype = JOIN_INNER;
            /* we don't bother trying to make the remaining fields valid */
            sjinfo->lhs_strict = false;
            sjinfo->delay_upper_joins = false;
            sjinfo->join_quals = NIL;
       }
       ...
       switch (sjinfo->jointype)
       {
            case JOIN_INNER:
    
                fprintf(stderr,"JOIN_INNER \n");
    
                if (is_dummy_rel(rel1) || is_dummy_rel(rel2) ||
                    restriction_is_constant_false(restrictlist, false))
                {
                    mark_dummy_rel(joinrel);
                    break;
                }
                add_paths_to_joinrel(root, joinrel, rel1, rel2,
                                     JOIN_INNER, sjinfo,
                                     restrictlist);
                add_paths_to_joinrel(root, joinrel, rel2, rel1,
                                     JOIN_INNER, sjinfo,
                                     restrictlist);
                break;
             ...
       }
       ...
    }
  • 相关阅读:
    如何将网站升级为HTTPS协议?
    hashmap:cr:csdn
    HashMap的底层原理 cr:csdn:zhangshixi
    servlet
    泛型,反射
    线程

    集合
    java基础题
    我的博客网址
  • 原文地址:https://www.cnblogs.com/gaojian/p/3133872.html
Copyright © 2011-2022 走看看