diff options
author | Tom Lane | 2005-04-11 23:06:57 +0000 |
---|---|---|
committer | Tom Lane | 2005-04-11 23:06:57 +0000 |
commit | addc42c339208d6a7a1d652fbf388e8aea7f80b9 (patch) | |
tree | e349d31f2ae1006ed4078b811dae8d842e00d969 /src/include | |
parent | c3294f1cbfe02293b4a7c6b2e58ca4c09a7e541f (diff) |
Create the planner mechanism for optimizing simple MIN and MAX queries
into indexscans on matching indexes. For the moment, it only handles
int4 and text datatypes; next step is to add a column to pg_aggregate
so that all MIN/MAX aggregates can be handled. Per my recent proposal.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/optimizer/paths.h | 5 | ||||
-rw-r--r-- | src/include/optimizer/planmain.h | 8 | ||||
-rw-r--r-- | src/include/optimizer/subselect.h | 4 | ||||
-rw-r--r-- | src/include/utils/lsyscache.h | 3 |
4 files changed, 16 insertions, 4 deletions
diff --git a/src/include/optimizer/paths.h b/src/include/optimizer/paths.h index 28c44444d70..e5ca24807d0 100644 --- a/src/include/optimizer/paths.h +++ b/src/include/optimizer/paths.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/paths.h,v 1.80 2005/03/27 06:29:49 tgl Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/paths.h,v 1.81 2005/04/11 23:06:56 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -38,8 +38,11 @@ extern void debug_print_rel(Query *root, RelOptInfo *rel); extern void create_index_paths(Query *root, RelOptInfo *rel); extern Path *best_inner_indexscan(Query *root, RelOptInfo *rel, Relids outer_relids, JoinType jointype); +extern List *group_clauses_by_indexkey(IndexOptInfo *index); extern List *group_clauses_by_indexkey_for_or(IndexOptInfo *index, Expr *orsubclause); +extern bool match_index_to_operand(Node *operand, int indexcol, + IndexOptInfo *index); extern List *expand_indexqual_conditions(IndexOptInfo *index, List *clausegroups); extern void check_partial_indexes(Query *root, RelOptInfo *rel); diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h index e76d55ea496..f2a48e77c9e 100644 --- a/src/include/optimizer/planmain.h +++ b/src/include/optimizer/planmain.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/planmain.h,v 1.80 2005/03/10 23:21:25 tgl Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/planmain.h,v 1.81 2005/04/11 23:06:56 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -24,6 +24,12 @@ extern void query_planner(Query *root, List *tlist, double tuple_fraction, Path **cheapest_path, Path **sorted_path); /* + * prototypes for plan/planagg.c + */ +extern Plan *optimize_minmax_aggregates(Query *root, List *tlist, + Path *best_path); + +/* * prototypes for plan/createplan.c */ extern Plan *create_plan(Query *root, Path *best_path); diff --git a/src/include/optimizer/subselect.h b/src/include/optimizer/subselect.h index c07593ad48e..9381321a46f 100644 --- a/src/include/optimizer/subselect.h +++ b/src/include/optimizer/subselect.h @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/subselect.h,v 1.23 2004/12/31 22:03:36 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/subselect.h,v 1.24 2005/04/11 23:06:56 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -24,5 +24,7 @@ extern Node *convert_IN_to_join(Query *parse, SubLink *sublink); extern Node *SS_replace_correlation_vars(Node *expr); extern Node *SS_process_sublinks(Node *expr, bool isQual); extern void SS_finalize_plan(Plan *plan, List *rtable); +extern Param *SS_make_initplan_from_plan(Query *root, Plan *plan, + Oid resulttype, int32 resulttypmod); #endif /* SUBSELECT_H */ diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h index 845a886ba82..b98b53c60fc 100644 --- a/src/include/utils/lsyscache.h +++ b/src/include/utils/lsyscache.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/lsyscache.h,v 1.96 2005/03/31 22:46:27 tgl Exp $ + * $PostgreSQL: pgsql/src/include/utils/lsyscache.h,v 1.97 2005/04/11 23:06:56 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -25,6 +25,7 @@ typedef enum IOFuncSelector } IOFuncSelector; extern bool op_in_opclass(Oid opno, Oid opclass); +extern int get_op_opclass_strategy(Oid opno, Oid opclass); extern void get_op_opclass_properties(Oid opno, Oid opclass, int *strategy, Oid *subtype, bool *recheck); |