PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "nodes/nodeFuncs.h"
#include "optimizer/clauses.h"
#include "optimizer/joininfo.h"
#include "optimizer/optimizer.h"
#include "optimizer/pathnode.h"
#include "optimizer/paths.h"
#include "optimizer/planmain.h"
#include "optimizer/tlist.h"
#include "utils/lsyscache.h"
Go to the source code of this file.
|
inlinestatic |
Definition at line 127 of file analyzejoins.c.
References bms_is_subset().
Referenced by is_innerrel_unique_for(), and join_is_removable().
Definition at line 927 of file analyzejoins.c.
References forboth, InvalidOid, lfirst_int, and lfirst_oid.
Referenced by query_is_distinct_for().
bool innerrel_is_unique | ( | PlannerInfo * | root, |
Relids | joinrelids, | ||
Relids | outerrelids, | ||
RelOptInfo * | innerrel, | ||
JoinType | jointype, | ||
List * | restrictlist, | ||
bool | force_cache | ||
) |
Definition at line 967 of file analyzejoins.c.
References bms_copy(), bms_is_subset(), is_innerrel_unique_for(), lappend(), lfirst, MemoryContextSwitchTo(), NIL, RelOptInfo::non_unique_for_rels, rel_supports_distinctness(), and RelOptInfo::unique_for_rels.
Referenced by add_paths_to_joinrel(), and reduce_unique_semijoins().
|
static |
Definition at line 1075 of file analyzejoins.c.
References clause_sides_match_join(), IS_OUTER_JOIN, lappend(), lfirst, NIL, rel_is_distinct_for(), RelOptInfo::relids, and RINFO_IS_PUSHED_DOWN.
Referenced by innerrel_is_unique().
|
static |
Definition at line 159 of file analyzejoins.c.
References bms_get_singleton_member(), bms_is_member(), bms_is_subset(), bms_overlap(), bms_union(), clause_sides_match_join(), SpecialJoinInfo::delay_upper_joins, find_base_rel(), JOIN_LEFT, RelOptInfo::joininfo, SpecialJoinInfo::jointype, lappend(), lfirst, RelOptInfo::max_attr, RelOptInfo::min_attr, SpecialJoinInfo::min_lefthand, SpecialJoinInfo::min_righthand, NIL, PlaceHolderInfo::ph_eval_at, PlaceHolderInfo::ph_lateral, PlaceHolderInfo::ph_needed, PlaceHolderInfo::ph_var, PlannerInfo::placeholder_list, pull_varnos(), rel_is_distinct_for(), rel_supports_distinctness(), RelOptInfo::relids, and RINFO_IS_PUSHED_DOWN.
Referenced by remove_useless_joins().
Definition at line 778 of file analyzejoins.c.
References SetOperationStmt::all, Assert(), castNode, distinct_col_search(), Query::distinctClause, SortGroupClause::eqop, equality_ops_are_compatible(), get_sortgroupclause_tle(), Query::groupClause, SetOperationStmt::groupClauses, GROUPING_SET_EMPTY, Query::groupingSets, Query::hasAggs, Query::hasTargetSRFs, Query::havingQual, lfirst, linitial, list_head(), list_length(), lnext(), OidIsValid, SetOperationStmt::op, TargetEntry::resjunk, TargetEntry::resno, SETOP_NONE, Query::setOperations, and Query::targetList.
Referenced by create_unique_path(), and rel_is_distinct_for().
Definition at line 741 of file analyzejoins.c.
References Query::distinctClause, Query::groupClause, Query::groupingSets, Query::hasAggs, Query::hasTargetSRFs, Query::havingQual, NIL, and Query::setOperations.
Referenced by create_unique_path(), and rel_supports_distinctness().
void reduce_unique_semijoins | ( | PlannerInfo * | root | ) |
Definition at line 511 of file analyzejoins.c.
References bms_get_singleton_member(), bms_union(), SpecialJoinInfo::delay_upper_joins, find_base_rel(), foreach_delete_current, generate_join_implied_equalities(), innerrel_is_unique(), PlannerInfo::join_info_list, JOIN_SEMI, RelOptInfo::joininfo, SpecialJoinInfo::jointype, lfirst, list_concat(), SpecialJoinInfo::min_lefthand, SpecialJoinInfo::min_righthand, and rel_supports_distinctness().
Referenced by query_planner().
|
static |
Definition at line 644 of file analyzejoins.c.
References castNode, RestrictInfo::clause, get_leftop(), get_rightop(), IsA, lappend_int(), lappend_oid(), lfirst_node, NIL, query_is_distinct_for(), relation_has_unique_index_for(), RelOptInfo::relid, RELOPT_BASEREL, RelOptInfo::reloptkind, RTE_RELATION, RTE_SUBQUERY, RelOptInfo::rtekind, Var::varattno, Var::varlevelsup, and Var::varno.
Referenced by is_innerrel_unique_for(), and join_is_removable().
|
static |
Definition at line 588 of file analyzejoins.c.
References RelOptInfo::indexlist, lfirst, NIL, query_supports_distinctness(), RelOptInfo::relid, RELOPT_BASEREL, RelOptInfo::reloptkind, RTE_RELATION, RTE_SUBQUERY, and RelOptInfo::rtekind.
Referenced by innerrel_is_unique(), join_is_removable(), and reduce_unique_semijoins().
Definition at line 457 of file analyzejoins.c.
References elog(), ERROR, IsA, lappend(), lfirst, NIL, and nodeTag.
Referenced by remove_useless_joins().
|
static |
Definition at line 312 of file analyzejoins.c.
References Assert(), bms_copy(), bms_del_member(), bms_is_empty(), bms_is_member(), bms_is_subset(), distribute_restrictinfo_to_rels(), find_base_rel(), foreach_delete_current, PlannerInfo::join_info_list, RelOptInfo::joininfo, lfirst, list_copy(), RelOptInfo::max_attr, RelOptInfo::min_attr, SpecialJoinInfo::min_lefthand, SpecialJoinInfo::min_righthand, PlaceHolderInfo::ph_eval_at, PlaceHolderInfo::ph_lateral, PlaceHolderInfo::ph_needed, PlaceHolderInfo::phid, PlannerInfo::placeholder_list, RelOptInfo::relid, RELOPT_DEADREL, RelOptInfo::reloptkind, remove_join_clause_from_rels(), RestrictInfo::required_relids, RINFO_IS_PUSHED_DOWN, PlannerInfo::simple_rel_array_size, SpecialJoinInfo::syn_lefthand, and SpecialJoinInfo::syn_righthand.
Referenced by remove_useless_joins().
List* remove_useless_joins | ( | PlannerInfo * | root, |
List * | joinlist | ||
) |
Definition at line 61 of file analyzejoins.c.
References bms_singleton_member(), bms_union(), elog(), ERROR, PlannerInfo::join_info_list, join_is_removable(), lfirst, list_delete_cell(), SpecialJoinInfo::min_lefthand, SpecialJoinInfo::min_righthand, remove_rel_from_joinlist(), and remove_rel_from_query().
Referenced by query_planner().