PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/htup_details.h"
#include "access/sysattr.h"
#include "catalog/partition.h"
#include "catalog/pg_inherits.h"
#include "catalog/pg_type.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "optimizer/cost.h"
#include "optimizer/pathnode.h"
#include "optimizer/paths.h"
#include "optimizer/planmain.h"
#include "optimizer/planner.h"
#include "optimizer/prep.h"
#include "optimizer/tlist.h"
#include "parser/parse_coerce.h"
#include "parser/parsetree.h"
#include "utils/lsyscache.h"
#include "utils/rel.h"
#include "utils/selfuncs.h"
#include "utils/syscache.h"
Go to the source code of this file.
Functions | |
static RelOptInfo * | recurse_set_operations (Node *setOp, PlannerInfo *root, List *colTypes, List *colCollations, bool junkOK, int flag, List *refnames_tlist, List **pTargetList, double *pNumGroups) |
static RelOptInfo * | generate_recursion_path (SetOperationStmt *setOp, PlannerInfo *root, List *refnames_tlist, List **pTargetList) |
static RelOptInfo * | generate_union_paths (SetOperationStmt *op, PlannerInfo *root, List *refnames_tlist, List **pTargetList) |
static RelOptInfo * | generate_nonunion_paths (SetOperationStmt *op, PlannerInfo *root, List *refnames_tlist, List **pTargetList) |
static List * | plan_union_children (PlannerInfo *root, SetOperationStmt *top_union, List *refnames_tlist, List **tlist_list) |
static Path * | make_union_unique (SetOperationStmt *op, Path *path, List *tlist, PlannerInfo *root) |
static void | postprocess_setop_rel (PlannerInfo *root, RelOptInfo *rel) |
static bool | choose_hashed_setop (PlannerInfo *root, List *groupClauses, Path *input_path, double dNumGroups, double dNumOutputRows, const char *construct) |
static List * | generate_setop_tlist (List *colTypes, List *colCollations, int flag, Index varno, bool hack_constants, List *input_tlist, List *refnames_tlist, bool *trivial_tlist) |
static List * | generate_append_tlist (List *colTypes, List *colCollations, bool flag, List *input_tlists, List *refnames_tlist) |
static List * | generate_setop_grouplist (SetOperationStmt *op, List *targetlist) |
RelOptInfo * | plan_set_operations (PlannerInfo *root) |
|
static |
Definition at line 1023 of file prepunion.c.
References AGG_HASHED, compare_fractional_path_costs(), cost_agg(), cost_group(), cost_sort(), enable_hashagg, ereport, errcode(), errdetail(), errmsg(), ERROR, get_hash_memory_limit(), grouping_is_hashable(), grouping_is_sortable(), list_length(), MAXALIGN, NIL, Path::rows, SizeofMinimalTupleHeader, Path::startup_cost, Path::total_cost, PlannerInfo::tuple_fraction, and work_mem.
Referenced by generate_nonunion_paths(), and make_union_unique().
|
static |
Definition at line 1279 of file prepunion.c.
References Assert(), TargetEntry::expr, exprType(), exprTypmod(), flag(), forthree, InvalidOid, lappend(), lfirst, lfirst_oid, list_head(), list_length(), lnext(), makeTargetEntry(), makeVar(), NIL, palloc(), pfree(), pstrdup(), TargetEntry::resno, and TargetEntry::ressortgroupref.
Referenced by generate_nonunion_paths(), generate_recursion_path(), and generate_union_paths().
|
static |
Definition at line 707 of file prepunion.c.
References add_path(), SetOperationStmt::all, bms_union(), RelOptInfo::cheapest_total_path, choose_hashed_setop(), create_append_path(), create_pathtarget, create_setop_path(), create_sort_path(), elog(), ERROR, fetch_upper_rel(), generate_append_tlist(), generate_setop_grouplist(), SetOperationStmt::larg, list_length(), list_make2, make_pathkeys_for_sortclauses(), Min, NIL, SetOperationStmt::op, SetOperationStmt::rarg, recurse_set_operations(), RelOptInfo::relids, RelOptInfo::reltarget, RelOptInfo::rows, Path::rows, SETOP_EXCEPT, SETOP_HASHED, SETOP_INTERSECT, SETOP_SORTED, SETOPCMD_EXCEPT, SETOPCMD_EXCEPT_ALL, SETOPCMD_INTERSECT, SETOPCMD_INTERSECT_ALL, PlannerInfo::tuple_fraction, and UPPERREL_SETOP.
Referenced by recurse_set_operations().
|
static |
Definition at line 441 of file prepunion.c.
References add_path(), SetOperationStmt::all, Assert(), bms_union(), RelOptInfo::cheapest_total_path, create_pathtarget, create_recursiveunion_path(), elog(), ereport, errcode(), errdetail(), errmsg(), ERROR, fetch_upper_rel(), generate_append_tlist(), generate_setop_grouplist(), grouping_is_hashable(), SetOperationStmt::larg, list_make2, NIL, PlannerInfo::non_recursive_path, SetOperationStmt::op, postprocess_setop_rel(), SetOperationStmt::rarg, recurse_set_operations(), RelOptInfo::relids, RelOptInfo::reltarget, Path::rows, SETOP_UNION, UPPERREL_SETOP, and PlannerInfo::wt_param_id.
Referenced by plan_set_operations().
|
static |
Definition at line 1407 of file prepunion.c.
References Assert(), copyObject, lfirst, list_head(), lnext(), TargetEntry::resno, TargetEntry::ressortgroupref, and SortGroupClause::tleSortGroupRef.
Referenced by generate_nonunion_paths(), generate_recursion_path(), and make_union_unique().
|
static |
Definition at line 1130 of file prepunion.c.
References applyRelabelType(), Assert(), COERCE_IMPLICIT_CAST, coerce_to_common_type(), TargetEntry::expr, exprCollation(), exprType(), exprTypmod(), flag(), forfour, Int32GetDatum(), InvalidOid, IsA, lappend(), lfirst, lfirst_oid, makeConst(), makeTargetEntry(), makeVar(), NIL, pstrdup(), TargetEntry::resno, and TargetEntry::ressortgroupref.
Referenced by recurse_set_operations().
|
static |
Definition at line 547 of file prepunion.c.
References add_path(), SetOperationStmt::all, Assert(), bms_union(), RelOptInfo::cheapest_total_path, RelOptInfo::consider_parallel, create_append_path(), create_gather_path(), create_pathtarget, enable_parallel_append, fetch_upper_rel(), generate_append_tlist(), lappend(), lfirst, linitial, list_length(), make_union_unique(), Max, max_parallel_workers_per_gather, Min, NIL, RelOptInfo::partial_pathlist, pg_leftmost_one_pos32(), plan_union_children(), RelOptInfo::relids, RelOptInfo::reltarget, RelOptInfo::rows, Path::rows, subpath(), PlannerInfo::tuple_fraction, and UPPERREL_SETOP.
Referenced by recurse_set_operations().
|
static |
Definition at line 943 of file prepunion.c.
References AGG_HASHED, AGGSPLIT_SIMPLE, choose_hashed_setop(), create_agg_path(), create_pathtarget, create_sort_path(), create_upper_unique_path(), fetch_upper_rel(), generate_setop_grouplist(), list_length(), make_pathkeys_for_sortclauses(), NIL, Path::pathkeys, Path::rows, and UPPERREL_SETOP.
Referenced by generate_union_paths().
RelOptInfo* plan_set_operations | ( | PlannerInfo * | root | ) |
Definition at line 104 of file prepunion.c.
References Assert(), castNode, PlannerInfo::ec_merging_done, PlannerInfo::eq_classes, generate_recursion_path(), PlannerInfo::hasRecursion, IsA, SetOperationStmt::larg, NIL, parse(), PlannerInfo::parse, PlannerInfo::processed_tlist, recurse_set_operations(), setup_simple_rel_arrays(), RangeTblEntry::subquery, and Query::targetList.
Referenced by grouping_planner().
|
static |
Definition at line 884 of file prepunion.c.
References SetOperationStmt::all, equal(), IsA, lappend(), SetOperationStmt::larg, lcons(), linitial, list_delete_first(), list_make1, NIL, SetOperationStmt::op, SetOperationStmt::rarg, and recurse_set_operations().
Referenced by generate_union_paths().
|
static |
Definition at line 1005 of file prepunion.c.
References create_upper_paths_hook, set_cheapest(), and UPPERREL_SETOP.
Referenced by generate_recursion_path(), and recurse_set_operations().
|
static |
Definition at line 208 of file prepunion.c.
References add_partial_path(), add_path(), apply_projection_to_path(), Assert(), bms_is_empty, build_simple_rel(), check_stack_depth(), RelOptInfo::consider_parallel, create_pathtarget, create_projection_path(), create_subqueryscan_path(), Query::distinctClause, elog(), ERROR, estimate_num_groups(), fetch_upper_rel(), flag(), generate_nonunion_paths(), generate_setop_tlist(), generate_union_paths(), get_cheapest_fractional_path(), get_tlist_exprs(), PlannerInfo::glob, Query::groupClause, Query::groupingSets, PlannerInfo::hasHavingQual, IsA, RelOptInfo::lateral_relids, lfirst, linitial, NIL, nodeTag, SetOperationStmt::op, RelOptInfo::partial_pathlist, RelOptInfo::pathlist, PlannerInfo::plan_params, postprocess_setop_rel(), PlannerInfo::processed_tlist, RelOptInfo::reltarget, RelOptInfo::rows, RangeTblRef::rtindex, set_subquery_size_estimates(), SETOP_UNION, subpath(), RangeTblEntry::subquery, subquery_planner(), RelOptInfo::subroot, Query::targetList, tlist_same_collations(), tlist_same_datatypes(), PlannerInfo::tuple_fraction, and UPPERREL_FINAL.
Referenced by generate_nonunion_paths(), generate_recursion_path(), plan_set_operations(), and plan_union_children().