上一页 1 ··· 43 44 45 46 47 48 49 50 51 ··· 104 下一页
摘要: 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) 编辑
摘要: 对Join的成本计算的调用路径:make_one_rel ->make_rel_from_joinlist ->standard_join_search -> join_search_one_level -> make_join_rel -> add_paths_to_joinrel ->hash_inner_and_outer ->try_hashjoin_path ->initial_cost_hashjoin在make_join_rel函... 阅读全文
posted @ 2013-06-12 16:17 健哥的数据花园 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 开始用 explain来看hash join:postgres=# explain select dept.no_emps,emp.age from dept,emp where emp.name = dept.mgr and dept.dept_name = 'shoe'; QUERY PLAN ------------------------------------------------------------------ Hash Join (cost=19.30..45.07... 阅读全文
posted @ 2013-06-12 13:02 健哥的数据花园 阅读(337) 评论(0) 推荐(0) 编辑
摘要: 由于用单纯的SQL语句来探查代码,看得还是不够清楚。所以我再采用如下的方法:postgres=# explain select dept.no_emps,emp.age from dept,emp where emp.name = dept.mgr and dept.dept_name = 'shoe'; QUERY PLAN ------------------------------------------------------------------ Hash Join (co... 阅读全文
posted @ 2013-06-11 15:00 健哥的数据花园 阅读(426) 评论(0) 推荐(0) 编辑
摘要: Oracle 的SQL文,可以强制指定各种 hint。但是在PostgreSQL中是不支持的。其wiki 是这样说的:http://wiki.postgresql.org/wiki/OptimizerHintsDiscussionWe are not interested in implementing hints in the exact ways they are commonly implemented on other databases. Proposals based on "because they've got them" will not be w 阅读全文
posted @ 2013-06-10 16:21 健哥的数据花园 阅读(713) 评论(0) 推荐(0) 编辑
上一页 1 ··· 43 44 45 46 47 48 49 50 51 ··· 104 下一页