PostgreSQL Source Code  git master
pathnodes.h File Reference
#include "access/sdir.h"
#include "lib/stringinfo.h"
#include "nodes/params.h"
#include "nodes/parsenodes.h"
#include "storage/block.h"
Include dependency graph for pathnodes.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  QualCost
 
struct  AggClauseCosts
 
struct  PlannerGlobal
 
struct  PlannerInfo
 
struct  PartitionSchemeData
 
struct  RelOptInfo
 
struct  IndexOptInfo
 
struct  ForeignKeyOptInfo
 
struct  StatisticExtInfo
 
struct  EquivalenceClass
 
struct  EquivalenceMember
 
struct  PathKey
 
struct  PathTarget
 
struct  ParamPathInfo
 
struct  Path
 
struct  IndexPath
 
struct  IndexClause
 
struct  BitmapHeapPath
 
struct  BitmapAndPath
 
struct  BitmapOrPath
 
struct  TidPath
 
struct  SubqueryScanPath
 
struct  ForeignPath
 
struct  CustomPath
 
struct  AppendPath
 
struct  MergeAppendPath
 
struct  GroupResultPath
 
struct  MaterialPath
 
struct  UniquePath
 
struct  GatherPath
 
struct  GatherMergePath
 
struct  JoinPath
 
struct  MergePath
 
struct  HashPath
 
struct  ProjectionPath
 
struct  ProjectSetPath
 
struct  SortPath
 
struct  GroupPath
 
struct  UpperUniquePath
 
struct  AggPath
 
struct  GroupingSetData
 
struct  RollupData
 
struct  GroupingSetsPath
 
struct  MinMaxAggPath
 
struct  WindowAggPath
 
struct  SetOpPath
 
struct  RecursiveUnionPath
 
struct  LockRowsPath
 
struct  ModifyTablePath
 
struct  LimitPath
 
struct  RestrictInfo
 
struct  MergeScanSelCache
 
struct  PlaceHolderVar
 
struct  SpecialJoinInfo
 
struct  AppendRelInfo
 
struct  PlaceHolderInfo
 
struct  MinMaxAggInfo
 
struct  PlannerParamItem
 
struct  SemiAntiJoinFactors
 
struct  JoinPathExtraData
 
struct  GroupPathExtraData
 
struct  FinalPathExtraData
 
struct  JoinCostWorkspace
 

Macros

#define planner_subplan_get_plan(root, subplan)   ((Plan *) list_nth((root)->glob->subplans, (subplan)->plan_id - 1))
 
#define HAVE_PLANNERINFO_TYPEDEF   1
 
#define planner_rt_fetch(rti, root)
 
#define IS_SIMPLE_REL(rel)
 
#define IS_JOIN_REL(rel)
 
#define IS_UPPER_REL(rel)
 
#define IS_OTHER_REL(rel)
 
#define IS_PARTITIONED_REL(rel)
 
#define REL_HAS_ALL_PART_PROPS(rel)
 
#define HAVE_INDEXOPTINFO_TYPEDEF   1
 
#define EC_MUST_BE_REDUNDANT(eclass)   ((eclass)->ec_has_const && !(eclass)->ec_below_outer_join)
 
#define get_pathtarget_sortgroupref(target, colno)   ((target)->sortgrouprefs ? (target)->sortgrouprefs[colno] : (Index) 0)
 
#define PATH_REQ_OUTER(path)   ((path)->param_info ? (path)->param_info->ppi_req_outer : (Relids) NULL)
 
#define IS_DUMMY_APPEND(p)   (IsA((p), AppendPath) && ((AppendPath *) (p))->subpaths == NIL)
 
#define IS_DUMMY_REL(r)   is_dummy_rel(r)
 
#define RINFO_IS_PUSHED_DOWN(rinfo, joinrelids)
 
#define HAVE_SPECIALJOININFO_TYPEDEF   1
 
#define GROUPING_CAN_USE_SORT   0x0001
 
#define GROUPING_CAN_USE_HASH   0x0002
 
#define GROUPING_CAN_PARTIAL_AGG   0x0004
 

Typedefs

typedef BitmapsetRelids
 
typedef enum CostSelector CostSelector
 
typedef struct QualCost QualCost
 
typedef struct AggClauseCosts AggClauseCosts
 
typedef enum UpperRelationKind UpperRelationKind
 
typedef enum InheritanceKind InheritanceKind
 
typedef struct PlannerGlobal PlannerGlobal
 
typedef struct PlannerInfo PlannerInfo
 
typedef struct PartitionSchemeData PartitionSchemeData
 
typedef struct PartitionSchemeDataPartitionScheme
 
typedef enum RelOptKind RelOptKind
 
typedef struct RelOptInfo RelOptInfo
 
typedef struct IndexOptInfo IndexOptInfo
 
typedef struct ForeignKeyOptInfo ForeignKeyOptInfo
 
typedef struct StatisticExtInfo StatisticExtInfo
 
typedef struct EquivalenceClass EquivalenceClass
 
typedef struct EquivalenceMember EquivalenceMember
 
typedef struct PathKey PathKey
 
typedef struct PathTarget PathTarget
 
typedef struct ParamPathInfo ParamPathInfo
 
typedef struct Path Path
 
typedef struct IndexPath IndexPath
 
typedef struct IndexClause IndexClause
 
typedef struct BitmapHeapPath BitmapHeapPath
 
typedef struct BitmapAndPath BitmapAndPath
 
typedef struct BitmapOrPath BitmapOrPath
 
typedef struct TidPath TidPath
 
typedef struct SubqueryScanPath SubqueryScanPath
 
typedef struct ForeignPath ForeignPath
 
typedef struct CustomPath CustomPath
 
typedef struct AppendPath AppendPath
 
typedef struct MergeAppendPath MergeAppendPath
 
typedef struct GroupResultPath GroupResultPath
 
typedef struct MaterialPath MaterialPath
 
typedef struct UniquePath UniquePath
 
typedef struct GatherPath GatherPath
 
typedef struct GatherMergePath GatherMergePath
 
typedef struct JoinPath JoinPath
 
typedef JoinPath NestPath
 
typedef struct MergePath MergePath
 
typedef struct HashPath HashPath
 
typedef struct ProjectionPath ProjectionPath
 
typedef struct ProjectSetPath ProjectSetPath
 
typedef struct SortPath SortPath
 
typedef struct GroupPath GroupPath
 
typedef struct UpperUniquePath UpperUniquePath
 
typedef struct AggPath AggPath
 
typedef struct GroupingSetData GroupingSetData
 
typedef struct RollupData RollupData
 
typedef struct GroupingSetsPath GroupingSetsPath
 
typedef struct MinMaxAggPath MinMaxAggPath
 
typedef struct WindowAggPath WindowAggPath
 
typedef struct SetOpPath SetOpPath
 
typedef struct RecursiveUnionPath RecursiveUnionPath
 
typedef struct LockRowsPath LockRowsPath
 
typedef struct ModifyTablePath ModifyTablePath
 
typedef struct LimitPath LimitPath
 
typedef struct RestrictInfo RestrictInfo
 
typedef struct MergeScanSelCache MergeScanSelCache
 
typedef struct PlaceHolderVar PlaceHolderVar
 
typedef struct SpecialJoinInfo SpecialJoinInfo
 
typedef struct AppendRelInfo AppendRelInfo
 
typedef struct PlaceHolderInfo PlaceHolderInfo
 
typedef struct MinMaxAggInfo MinMaxAggInfo
 
typedef struct PlannerParamItem PlannerParamItem
 
typedef struct SemiAntiJoinFactors SemiAntiJoinFactors
 
typedef struct JoinPathExtraData JoinPathExtraData
 
typedef struct JoinCostWorkspace JoinCostWorkspace
 

Enumerations

enum  CostSelector { STARTUP_COST, TOTAL_COST }
 
enum  UpperRelationKind {
  UPPERREL_SETOP, UPPERREL_PARTIAL_GROUP_AGG, UPPERREL_GROUP_AGG, UPPERREL_WINDOW,
  UPPERREL_DISTINCT, UPPERREL_ORDERED, UPPERREL_FINAL
}
 
enum  InheritanceKind { INHKIND_NONE, INHKIND_INHERITED, INHKIND_PARTITIONED }
 
enum  RelOptKind {
  RELOPT_BASEREL, RELOPT_JOINREL, RELOPT_OTHER_MEMBER_REL, RELOPT_OTHER_JOINREL,
  RELOPT_UPPER_REL, RELOPT_OTHER_UPPER_REL, RELOPT_DEADREL
}
 
enum  UniquePathMethod { UNIQUE_PATH_NOOP, UNIQUE_PATH_HASH, UNIQUE_PATH_SORT }
 
enum  PartitionwiseAggregateType { PARTITIONWISE_AGGREGATE_NONE, PARTITIONWISE_AGGREGATE_FULL, PARTITIONWISE_AGGREGATE_PARTIAL }
 

Functions

bool is_dummy_rel (RelOptInfo *rel)
 

Macro Definition Documentation

◆ EC_MUST_BE_REDUNDANT

#define EC_MUST_BE_REDUNDANT (   eclass)    ((eclass)->ec_has_const && !(eclass)->ec_below_outer_join)

Definition at line 953 of file pathnodes.h.

Referenced by pathkey_is_redundant(), and select_mergejoin_clauses().

◆ get_pathtarget_sortgroupref

#define get_pathtarget_sortgroupref (   target,
  colno 
)    ((target)->sortgrouprefs ? (target)->sortgrouprefs[colno] : (Index) 0)

◆ GROUPING_CAN_PARTIAL_AGG

#define GROUPING_CAN_PARTIAL_AGG   0x0004

Definition at line 2402 of file pathnodes.h.

Referenced by create_grouping_paths(), and create_ordinary_grouping_paths().

◆ GROUPING_CAN_USE_HASH

#define GROUPING_CAN_USE_HASH   0x0002

◆ GROUPING_CAN_USE_SORT

#define GROUPING_CAN_USE_SORT   0x0001

◆ HAVE_INDEXOPTINFO_TYPEDEF

#define HAVE_INDEXOPTINFO_TYPEDEF   1

Definition at line 782 of file pathnodes.h.

◆ HAVE_PLANNERINFO_TYPEDEF

#define HAVE_PLANNERINFO_TYPEDEF   1

Definition at line 170 of file pathnodes.h.

◆ HAVE_SPECIALJOININFO_TYPEDEF

#define HAVE_SPECIALJOININFO_TYPEDEF   1

Definition at line 2127 of file pathnodes.h.

◆ IS_DUMMY_APPEND

#define IS_DUMMY_APPEND (   p)    (IsA((p), AppendPath) && ((AppendPath *) (p))->subpaths == NIL)

Definition at line 1380 of file pathnodes.h.

Referenced by is_dummy_rel(), and is_projection_capable_path().

◆ IS_DUMMY_REL

◆ IS_JOIN_REL

◆ IS_OTHER_REL

◆ IS_PARTITIONED_REL

#define IS_PARTITIONED_REL (   rel)
Value:
((rel)->part_scheme && (rel)->boundinfo && (rel)->nparts > 0 && \
(rel)->part_rels && !IS_DUMMY_REL(rel))
#define IS_DUMMY_REL(r)
Definition: pathnodes.h:1388

Definition at line 737 of file pathnodes.h.

Referenced by apply_scanjoin_target_to_paths(), build_joinrel_partition_info(), create_ordinary_grouping_paths(), generate_partitionwise_join_paths(), and try_partitionwise_join().

◆ IS_SIMPLE_REL

◆ IS_UPPER_REL

◆ PATH_REQ_OUTER

◆ planner_rt_fetch

◆ planner_subplan_get_plan

#define planner_subplan_get_plan (   root,
  subplan 
)    ((Plan *) list_nth((root)->glob->subplans, (subplan)->plan_id - 1))

Definition at line 151 of file pathnodes.h.

Referenced by finalize_plan(), and finalize_primnode().

◆ REL_HAS_ALL_PART_PROPS

#define REL_HAS_ALL_PART_PROPS (   rel)
Value:
((rel)->part_scheme && (rel)->boundinfo && (rel)->nparts > 0 && \
(rel)->part_rels && (rel)->partexprs && (rel)->nullable_partexprs)

Definition at line 745 of file pathnodes.h.

Referenced by build_joinrel_partition_info(), and try_partitionwise_join().

◆ RINFO_IS_PUSHED_DOWN

#define RINFO_IS_PUSHED_DOWN (   rinfo,
  joinrelids 
)

Typedef Documentation

◆ AggClauseCosts

◆ AggPath

typedef struct AggPath AggPath

◆ AppendPath

typedef struct AppendPath AppendPath

◆ AppendRelInfo

typedef struct AppendRelInfo AppendRelInfo

◆ BitmapAndPath

typedef struct BitmapAndPath BitmapAndPath

◆ BitmapHeapPath

◆ BitmapOrPath

typedef struct BitmapOrPath BitmapOrPath

◆ CostSelector

typedef enum CostSelector CostSelector

◆ CustomPath

typedef struct CustomPath CustomPath

◆ EquivalenceClass

◆ EquivalenceMember

◆ ForeignKeyOptInfo

◆ ForeignPath

typedef struct ForeignPath ForeignPath

◆ GatherMergePath

◆ GatherPath

typedef struct GatherPath GatherPath

◆ GroupingSetData

◆ GroupingSetsPath

◆ GroupPath

typedef struct GroupPath GroupPath

◆ GroupResultPath

◆ HashPath

typedef struct HashPath HashPath

◆ IndexClause

typedef struct IndexClause IndexClause

◆ IndexOptInfo

typedef struct IndexOptInfo IndexOptInfo

Definition at line 781 of file pathnodes.h.

◆ IndexPath

typedef struct IndexPath IndexPath

◆ InheritanceKind

◆ JoinCostWorkspace

◆ JoinPath

typedef struct JoinPath JoinPath

◆ JoinPathExtraData

◆ LimitPath

typedef struct LimitPath LimitPath

◆ LockRowsPath

typedef struct LockRowsPath LockRowsPath

◆ MaterialPath

typedef struct MaterialPath MaterialPath

◆ MergeAppendPath

◆ MergePath

typedef struct MergePath MergePath

◆ MergeScanSelCache

◆ MinMaxAggInfo

typedef struct MinMaxAggInfo MinMaxAggInfo

◆ MinMaxAggPath

typedef struct MinMaxAggPath MinMaxAggPath

◆ ModifyTablePath

◆ NestPath

typedef JoinPath NestPath

Definition at line 1511 of file pathnodes.h.

◆ ParamPathInfo

typedef struct ParamPathInfo ParamPathInfo

◆ PartitionScheme

Definition at line 405 of file pathnodes.h.

◆ PartitionSchemeData

◆ Path

typedef struct Path Path

◆ PathKey

typedef struct PathKey PathKey

◆ PathTarget

typedef struct PathTarget PathTarget

◆ PlaceHolderInfo

◆ PlaceHolderVar

◆ PlannerGlobal

typedef struct PlannerGlobal PlannerGlobal

◆ PlannerInfo

typedef struct PlannerInfo PlannerInfo

Definition at line 169 of file pathnodes.h.

◆ PlannerParamItem

◆ ProjectionPath

◆ ProjectSetPath

◆ QualCost

typedef struct QualCost QualCost

◆ RecursiveUnionPath

◆ Relids

typedef Bitmapset* Relids

Definition at line 28 of file pathnodes.h.

◆ RelOptInfo

typedef struct RelOptInfo RelOptInfo

◆ RelOptKind

typedef enum RelOptKind RelOptKind

◆ RestrictInfo

typedef struct RestrictInfo RestrictInfo

◆ RollupData

typedef struct RollupData RollupData

◆ SemiAntiJoinFactors

◆ SetOpPath

typedef struct SetOpPath SetOpPath

◆ SortPath

typedef struct SortPath SortPath

◆ SpecialJoinInfo

Definition at line 2126 of file pathnodes.h.

◆ StatisticExtInfo

◆ SubqueryScanPath

◆ TidPath

typedef struct TidPath TidPath

◆ UniquePath

typedef struct UniquePath UniquePath

◆ UpperRelationKind

◆ UpperUniquePath

◆ WindowAggPath

typedef struct WindowAggPath WindowAggPath

Enumeration Type Documentation

◆ CostSelector

Enumerator
STARTUP_COST 
TOTAL_COST 

Definition at line 34 of file pathnodes.h.

◆ InheritanceKind

Enumerator
INHKIND_NONE 
INHKIND_INHERITED 
INHKIND_PARTITIONED 

Definition at line 89 of file pathnodes.h.

◆ PartitionwiseAggregateType

Enumerator
PARTITIONWISE_AGGREGATE_NONE 
PARTITIONWISE_AGGREGATE_FULL 
PARTITIONWISE_AGGREGATE_PARTIAL 

Definition at line 2415 of file pathnodes.h.

◆ RelOptKind

enum RelOptKind
Enumerator
RELOPT_BASEREL 
RELOPT_JOINREL 
RELOPT_OTHER_MEMBER_REL 
RELOPT_OTHER_JOINREL 
RELOPT_UPPER_REL 
RELOPT_OTHER_UPPER_REL 
RELOPT_DEADREL 

Definition at line 599 of file pathnodes.h.

◆ UniquePathMethod

Enumerator
UNIQUE_PATH_NOOP 
UNIQUE_PATH_HASH 
UNIQUE_PATH_SORT 

Definition at line 1441 of file pathnodes.h.

1442 {
1443  UNIQUE_PATH_NOOP, /* input is known unique already */
1444  UNIQUE_PATH_HASH, /* use hashing */
1445  UNIQUE_PATH_SORT /* use sorting */
UniquePathMethod
Definition: pathnodes.h:1441

◆ UpperRelationKind

Enumerator
UPPERREL_SETOP 
UPPERREL_PARTIAL_GROUP_AGG 
UPPERREL_GROUP_AGG 
UPPERREL_WINDOW 
UPPERREL_DISTINCT 
UPPERREL_ORDERED 
UPPERREL_FINAL 

Definition at line 71 of file pathnodes.h.

72 {
73  UPPERREL_SETOP, /* result of UNION/INTERSECT/EXCEPT, if any */
74  UPPERREL_PARTIAL_GROUP_AGG, /* result of partial grouping/aggregation, if
75  * any */
76  UPPERREL_GROUP_AGG, /* result of grouping/aggregation, if any */
77  UPPERREL_WINDOW, /* result of window functions, if any */
78  UPPERREL_DISTINCT, /* result of "SELECT DISTINCT", if any */
79  UPPERREL_ORDERED, /* result of ORDER BY, if any */
80  UPPERREL_FINAL /* result of any remaining top-level actions */
81  /* NB: UPPERREL_FINAL must be last enum entry; it's used to size arrays */
UpperRelationKind
Definition: pathnodes.h:71

Function Documentation

◆ is_dummy_rel()

bool is_dummy_rel ( RelOptInfo rel)

Definition at line 1208 of file joinrels.c.

References IS_DUMMY_APPEND, IsA, linitial, NIL, RelOptInfo::pathlist, and subpath().

Referenced by make_join_rel(), mark_dummy_rel(), and populate_joinrel_with_paths().

1209 {
1210  Path *path;
1211 
1212  /*
1213  * A rel that is known dummy will have just one path that is a childless
1214  * Append. (Even if somehow it has more paths, a childless Append will
1215  * have cost zero and hence should be at the front of the pathlist.)
1216  */
1217  if (rel->pathlist == NIL)
1218  return false;
1219  path = (Path *) linitial(rel->pathlist);
1220 
1221  /*
1222  * Initially, a dummy path will just be a childless Append. But in later
1223  * planning stages we might stick a ProjectSetPath and/or ProjectionPath
1224  * on top, since Append can't project. Rather than make assumptions about
1225  * which combinations can occur, just descend through whatever we find.
1226  */
1227  for (;;)
1228  {
1229  if (IsA(path, ProjectionPath))
1230  path = ((ProjectionPath *) path)->subpath;
1231  else if (IsA(path, ProjectSetPath))
1232  path = ((ProjectSetPath *) path)->subpath;
1233  else
1234  break;
1235  }
1236  if (IS_DUMMY_APPEND(path))
1237  return true;
1238  return false;
1239 }
#define NIL
Definition: pg_list.h:65
#define IsA(nodeptr, _type_)
Definition: nodes.h:576
#define linitial(l)
Definition: pg_list.h:195
#define IS_DUMMY_APPEND(p)
Definition: pathnodes.h:1380
List * pathlist
Definition: pathnodes.h:655
Datum subpath(PG_FUNCTION_ARGS)
Definition: ltree_op.c:241