摘要: 看hash join 里的概念:numbuckets与numbatches:numbuckets是 在内存中,hash表里面,"桶"的个数。numbatches是 如果hash表过大,在内存中放不下,则要分多次进行。voidfinal_cost_hashjoin(PlannerInfo *root, HashPath *path, JoinCostWorkspace *workspace, SpecialJoinInfo *sjinfo, SemiAntiJoinFactors *... 阅读全文
posted @ 2013-06-13 16:40 健哥的数据花园 阅读(265) 评论(0) 推荐(0) 编辑
摘要: Path的定义:/* * Type "Path" is used as-is for sequential-scan paths, as well as some other * simple plan types that we don't need any extra information in the path for. * For other path types it is the first component of a larger struct. * * "pathtype" is the NodeTag of the Plan 阅读全文
posted @ 2013-06-13 15:15 健哥的数据花园 阅读(617) 评论(1) 推荐(0) 编辑
摘要: 此处,分析 add_paths_to_joinrel:/* * add_paths_to_joinrel * Given a join relation and two component rels from which it can be made, * consider all possible paths that use the two component rels as outer * and inner rel respectively. Add these paths to the join rel's pathlist * if the... 阅读全文
posted @ 2013-06-13 14:50 健哥的数据花园 阅读(404) 评论(0) 推荐(0) 编辑
摘要: 其代码结构:/* * build_join_rel * Returns relation entry corresponding to the union of two given rels, * creating a new relation entry if none already exists. * * 'joinrelids' is the Relids set that uniquely identifies the join * 'outer_rel' and 'inner_rel' are relation nodes for t 阅读全文
posted @ 2013-06-13 14:44 健哥的数据花园 阅读(382) 评论(0) 推荐(0) 编辑
摘要: 对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... 阅读全文
posted @ 2013-06-13 13:08 健哥的数据花园 阅读(352) 评论(0) 推荐(0) 编辑
摘要: 在PostgreSQL的源代码中,有如下调用关系:query_planner -->generate_base_implied_equalities -->generate_base_implied_qualities_const -->process_implied_equality -->distribute_qual_to_relsdistribute_qual_to_rels的函数定义如下:static voiddistribute_qual_to_rels(PlannerInfo *root, Node *clause, ... 阅读全文
posted @ 2013-06-13 12:51 健哥的数据花园 阅读(458) 评论(0) 推荐(0) 编辑
摘要: 以A表和B表的连接而言:A.col=B.colJOIN_INNER: 就是等值连接。找出A中有,B中也有,A和B的对应字段相等的记录的信息。postgres=# select * from sales s inner join customers c on s.cust_id = c.cust_id; cust_id | item | cust_id | cust_name ---------+----------+---------+----------- 2 | camera | 2 | John Doe 3 | computer | ... 阅读全文
posted @ 2013-06-13 08:57 健哥的数据花园 阅读(357) 评论(0) 推荐(0) 编辑