mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-06 12:59:20 +02:00
which comparison operators to use for plan nodes involving tuple comparison (Agg, Group, Unique, SetOp). Formerly the executor looked up the default equality operator for the datatype, which was really pretty shaky, since it's possible that the data being fed to the node is sorted according to some nondefault operator class that could have an incompatible idea of equality. The planner knows what it has sorted by and therefore can provide the right equality operator to use. Also, this change moves a couple of catalog lookups out of the executor and into the planner, which should help startup time for pre-planned queries by some small amount. Modify the planner to remove some other cavalier assumptions about always being able to use the default operators. Also add "nulls first/last" info to the Plan node for a mergejoin --- neither the executor nor the planner can cope yet, but at least the API is in place.
90 lines
3.1 KiB
C
90 lines
3.1 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* planmain.h
|
|
* prototypes for various files in optimizer/plan
|
|
*
|
|
*
|
|
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* $PostgreSQL: pgsql/src/include/optimizer/planmain.h,v 1.97 2007/01/10 18:06:04 tgl Exp $
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef PLANMAIN_H
|
|
#define PLANMAIN_H
|
|
|
|
#include "nodes/plannodes.h"
|
|
#include "nodes/relation.h"
|
|
|
|
/*
|
|
* prototypes for plan/planmain.c
|
|
*/
|
|
extern void query_planner(PlannerInfo *root, List *tlist,
|
|
double tuple_fraction,
|
|
Path **cheapest_path, Path **sorted_path,
|
|
double *num_groups);
|
|
|
|
/*
|
|
* prototypes for plan/planagg.c
|
|
*/
|
|
extern Plan *optimize_minmax_aggregates(PlannerInfo *root, List *tlist,
|
|
Path *best_path);
|
|
|
|
/*
|
|
* prototypes for plan/createplan.c
|
|
*/
|
|
extern Plan *create_plan(PlannerInfo *root, Path *best_path);
|
|
extern SubqueryScan *make_subqueryscan(List *qptlist, List *qpqual,
|
|
Index scanrelid, Plan *subplan);
|
|
extern Append *make_append(List *appendplans, bool isTarget, List *tlist);
|
|
extern Sort *make_sort_from_sortclauses(PlannerInfo *root, List *sortcls,
|
|
Plan *lefttree);
|
|
extern Sort *make_sort_from_groupcols(PlannerInfo *root, List *groupcls,
|
|
AttrNumber *grpColIdx, Plan *lefttree);
|
|
extern Agg *make_agg(PlannerInfo *root, List *tlist, List *qual,
|
|
AggStrategy aggstrategy,
|
|
int numGroupCols, AttrNumber *grpColIdx, Oid *grpOperators,
|
|
long numGroups, int numAggs,
|
|
Plan *lefttree);
|
|
extern Group *make_group(PlannerInfo *root, List *tlist, List *qual,
|
|
int numGroupCols, AttrNumber *grpColIdx, Oid *grpOperators,
|
|
double numGroups,
|
|
Plan *lefttree);
|
|
extern Material *make_material(Plan *lefttree);
|
|
extern Plan *materialize_finished_plan(Plan *subplan);
|
|
extern Unique *make_unique(Plan *lefttree, List *distinctList);
|
|
extern Limit *make_limit(Plan *lefttree, Node *limitOffset, Node *limitCount,
|
|
int64 offset_est, int64 count_est);
|
|
extern SetOp *make_setop(SetOpCmd cmd, Plan *lefttree,
|
|
List *distinctList, AttrNumber flagColIdx);
|
|
extern Result *make_result(List *tlist, Node *resconstantqual, Plan *subplan);
|
|
extern bool is_projection_capable_plan(Plan *plan);
|
|
|
|
/*
|
|
* prototypes for plan/initsplan.c
|
|
*/
|
|
extern int from_collapse_limit;
|
|
extern int join_collapse_limit;
|
|
|
|
extern void add_base_rels_to_query(PlannerInfo *root, Node *jtnode);
|
|
extern void build_base_rel_tlists(PlannerInfo *root, List *final_tlist);
|
|
extern List *deconstruct_jointree(PlannerInfo *root);
|
|
extern void process_implied_equality(PlannerInfo *root,
|
|
Node *item1, Node *item2,
|
|
Oid sortop1, Oid sortop2,
|
|
Relids item1_relids, Relids item2_relids,
|
|
bool delete_it);
|
|
|
|
/*
|
|
* prototypes for plan/setrefs.c
|
|
*/
|
|
extern Plan *set_plan_references(Plan *plan, List *rtable);
|
|
extern List *set_returning_clause_references(List *rlist,
|
|
Plan *topplan,
|
|
Index resultRelation);
|
|
extern void fix_opfuncids(Node *node);
|
|
extern void set_opfuncid(OpExpr *opexpr);
|
|
|
|
#endif /* PLANMAIN_H */
|