PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <limits.h>
#include <math.h>
#include "access/genam.h"
#include "access/parallel.h"
#include "access/sysattr.h"
#include "access/table.h"
#include "catalog/pg_aggregate.h"
#include "catalog/pg_constraint.h"
#include "catalog/pg_inherits.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
#include "executor/executor.h"
#include "foreign/fdwapi.h"
#include "jit/jit.h"
#include "lib/bipartite_match.h"
#include "lib/knapsack.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "nodes/supportnodes.h"
#include "optimizer/appendinfo.h"
#include "optimizer/clauses.h"
#include "optimizer/cost.h"
#include "optimizer/optimizer.h"
#include "optimizer/paramassign.h"
#include "optimizer/pathnode.h"
#include "optimizer/paths.h"
#include "optimizer/plancat.h"
#include "optimizer/planmain.h"
#include "optimizer/planner.h"
#include "optimizer/prep.h"
#include "optimizer/subselect.h"
#include "optimizer/tlist.h"
#include "parser/analyze.h"
#include "parser/parse_agg.h"
#include "parser/parse_relation.h"
#include "parser/parsetree.h"
#include "partitioning/partdesc.h"
#include "utils/lsyscache.h"
#include "utils/rel.h"
#include "utils/selfuncs.h"
Go to the source code of this file.
Data Structures | |
struct | grouping_sets_data |
struct | WindowClauseSortData |
struct | standard_qp_extra |
Macros | |
#define | EXPRKIND_QUAL 0 |
#define | EXPRKIND_TARGET 1 |
#define | EXPRKIND_RTFUNC 2 |
#define | EXPRKIND_RTFUNC_LATERAL 3 |
#define | EXPRKIND_VALUES 4 |
#define | EXPRKIND_VALUES_LATERAL 5 |
#define | EXPRKIND_LIMIT 6 |
#define | EXPRKIND_APPINFO 7 |
#define | EXPRKIND_PHV 8 |
#define | EXPRKIND_TABLESAMPLE 9 |
#define | EXPRKIND_ARBITER_ELEM 10 |
#define | EXPRKIND_TABLEFUNC 11 |
#define | EXPRKIND_TABLEFUNC_LATERAL 12 |
|
static |
Definition at line 6785 of file planner.c.
References add_path(), GroupPathExtraData::agg_final_costs, AGG_HASHED, AGG_PLAIN, AGG_SORTED, AGGSPLIT_FINAL_DESERIAL, AGGSPLIT_SIMPLE, Assert(), RelOptInfo::cheapest_total_path, PathKeyInfo::clauses, consider_groupingsets_paths(), create_agg_path(), create_group_path(), GroupPathExtraData::flags, gather_grouping_paths(), get_useful_group_keys_orderings(), GROUPING_CAN_USE_HASH, GROUPING_CAN_USE_SORT, GroupPathExtraData::havingQual, if(), lfirst, list_length(), make_ordered_path(), NIL, parse(), PlannerInfo::parse, RelOptInfo::partial_pathlist, PathKeyInfo::pathkeys, RelOptInfo::pathlist, PlannerInfo::processed_groupClause, and RelOptInfo::reltarget.
Referenced by create_ordinary_grouping_paths().
|
static |
Definition at line 3141 of file planner.c.
References Aggref::aggdistinct, PlannerInfo::agginfos, Aggref::aggorder, AggInfo::aggrefs, append_pathkeys(), Aggref::args, Assert(), bms_add_member(), bms_del_member(), bms_del_members(), bms_next_member(), bms_num_members(), compare_pathkeys(), enable_presorted_aggregate, foreach_current_index, PlannerInfo::group_pathkeys, Query::groupingSets, has_volatile_pathkey(), i, lfirst_node, linitial_node, list_copy(), list_nth_node, make_pathkeys_for_sortclauses(), NIL, PlannerInfo::numOrderedAggs, PlannerInfo::parse, PATHKEYS_BETTER1, PATHKEYS_BETTER2, PATHKEYS_DIFFERENT, and PATHKEYS_EQUAL.
Referenced by standard_qp_callback().
|
static |
Definition at line 6284 of file planner.c.
References apply_projection_to_path(), Assert(), RelOptInfo::cheapest_startup_path, RelOptInfo::cheapest_total_path, create_projection_path(), create_set_projection_path(), forboth, lfirst, lfirst_int, lfirst_node, linitial_int, list_length(), RelOptInfo::partial_pathlist, RelOptInfo::pathlist, and subpath().
Referenced by apply_scanjoin_target_to_paths(), and grouping_planner().
|
static |
Definition at line 7446 of file planner.c.
References add_paths_to_append_rel(), adjust_appendrel_attrs(), adjust_paths_for_srfs(), Assert(), bms_next_member(), check_stack_depth(), RelOptInfo::consider_parallel, copy_pathtarget(), create_projection_path(), PathTarget::exprs, find_appinfos_by_relids(), generate_useful_gather_paths(), i, IS_DUMMY_REL, IS_OTHER_REL, IS_PARTITIONED_REL, lappend(), lfirst, lfirst_node, linitial_node, RelOptInfo::live_parts, llast_node, NIL, PlannerInfo::parse, RelOptInfo::partial_pathlist, RelOptInfo::pathlist, pfree(), RelOptInfo::relids, RelOptInfo::reltarget, set_cheapest(), subpath(), and tlist_same_exprs().
Referenced by grouping_planner().
|
static |
Definition at line 7404 of file planner.c.
References PlannerInfo::hasNonPartialAggs, PlannerInfo::hasNonSerialAggs, NIL, parse(), and PlannerInfo::parse.
Referenced by create_grouping_paths().
|
static |
Definition at line 5755 of file planner.c.
References a, b, forboth, lfirst_node, list_length(), SortGroupClause::nulls_first, SortGroupClause::sortop, SortGroupClause::tleSortGroupRef, and WindowClauseSortData::uniqueOrder.
Referenced by select_active_windows().
|
static |
Definition at line 3991 of file planner.c.
References add_path(), AGG_HASHED, AGG_MIXED, AGG_SORTED, grouping_sets_data::any_hashable, Assert(), bms_is_empty, bms_is_member(), create_groupingsets_path(), DiscreteKnapsack(), grouping_sets_data::dNumHashGroups, estimate_hashagg_tablesize(), for_each_cell, for_each_from, get_hash_memory_limit(), PlannerInfo::group_pathkeys, RollupData::groupClause, groupclause_apply_groupingset(), RollupData::gsets, RollupData::gsets_data, RollupData::hashable, i, RollupData::is_hashed, lappend(), lcons(), lfirst_node, linitial, list_concat(), list_copy(), list_head(), list_length(), list_make1, lnext(), makeNode, Max, Min, NIL, GroupingSetData::numGroups, RollupData::numGroups, palloc(), parse(), PlannerInfo::parse, Path::pathkeys, pathkeys_contained_in(), remap_to_groupclause_idx(), grouping_sets_data::rollups, scale, GroupingSetData::set, grouping_sets_data::tleref_to_colnum_map, and grouping_sets_data::unsortable_sets.
Referenced by add_paths_to_grouping_rel().
|
static |
Definition at line 3788 of file planner.c.
References add_path(), create_append_path(), create_group_result_path(), lappend(), list_length(), NIL, parse(), PlannerInfo::parse, and RelOptInfo::reltarget.
Referenced by create_grouping_paths().
|
static |
Definition at line 4573 of file planner.c.
References RelOptInfo::consider_parallel, create_final_distinct_paths(), create_partial_distinct_paths(), create_upper_paths_hook, ereport, errcode(), errdetail(), errmsg(), ERROR, fetch_upper_rel(), NIL, RelOptInfo::pathlist, RelOptInfo::serverid, set_cheapest(), UPPERREL_DISTINCT, RelOptInfo::userid, and RelOptInfo::useridiscurrent.
Referenced by grouping_planner().
|
static |
Definition at line 4842 of file planner.c.
References add_path(), AGG_HASHED, AGGSPLIT_SIMPLE, RelOptInfo::cheapest_total_path, create_agg_path(), create_incremental_sort_path(), create_limit_path(), create_sort_path(), create_upper_unique_path(), PlannerInfo::distinct_pathkeys, enable_hashagg, enable_incremental_sort, estimate_num_groups(), FLOAT8PASSBYVAL, get_sortgrouplist_exprs(), grouping_is_hashable(), grouping_is_sortable(), PlannerInfo::hasHavingQual, Int64GetDatum(), InvalidOid, lfirst, LIMIT_OPTION_COUNT, list_length(), makeConst(), NIL, parse(), PlannerInfo::parse, Path::pathkeys, pathkeys_count_contained_in(), RelOptInfo::pathlist, PlannerInfo::processed_distinctClause, Path::rows, and PlannerInfo::sort_pathkeys.
Referenced by create_distinct_paths(), and create_partial_distinct_paths().
|
static |
Definition at line 3601 of file planner.c.
References AGGSPLIT_SIMPLE, grouping_sets_data::any_hashable, can_partial_agg(), create_degenerate_grouping_paths(), create_ordinary_grouping_paths(), enable_partitionwise_aggregate, GroupPathExtraData::flags, get_agg_clause_costs(), GROUPING_CAN_PARTIAL_AGG, GROUPING_CAN_USE_HASH, GROUPING_CAN_USE_SORT, grouping_is_hashable(), grouping_is_sortable(), GroupPathExtraData::havingQual, is_degenerate_grouping(), make_grouping_rel(), MemSet, NIL, PlannerInfo::numOrderedAggs, parse(), PlannerInfo::parse, GroupPathExtraData::partial_costs_set, PARTITIONWISE_AGGREGATE_FULL, PARTITIONWISE_AGGREGATE_NONE, GroupPathExtraData::patype, PlannerInfo::processed_groupClause, grouping_sets_data::rollups, set_cheapest(), GroupPathExtraData::target_parallel_safe, and GroupPathExtraData::targetList.
Referenced by grouping_planner().
|
static |
Definition at line 4440 of file planner.c.
References add_column_to_pathtarget(), add_path(), clamp_width_est(), copy_pathtarget(), create_incremental_sort_path(), create_sort_path(), create_windowagg_path(), enable_incremental_sort, foreach_current_index, get_typavgwidth(), lfirst_node, list_concat(), list_length(), lnext(), make_pathkeys_for_window(), NIL, Path::pathkeys, pathkeys_count_contained_in(), PlannerInfo::processed_tlist, PathTarget::width, WindowFuncLists::windowFuncs, and WindowClause::winref.
Referenced by create_window_paths().
|
static |
Definition at line 5049 of file planner.c.
References add_path(), apply_projection_to_path(), Assert(), RelOptInfo::cheapest_total_path, RelOptInfo::consider_parallel, create_gather_merge_path(), create_incremental_sort_path(), create_sort_path(), create_upper_paths_hook, enable_incremental_sort, fetch_upper_rel(), lfirst, linitial, NIL, Path::parallel_workers, RelOptInfo::partial_pathlist, Path::pathkeys, pathkeys_count_contained_in(), RelOptInfo::pathlist, Path::rows, RelOptInfo::serverid, PlannerInfo::sort_pathkeys, UPPERREL_ORDERED, RelOptInfo::userid, and RelOptInfo::useridiscurrent.
Referenced by grouping_planner().
|
static |
Definition at line 3852 of file planner.c.
References add_paths_to_grouping_rel(), Assert(), RelOptInfo::cheapest_total_path, create_partial_grouping_paths(), create_partitionwise_grouping_paths(), create_upper_paths_hook, ereport, errcode(), errdetail(), errmsg(), ERROR, GroupPathExtraData::flags, gather_grouping_paths(), get_number_of_groups(), group_by_has_partkey(), Query::groupClause, GROUPING_CAN_PARTIAL_AGG, IS_PARTITIONED_REL, NIL, PlannerInfo::parse, RelOptInfo::partial_pathlist, PARTITIONWISE_AGGREGATE_FULL, PARTITIONWISE_AGGREGATE_NONE, PARTITIONWISE_AGGREGATE_PARTIAL, RelOptInfo::pathlist, GroupPathExtraData::patype, Path::rows, set_cheapest(), GroupPathExtraData::targetList, and UPPERREL_GROUP_AGG.
Referenced by create_grouping_paths(), and create_partitionwise_grouping_paths().
|
static |
Definition at line 4643 of file planner.c.
References add_partial_path(), AGG_HASHED, AGGSPLIT_SIMPLE, RelOptInfo::consider_parallel, create_agg_path(), create_final_distinct_paths(), create_incremental_sort_path(), create_limit_path(), create_sort_path(), create_upper_paths_hook, create_upper_unique_path(), PlannerInfo::distinct_pathkeys, enable_hashagg, enable_incremental_sort, estimate_num_groups(), fetch_upper_rel(), FLOAT8PASSBYVAL, generate_useful_gather_paths(), get_sortgrouplist_exprs(), grouping_is_hashable(), grouping_is_sortable(), Int64GetDatum(), InvalidOid, lfirst, LIMIT_OPTION_COUNT, linitial, list_length(), makeConst(), NIL, parse(), PlannerInfo::parse, RelOptInfo::partial_pathlist, Path::pathkeys, pathkeys_count_contained_in(), PlannerInfo::processed_distinctClause, RelOptInfo::reltarget, Path::rows, RelOptInfo::serverid, set_cheapest(), UPPERREL_PARTIAL_DISTINCT, RelOptInfo::userid, and RelOptInfo::useridiscurrent.
Referenced by create_distinct_paths().
|
static |
Definition at line 7020 of file planner.c.
References add_partial_path(), add_path(), GroupPathExtraData::agg_final_costs, AGG_HASHED, GroupPathExtraData::agg_partial_costs, AGG_PLAIN, AGG_SORTED, AGGSPLIT_FINAL_DESERIAL, AGGSPLIT_INITIAL_SERIAL, Assert(), RelOptInfo::cheapest_total_path, PathKeyInfo::clauses, RelOptInfo::consider_parallel, create_agg_path(), create_group_path(), fetch_upper_rel(), GroupPathExtraData::flags, get_agg_clause_costs(), get_number_of_groups(), get_useful_group_keys_orderings(), FdwRoutine::GetForeignUpperPaths, GROUPING_CAN_USE_HASH, GROUPING_CAN_USE_SORT, GroupPathExtraData::havingQual, lfirst, linitial, list_length(), make_ordered_path(), make_partial_grouping_target(), MemSet, NIL, parse(), PlannerInfo::parse, GroupPathExtraData::partial_costs_set, RelOptInfo::partial_pathlist, PARTITIONWISE_AGGREGATE_PARTIAL, PathKeyInfo::pathkeys, RelOptInfo::pathlist, GroupPathExtraData::patype, PlannerInfo::processed_groupClause, RelOptInfo::relids, RelOptInfo::reloptkind, RelOptInfo::reltarget, Path::rows, RelOptInfo::serverid, GroupPathExtraData::targetList, UPPERREL_PARTIAL_GROUP_AGG, RelOptInfo::userid, and RelOptInfo::useridiscurrent.
Referenced by create_ordinary_grouping_paths().
|
static |
Definition at line 7681 of file planner.c.
References add_paths_to_append_rel(), adjust_appendrel_attrs(), Assert(), bms_next_member(), copy_pathtarget(), create_ordinary_grouping_paths(), PathTarget::exprs, find_appinfos_by_relids(), GroupPathExtraData::havingQual, i, IS_DUMMY_REL, lappend(), RelOptInfo::live_parts, make_grouping_rel(), NIL, PARTITIONWISE_AGGREGATE_FULL, PARTITIONWISE_AGGREGATE_NONE, PARTITIONWISE_AGGREGATE_PARTIAL, RelOptInfo::pathlist, GroupPathExtraData::patype, pfree(), RelOptInfo::relids, RelOptInfo::reltarget, set_cheapest(), GroupPathExtraData::target_parallel_safe, and GroupPathExtraData::targetList.
Referenced by create_ordinary_grouping_paths().
|
static |
Definition at line 4353 of file planner.c.
References RelOptInfo::cheapest_total_path, RelOptInfo::consider_parallel, create_one_window_path(), create_upper_paths_hook, fetch_upper_rel(), is_parallel_safe(), lfirst, Path::pathkeys, pathkeys_count_contained_in(), RelOptInfo::pathlist, RelOptInfo::serverid, set_cheapest(), UPPERREL_WINDOW, RelOptInfo::userid, RelOptInfo::useridiscurrent, and PlannerInfo::window_pathkeys.
Referenced by grouping_planner().
Definition at line 6400 of file planner.c.
References eval_const_expressions(), and fix_opfuncids().
Referenced by ATExecAddColumn(), ATExecSetExpression(), ATPrepAlterColumnType(), BeginCopyFrom(), ComputePartitionAttrs(), contain_mutable_functions_after_planning(), contain_volatile_functions_after_planning(), ExecPrepareCheck(), ExecPrepareExpr(), ExecPrepareQual(), load_domaintype_info(), set_baserel_partition_constraint(), slot_fill_defaults(), StoreAttrDefault(), and transformPartitionBoundValue().
Definition at line 6427 of file planner.c.
References eval_const_expressions(), extract_query_dependencies_walker(), fix_opfuncids(), PlannerInfo::glob, PlannerGlobal::invalItems, MemSet, NIL, and PlannerGlobal::relationOids.
Referenced by GetCachedExpression().
Definition at line 2836 of file planner.c.
References Assert(), BipartiteMatch(), BipartiteMatchFree(), bms_add_member(), bms_equal(), bms_free(), bms_is_subset(), for_each_cell, i, j, lappend(), lcons(), lfirst, lfirst_int, list_concat(), list_head(), list_length(), list_make1, lnext(), NIL, palloc(), palloc0(), and pfree().
Referenced by preprocess_grouping_sets().
|
static |
Definition at line 7319 of file planner.c.
References add_path(), create_gather_merge_path(), create_incremental_sort_path(), create_sort_path(), enable_incremental_sort, generate_useful_gather_paths(), PlannerInfo::group_pathkeys, lfirst, linitial, list_copy_head(), list_length(), PlannerInfo::num_groupby_pathkeys, Path::parallel_workers, RelOptInfo::partial_pathlist, Path::pathkeys, pathkeys_count_contained_in(), RelOptInfo::reltarget, and Path::rows.
Referenced by add_paths_to_grouping_rel(), and create_ordinary_grouping_paths().
Path* get_cheapest_fractional_path | ( | RelOptInfo * | rel, |
double | tuple_fraction | ||
) |
Definition at line 6241 of file planner.c.
References RelOptInfo::cheapest_total_path, compare_fractional_path_costs(), lfirst, RelOptInfo::pathlist, and Path::rows.
Referenced by make_subplan(), recurse_set_operations(), and standard_planner().
|
static |
Definition at line 3479 of file planner.c.
References Assert(), grouping_sets_data::dNumHashGroups, estimate_num_groups(), forboth, get_sortgrouplist_exprs(), RollupData::groupClause, RollupData::gsets, RollupData::gsets_data, grouping_sets_data::hash_sets_idx, PlannerInfo::hasHavingQual, lfirst, lfirst_node, list_length(), GroupingSetData::numGroups, RollupData::numGroups, parse(), PlannerInfo::parse, PlannerInfo::processed_groupClause, grouping_sets_data::rollups, and grouping_sets_data::unsortable_sets.
Referenced by create_ordinary_grouping_paths(), and create_partial_grouping_paths().
|
static |
Definition at line 7825 of file planner.c.
References Assert(), get_sortgrouplist_exprs(), lfirst, and list_member().
Referenced by create_ordinary_grouping_paths().
|
static |
Definition at line 2800 of file planner.c.
References get_sortgroupref_clause(), lappend(), lfirst_int, NIL, parse(), and PlannerInfo::parse.
Referenced by consider_groupingsets_paths(), and preprocess_grouping_sets().
|
static |
Definition at line 1288 of file planner.c.
References generate_unaccent_rules::action, standard_qp_extra::activeWindows, add_partial_path(), add_path(), adjust_appendrel_attrs_multilevel(), adjust_inherited_attnums_multilevel(), adjust_paths_for_srfs(), PlannerInfo::all_result_relids, apply_scanjoin_target_to_paths(), Assert(), assign_special_exec_param(), bms_membership(), BMS_MULTIPLE, bms_next_member(), RelOptInfo::cheapest_total_path, CMD_SELECT, CMD_UPDATE, RelOptInfo::consider_parallel, copyObject, FinalPathExtraData::count_est, create_distinct_paths(), create_grouping_paths(), create_limit_path(), create_lockrows_path(), create_modifytable_path(), create_ordered_paths(), create_pathtarget, create_upper_paths_hook, create_window_paths(), equal(), ereport, errcode(), errmsg(), ERROR, PathTarget::exprs, fetch_upper_rel(), find_base_rel(), find_window_functions(), standard_qp_extra::gset_data, PlannerInfo::hasHavingQual, PlannerInfo::hasRecursion, IS_DUMMY_REL, is_parallel_safe(), lappend(), lappend_int(), LCS_asString(), PlannerInfo::leaf_result_relids, lfirst, limit_needed(), FinalPathExtraData::limit_needed, PlannerInfo::limit_tuples, FinalPathExtraData::limit_tuples, linitial_int, linitial_node, list_copy(), list_length(), list_make1, list_make1_int, make_group_input_target(), make_pathkeys_for_sortclauses(), make_sort_input_target(), make_window_input_target(), NIL, WindowFuncLists::numWindowFuncs, FinalPathExtraData::offset_est, optimize_window_clauses(), parse(), PlannerInfo::parse, PlannerInfo::partColsUpdated, RelOptInfo::partial_pathlist, RelOptInfo::pathlist, plan_set_operations(), postprocess_setop_tlist(), preprocess_aggrefs(), preprocess_grouping_sets(), preprocess_limit(), preprocess_minmax_aggregates(), preprocess_targetlist(), PlannerInfo::processed_groupClause, PlannerInfo::processed_tlist, PlannerInfo::query_level, query_planner(), RelOptInfo::relid, RelOptInfo::reltarget, remove_useless_groupby_columns(), PlannerInfo::rowMarks, select_active_windows(), RelOptInfo::serverid, PlannerInfo::sort_pathkeys, split_pathtarget_at_srfs(), standard_qp_callback(), PlannerInfo::tuple_fraction, PlannerInfo::update_colnos, UPPERREL_DISTINCT, UPPERREL_FINAL, UPPERREL_GROUP_AGG, UPPERREL_ORDERED, UPPERREL_PARTIAL_DISTINCT, UPPERREL_WINDOW, RelOptInfo::userid, and RelOptInfo::useridiscurrent.
Referenced by subquery_planner().
Definition at line 3096 of file planner.c.
References lfirst_node.
Referenced by adjust_group_pathkeys_for_groupagg().
|
static |
Definition at line 3767 of file planner.c.
References PlannerInfo::hasHavingQual, NIL, parse(), and PlannerInfo::parse.
Referenced by create_grouping_paths().
Definition at line 2596 of file planner.c.
References DatumGetInt64(), IsA, and parse().
Referenced by grouping_planner(), and set_rel_consider_parallel().
|
static |
Definition at line 5264 of file planner.c.
References add_column_to_pathtarget(), add_new_columns_to_pathtarget(), create_empty_pathtarget(), PathTarget::exprs, get_pathtarget_sortgroupref, get_sortgroupref_clause_noerr(), i, lappend(), lfirst, list_free(), NIL, parse(), PlannerInfo::parse, PlannerInfo::processed_groupClause, pull_var_clause(), PVC_INCLUDE_PLACEHOLDERS, PVC_RECURSE_AGGREGATES, PVC_RECURSE_WINDOWFUNCS, and set_pathtarget_cost_width().
Referenced by grouping_planner().
|
static |
Definition at line 3714 of file planner.c.
References RelOptInfo::consider_parallel, fetch_upper_rel(), IS_OTHER_REL, is_parallel_safe(), RelOptInfo::relids, RELOPT_OTHER_UPPER_REL, RelOptInfo::reloptkind, RelOptInfo::reltarget, RelOptInfo::serverid, UPPERREL_GROUP_AGG, RelOptInfo::userid, and RelOptInfo::useridiscurrent.
Referenced by create_grouping_paths(), and create_partitionwise_grouping_paths().
|
static |
Definition at line 6734 of file planner.c.
References create_incremental_sort_path(), create_sort_path(), enable_incremental_sort, Path::pathkeys, and pathkeys_count_contained_in().
Referenced by add_paths_to_grouping_rel(), and create_partial_grouping_paths().
|
static |
Definition at line 5352 of file planner.c.
References add_column_to_pathtarget(), add_new_columns_to_pathtarget(), AGGSPLIT_INITIAL_SERIAL, create_empty_pathtarget(), PathTarget::exprs, get_pathtarget_sortgroupref, get_sortgroupref_clause_noerr(), i, IsA, lappend(), lfirst, list_free(), makeNode, mark_partial_aggref(), NIL, PlannerInfo::processed_groupClause, pull_var_clause(), PVC_INCLUDE_AGGREGATES, PVC_INCLUDE_PLACEHOLDERS, PVC_RECURSE_WINDOWFUNCS, and set_pathtarget_cost_width().
Referenced by create_partial_grouping_paths().
|
static |
Definition at line 5944 of file planner.c.
References append_pathkeys(), Assert(), ereport, errcode(), errdetail(), errmsg(), ERROR, grouping_is_sortable(), make_pathkeys_for_sortclauses(), make_pathkeys_for_sortclauses_extended(), NIL, WindowClause::orderClause, and WindowClause::partitionClause.
Referenced by create_one_window_path(), and standard_qp_callback().
|
static |
Definition at line 6070 of file planner.c.
References add_column_to_pathtarget(), add_new_columns_to_pathtarget(), Assert(), contain_volatile_functions(), cost_qual_eval_node(), cpu_operator_cost, create_empty_pathtarget(), expression_returns_set(), PathTarget::exprs, get_pathtarget_sortgroupref, i, lappend(), lfirst, list_free(), list_length(), NIL, palloc0(), parse(), PlannerInfo::parse, QualCost::per_tuple, pull_var_clause(), PVC_INCLUDE_AGGREGATES, PVC_INCLUDE_PLACEHOLDERS, PVC_INCLUDE_WINDOWFUNCS, set_pathtarget_cost_width(), and PlannerInfo::tuple_fraction.
Referenced by grouping_planner().
|
static |
Definition at line 5824 of file planner.c.
References add_column_to_pathtarget(), add_new_columns_to_pathtarget(), Assert(), bms_add_member(), bms_is_member(), create_empty_pathtarget(), PathTarget::exprs, get_pathtarget_sortgroupref, i, lappend(), lfirst, lfirst_node, list_free(), NIL, WindowClause::orderClause, PlannerInfo::parse, WindowClause::partitionClause, PlannerInfo::processed_groupClause, pull_var_clause(), PVC_INCLUDE_AGGREGATES, PVC_INCLUDE_PLACEHOLDERS, PVC_RECURSE_WINDOWFUNCS, set_pathtarget_cost_width(), and SortGroupClause::tleSortGroupRef.
Referenced by grouping_planner().
Definition at line 5455 of file planner.c.
References AGGSPLIT_SIMPLE, Assert(), DO_AGGSPLIT_SERIALIZE, DO_AGGSPLIT_SKIPFINAL, and OidIsValid.
Referenced by convert_combining_aggrefs(), and make_partial_grouping_target().
|
static |
Definition at line 5527 of file planner.c.
References Assert(), DatumGetPointer(), WindowClause::endOffset, equal(), foreach_current_index, WindowClause::frameOptions, SupportRequestOptimizeWindowClause::frameOptions, get_func_support(), if(), lfirst_node, list_concat(), list_length(), WindowFuncLists::maxWinRef, NIL, OidFunctionCall1, OidIsValid, WindowClause::orderClause, PlannerInfo::parse, WindowClause::partitionClause, PointerGetDatum(), res, WindowClause::startOffset, SupportRequestOptimizeWindowClause::type, SupportRequestOptimizeWindowClause::window_clause, SupportRequestOptimizeWindowClause::window_func, Query::windowClause, WindowFuncLists::windowFuncs, WindowFunc::winfnoid, WindowClause::winref, and WindowFunc::winref.
Referenced by grouping_planner().
Definition at line 6480 of file planner.c.
References AccessShareLock, addRTEPermissionInfo(), build_simple_rel(), CMD_SELECT, Query::commandType, cost_qual_eval(), cost_sort(), create_index_path(), create_seqscan_path(), CurrentMemoryContext, enable_indexscan, ForwardScanDirection, get_relation_data_width(), PlannerInfo::glob, RelOptInfo::indexlist, IndexOptInfo::indexoid, RangeTblEntry::inFromCl, RangeTblEntry::inh, PlannerInfo::join_domains, RangeTblEntry::lateral, lfirst_node, list_make1, maintenance_work_mem, makeNode, NIL, RelOptInfo::pages, PlannerInfo::parse, IndexPath::path, QualCost::per_tuple, PlannerInfo::query_level, RangeTblEntry::relid, RangeTblEntry::relkind, RangeTblEntry::rellockmode, RelOptInfo::reltarget, RelOptInfo::rows, Query::rtable, RTE_RELATION, RangeTblEntry::rtekind, setup_simple_rel_arrays(), QualCost::startup, Path::total_cost, PlannerInfo::total_table_pages, RelOptInfo::tuples, PathTarget::width, and PlannerInfo::wt_param_id.
Referenced by copy_table_data().
Definition at line 6600 of file planner.c.
References AccessShareLock, addRTEPermissionInfo(), build_simple_rel(), CMD_SELECT, Query::commandType, compute_parallel_worker(), CurrentMemoryContext, estimate_rel_size(), PlannerInfo::glob, index_close(), index_open(), RangeTblEntry::inFromCl, RangeTblEntry::inh, is_parallel_safe(), IsUnderPostmaster, PlannerInfo::join_domains, RangeTblEntry::lateral, list_make1, maintenance_work_mem, makeNode, max_parallel_maintenance_workers, Min, NoLock, PlannerInfo::parse, PlannerInfo::query_level, RelationData::rd_rel, RelOptInfo::rel_parallel_workers, RelationGetIndexExpressions(), RelationGetIndexPredicate(), RangeTblEntry::relid, RangeTblEntry::relkind, RangeTblEntry::rellockmode, Query::rtable, RTE_RELATION, RangeTblEntry::rtekind, setup_simple_rel_arrays(), table_close(), table_open(), and PlannerInfo::wt_param_id.
Referenced by index_build().
PlannedStmt* planner | ( | Query * | parse, |
const char * | query_string, | ||
int | cursorOptions, | ||
ParamListInfo | boundParams | ||
) |
Definition at line 268 of file planner.c.
References parse(), planner_hook, and standard_planner().
Referenced by pg_plan_query().
Definition at line 5490 of file planner.c.
References Assert(), elog, ERROR, lfirst_node, list_head(), lnext(), TargetEntry::resno, and TargetEntry::ressortgroupref.
Referenced by grouping_planner().
|
static |
Definition at line 1113 of file planner.c.
References canonicalize_qual(), convert_saop_to_hashed_saop(), eval_const_expressions(), EXPRKIND_QUAL, EXPRKIND_RTFUNC, EXPRKIND_TABLEFUNC, EXPRKIND_TABLESAMPLE, EXPRKIND_TARGET, EXPRKIND_VALUES, flatten_join_alias_vars(), PlannerInfo::hasJoinRTEs, make_ands_implicit(), PlannerInfo::parse, pprint(), printf, PlannerInfo::query_level, SS_process_sublinks(), and SS_replace_correlation_vars().
Referenced by preprocess_phv_expression(), preprocess_qual_conditions(), and subquery_planner().
|
static |
Definition at line 2015 of file planner.c.
References grouping_sets_data::any_hashable, bms_add_member(), bms_is_empty, bms_overlap_list(), ereport, errcode(), errdetail(), errmsg(), ERROR, expand_grouping_sets(), extract_rollup_sets(), RollupData::groupClause, groupclause_apply_groupingset(), RollupData::gsets, RollupData::gsets_data, grouping_sets_data::hash_sets_idx, RollupData::hashable, lappend(), lfirst, lfirst_node, linitial_node, list_length(), makeNode, NIL, OidIsValid, palloc(), palloc0(), parse(), PlannerInfo::parse, PlannerInfo::processed_groupClause, remap_to_groupclause_idx(), reorder_grouping_sets(), grouping_sets_data::rollups, GroupingSetData::set, SortGroupClause::sortop, grouping_sets_data::tleref_to_colnum_map, SortGroupClause::tleSortGroupRef, grouping_sets_data::unhashable_refs, grouping_sets_data::unsortable_refs, and grouping_sets_data::unsortable_sets.
Referenced by grouping_planner().
|
static |
Definition at line 2411 of file planner.c.
References Assert(), DatumGetInt64(), estimate_expression_value(), IsA, Min, parse(), and PlannerInfo::parse.
Referenced by grouping_planner().
Expr* preprocess_phv_expression | ( | PlannerInfo * | root, |
Expr * | expr | ||
) |
Definition at line 1259 of file planner.c.
References EXPRKIND_PHV, and preprocess_expression().
Referenced by extract_lateral_references().
|
static |
Definition at line 1215 of file planner.c.
References elog, ERROR, EXPRKIND_QUAL, FromExpr::fromlist, IsA, j, lfirst, nodeTag, preprocess_expression(), and FromExpr::quals.
Referenced by subquery_planner().
|
static |
Definition at line 2233 of file planner.c.
References PlanRowMark::allMarkTypes, Assert(), bms_del_member(), bms_is_member(), CheckSelectLocking(), CMD_DELETE, CMD_MERGE, CMD_UPDATE, get_relids_in_jointree(), PlannerInfo::glob, i, PlanRowMark::isParent, lappend(), PlannerGlobal::lastRowMarkId, LCS_NONE, lfirst_node, linitial_node, LockWaitBlock, makeNode, PlanRowMark::markType, NIL, parse(), PlannerInfo::parse, PlanRowMark::prti, PlanRowMark::rowmarkId, PlannerInfo::rowMarks, rt_fetch, RTE_RELATION, RangeTblEntry::rtekind, RowMarkClause::rti, PlanRowMark::rti, select_rowmark_type(), RowMarkClause::strength, PlanRowMark::strength, RowMarkClause::waitPolicy, and PlanRowMark::waitPolicy.
Referenced by subquery_planner().
|
static |
Definition at line 2196 of file planner.c.
References lappend(), lappend_int(), lfirst_int, lfirst_node, NIL, GroupingSetData::set, and SortGroupClause::tleSortGroupRef.
Referenced by consider_groupingsets_paths(), and preprocess_grouping_sets().
|
static |
Definition at line 2655 of file planner.c.
References Assert(), bms_add_member(), bms_difference(), bms_is_member(), bms_membership(), BMS_MULTIPLE, BMS_SUBSET1, bms_subset_compare(), TargetEntry::expr, FirstLowInvalidHeapAttributeNumber, get_primary_key_attnos(), get_sortgroupclause_tle(), if(), RangeTblEntry::inh, IsA, lappend(), lfirst_node, list_length(), NIL, palloc0(), parse(), PlannerInfo::parse, PlannerInfo::processed_groupClause, RangeTblEntry::relid, RangeTblEntry::relkind, RTE_RELATION, RangeTblEntry::rtekind, Var::varattno, Var::varlevelsup, and Var::varno.
Referenced by grouping_planner().
Definition at line 3048 of file planner.c.
References lappend_int(), lcons(), lfirst, list_concat(), list_copy(), list_delete_int(), list_difference_int(), list_free(), list_length(), list_member_int(), list_nth(), makeNode, NIL, GroupingSetData::set, and SortGroupClause::tleSortGroupRef.
Referenced by preprocess_grouping_sets().
|
static |
Definition at line 5667 of file planner.c.
References Assert(), common_prefix_cmp(), i, lappend(), lfirst_node, list_concat_unique(), list_copy(), list_length(), WindowFuncLists::maxWinRef, NIL, WindowClause::orderClause, palloc(), PlannerInfo::parse, WindowClause::partitionClause, pfree(), qsort, WindowClauseSortData::uniqueOrder, WindowClauseSortData::wc, Query::windowClause, WindowFuncLists::windowFuncs, and WindowClause::winref.
Referenced by grouping_planner().
RowMarkType select_rowmark_type | ( | RangeTblEntry * | rte, |
LockClauseStrength | strength | ||
) |
Definition at line 2345 of file planner.c.
References elog, ERROR, GetFdwRoutineByRelId(), FdwRoutine::GetForeignRowMarkType, LCS_FORKEYSHARE, LCS_FORNOKEYUPDATE, LCS_FORSHARE, LCS_FORUPDATE, LCS_NONE, RangeTblEntry::relid, RangeTblEntry::relkind, ROW_MARK_COPY, ROW_MARK_EXCLUSIVE, ROW_MARK_KEYSHARE, ROW_MARK_NOKEYEXCLUSIVE, ROW_MARK_REFERENCE, ROW_MARK_SHARE, RTE_RELATION, and RangeTblEntry::rtekind.
Referenced by expand_single_inheritance_child(), and preprocess_rowmarks().
PlannedStmt* standard_planner | ( | Query * | parse, |
const char * | query_string, | ||
int | cursorOptions, | ||
ParamListInfo | boundParams | ||
) |
Definition at line 281 of file planner.c.
References PlannerGlobal::appendRelations, PlannedStmt::appendRelations, Assert(), PlannedStmt::canSetTag, CMD_SELECT, PlannedStmt::commandType, create_plan(), CURSOR_OPT_FAST_PLAN, CURSOR_OPT_PARALLEL_OK, CURSOR_OPT_SCROLL, cursor_tuple_fraction, DEBUG_PARALLEL_OFF, debug_parallel_query, DEBUG_PARALLEL_REGRESS, PlannerGlobal::dependsOnRole, PlannedStmt::dependsOnRole, DestroyPartitionDirectory(), ExecSupportsBackwardScan(), fetch_upper_rel(), PlannerGlobal::finalrowmarks, PlannerGlobal::finalrtable, PlannerGlobal::finalrteperminfos, forboth, get_cheapest_fractional_path(), PlannerInfo::glob, PlannedStmt::hasModifyingCTE, PlannedStmt::hasReturning, Plan::initPlan, PlannerGlobal::invalItems, PlannedStmt::invalItems, Gather::invisible, IsParallelWorker, IsUnderPostmaster, jit_above_cost, jit_enabled, jit_expressions, jit_inline_above_cost, jit_optimize_above_cost, jit_tuple_deforming, PlannedStmt::jitFlags, PlannerGlobal::lastPHId, PlannerGlobal::lastPlanNodeId, PlannerGlobal::lastRowMarkId, Plan::lefttree, lfirst, lfirst_node, list_length(), makeNode, materialize_finished_plan(), max_parallel_hazard(), max_parallel_workers_per_gather, PlannerGlobal::maxParallelHazard, NIL, Gather::num_workers, Plan::parallel_aware, Plan::parallel_safe, parallel_setup_cost, parallel_tuple_cost, PlannerGlobal::parallelModeNeeded, PlannedStmt::parallelModeNeeded, PlannerGlobal::parallelModeOK, PlannerGlobal::paramExecTypes, PlannedStmt::paramExecTypes, parse(), PlannedStmt::permInfos, PGJIT_DEFORM, PGJIT_EXPR, PGJIT_INLINE, PGJIT_NONE, PGJIT_OPT3, PGJIT_PERFORM, Gather::plan, Plan::plan_rows, Plan::plan_width, PlannedStmt::planTree, Plan::qual, PlannedStmt::queryId, PlannerGlobal::relationOids, PlannedStmt::relationOids, Gather::rescan_param, PlannerGlobal::resultRelations, PlannedStmt::resultRelations, PlannerGlobal::rewindPlanIDs, PlannedStmt::rewindPlanIDs, Plan::righttree, PlannedStmt::rowMarks, PlannedStmt::rtable, set_plan_references(), Gather::single_copy, SS_compute_initplan_cost(), SS_finalize_plan(), Plan::startup_cost, PlannedStmt::stmt_len, PlannedStmt::stmt_location, PlannerGlobal::subplans, PlannedStmt::subplans, subquery_planner(), Plan::targetlist, Plan::total_cost, PlannerGlobal::transientPlan, PlannedStmt::transientPlan, UPPERREL_FINAL, and PlannedStmt::utilityStmt.
Referenced by delay_execution_planner(), pgss_planner(), and planner().
|
static |
Definition at line 3322 of file planner.c.
References standard_qp_extra::activeWindows, adjust_group_pathkeys_for_groupagg(), PlannerInfo::distinct_pathkeys, PlannerInfo::group_pathkeys, grouping_is_sortable(), standard_qp_extra::gset_data, linitial_node, list_copy(), list_length(), make_pathkeys_for_sortclauses(), make_pathkeys_for_sortclauses_extended(), make_pathkeys_for_window(), NIL, PlannerInfo::num_groupby_pathkeys, PlannerInfo::numOrderedAggs, parse(), PlannerInfo::parse, PlannerInfo::processed_distinctClause, PlannerInfo::processed_groupClause, PlannerInfo::processed_tlist, PlannerInfo::query_pathkeys, grouping_sets_data::rollups, PlannerInfo::sort_pathkeys, and PlannerInfo::window_pathkeys.
Referenced by grouping_planner().
PlannerInfo* subquery_planner | ( | PlannerGlobal * | glob, |
Query * | parse, | ||
PlannerInfo * | parent_root, | ||
bool | hasRecursion, | ||
double | tuple_fraction | ||
) |
Definition at line 618 of file planner.c.
References generate_unaccent_rules::action, PlannerInfo::all_result_relids, PlannerInfo::append_rel_list, assign_special_exec_param(), bms_make_singleton(), contain_agg_clause(), contain_subplans(), contain_volatile_functions(), copyObject, PlannerInfo::cte_plan_ids, CurrentMemoryContext, PlannerInfo::ec_merging_done, WindowClause::endOffset, PlannerInfo::eq_classes, expression_returns_set(), EXPRKIND_APPINFO, EXPRKIND_ARBITER_ELEM, EXPRKIND_LIMIT, EXPRKIND_QUAL, EXPRKIND_RTFUNC, EXPRKIND_RTFUNC_LATERAL, EXPRKIND_TABLEFUNC, EXPRKIND_TABLEFUNC_LATERAL, EXPRKIND_TABLESAMPLE, EXPRKIND_TARGET, EXPRKIND_VALUES, EXPRKIND_VALUES_LATERAL, fetch_upper_rel(), flatten_join_alias_vars(), flatten_simple_union_all(), RangeTblEntry::functions, PlannerInfo::glob, grouping_planner(), has_subclass(), PlannerInfo::hasAlternativeSubPlans, PlannerInfo::hasHavingQual, PlannerInfo::hasJoinRTEs, PlannerInfo::hasLateralRTEs, PlannerInfo::hasPseudoConstantQuals, PlannerInfo::hasRecursion, RangeTblEntry::inh, PlannerInfo::init_plans, IS_OUTER_JOIN, PlannerInfo::join_domains, RangeTblEntry::joinaliasvars, RangeTblEntry::jointype, lappend(), PlannerInfo::last_rinfo_serial, RangeTblEntry::lateral, PlannerInfo::leaf_result_relids, lfirst, lfirst_node, list_length(), list_make1, makeNode, Max, PlannerInfo::minmax_aggs, PlannerInfo::multiexpr_params, NIL, PlannerInfo::non_recursive_path, PlannerInfo::outer_params, parse(), PlannerInfo::parse, PlannerInfo::partColsUpdated, PlannerInfo::placeholdersFrozen, PlannerInfo::plan_params, preprocess_expression(), preprocess_function_rtes(), preprocess_qual_conditions(), preprocess_rowmarks(), PlannerInfo::processed_distinctClause, PlannerInfo::processed_groupClause, PlannerInfo::processed_tlist, pull_up_sublinks(), pull_up_subqueries(), WithCheckOption::qual, PlannerInfo::qual_security_level, PlannerInfo::query_level, reduce_outer_joins(), RangeTblEntry::relid, remove_useless_result_rtes(), replace_empty_jointree(), PlannerInfo::row_identity_vars, PlannerInfo::rowMarks, rt_fetch, RTE_FUNCTION, RTE_JOIN, RTE_RELATION, RTE_RESULT, RTE_SUBQUERY, RTE_TABLEFUNC, RTE_VALUES, RangeTblEntry::rtekind, RangeTblEntry::securityQuals, set_cheapest(), SS_charge_for_initplans(), SS_identify_outer_params(), SS_process_ctes(), WindowClause::startOffset, RangeTblEntry::subquery, RangeTblEntry::tablefunc, RangeTblEntry::tablesample, transform_MERGE_to_join(), PlannerInfo::update_colnos, UPPERREL_FINAL, RangeTblEntry::values_lists, and PlannerInfo::wt_param_id.
Referenced by make_subplan(), recurse_set_operations(), set_subquery_pathlist(), SS_process_ctes(), and standard_planner().
create_upper_paths_hook_type create_upper_paths_hook = NULL |
Definition at line 73 of file planner.c.
Referenced by create_distinct_paths(), create_ordered_paths(), create_ordinary_grouping_paths(), create_partial_distinct_paths(), create_window_paths(), grouping_planner(), and postprocess_setop_rel().
double cursor_tuple_fraction = DEFAULT_CURSOR_TUPLE_FRACTION |
Definition at line 65 of file planner.c.
Referenced by standard_planner().
int debug_parallel_query = DEBUG_PARALLEL_OFF |
Definition at line 66 of file planner.c.
Referenced by HandleParallelMessage(), query_planner(), and standard_planner().
Definition at line 67 of file planner.c.
Referenced by ExecGather(), ExecGatherMerge(), ExecInitGather(), and get_parallel_divisor().
planner_hook_type planner_hook = NULL |
Definition at line 70 of file planner.c.
Referenced by _PG_init(), and planner().