1996-07-09 02:22:35 -04:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
*
|
1999-02-13 18:22:53 -05:00
|
|
|
* paths.h
|
2005-06-05 18:32:58 -04:00
|
|
|
* prototypes for various files in optimizer/path
|
1996-07-09 02:22:35 -04:00
|
|
|
*
|
|
|
|
|
*
|
2007-01-05 17:20:05 -05:00
|
|
|
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
2000-01-26 00:58:53 -05:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-07-09 02:22:35 -04:00
|
|
|
*
|
2007-01-05 17:20:05 -05:00
|
|
|
* $PostgreSQL: pgsql/src/include/optimizer/paths.h,v 1.94 2007/01/05 22:19:56 momjian Exp $
|
1996-07-09 02:22:35 -04:00
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
1997-09-07 01:04:48 -04:00
|
|
|
#ifndef PATHS_H
|
|
|
|
|
#define PATHS_H
|
1996-07-09 02:22:35 -04:00
|
|
|
|
1997-11-25 20:14:33 -05:00
|
|
|
#include "nodes/relation.h"
|
|
|
|
|
|
2003-01-23 22:58:44 -05:00
|
|
|
|
1996-07-09 02:22:35 -04:00
|
|
|
/*
|
1999-07-27 02:23:12 -04:00
|
|
|
* allpaths.c
|
1996-07-09 02:22:35 -04:00
|
|
|
*/
|
2000-01-22 18:50:30 -05:00
|
|
|
extern bool enable_geqo;
|
2003-01-25 18:10:30 -05:00
|
|
|
extern int geqo_threshold;
|
2000-01-22 18:50:30 -05:00
|
|
|
|
2005-12-19 21:30:36 -05:00
|
|
|
extern RelOptInfo *make_one_rel(PlannerInfo *root, List *joinlist);
|
1996-07-09 02:22:35 -04:00
|
|
|
|
2001-10-18 12:11:42 -04:00
|
|
|
#ifdef OPTIMIZER_DEBUG
|
2005-06-05 18:32:58 -04:00
|
|
|
extern void debug_print_rel(PlannerInfo *root, RelOptInfo *rel);
|
2001-10-18 12:11:42 -04:00
|
|
|
#endif
|
|
|
|
|
|
1996-07-09 02:22:35 -04:00
|
|
|
/*
|
1999-07-27 02:23:12 -04:00
|
|
|
* indxpath.c
|
1997-09-07 01:04:48 -04:00
|
|
|
* routines to generate index paths
|
1996-07-09 02:22:35 -04:00
|
|
|
*/
|
2005-11-25 14:47:50 -05:00
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
/* Whether to use ScalarArrayOpExpr to build index qualifications */
|
|
|
|
|
SAOP_FORBID, /* Do not use ScalarArrayOpExpr */
|
|
|
|
|
SAOP_ALLOW, /* OK to use ScalarArrayOpExpr */
|
|
|
|
|
SAOP_REQUIRE /* Require ScalarArrayOpExpr */
|
|
|
|
|
} SaOpControl;
|
|
|
|
|
|
2005-06-05 18:32:58 -04:00
|
|
|
extern void create_index_paths(PlannerInfo *root, RelOptInfo *rel);
|
|
|
|
|
extern List *generate_bitmap_or_paths(PlannerInfo *root, RelOptInfo *rel,
|
2005-04-24 21:30:14 -04:00
|
|
|
List *clauses, List *outer_clauses,
|
2006-06-06 13:59:58 -04:00
|
|
|
RelOptInfo *outer_rel);
|
2005-06-05 18:32:58 -04:00
|
|
|
extern Path *best_inner_indexscan(PlannerInfo *root, RelOptInfo *rel,
|
2006-06-06 13:59:58 -04:00
|
|
|
RelOptInfo *outer_rel, JoinType jointype);
|
2005-04-22 17:58:32 -04:00
|
|
|
extern List *group_clauses_by_indexkey(IndexOptInfo *index,
|
2005-10-14 22:49:52 -04:00
|
|
|
List *clauses, List *outer_clauses,
|
|
|
|
|
Relids outer_relids,
|
2005-11-25 14:47:50 -05:00
|
|
|
SaOpControl saop_control,
|
2005-10-14 22:49:52 -04:00
|
|
|
bool *found_clause);
|
2005-04-11 19:06:57 -04:00
|
|
|
extern bool match_index_to_operand(Node *operand, int indexcol,
|
|
|
|
|
IndexOptInfo *index);
|
2005-03-27 01:29:49 -05:00
|
|
|
extern List *expand_indexqual_conditions(IndexOptInfo *index,
|
2005-10-14 22:49:52 -04:00
|
|
|
List *clausegroups);
|
2005-06-05 18:32:58 -04:00
|
|
|
extern void check_partial_indexes(PlannerInfo *root, RelOptInfo *rel);
|
2004-01-05 18:39:54 -05:00
|
|
|
extern List *flatten_clausegroups_list(List *clausegroups);
|
1996-07-09 02:22:35 -04:00
|
|
|
|
2000-02-05 13:26:09 -05:00
|
|
|
/*
|
|
|
|
|
* orindxpath.c
|
|
|
|
|
* additional routines for indexable OR clauses
|
|
|
|
|
*/
|
2005-06-05 18:32:58 -04:00
|
|
|
extern bool create_or_index_quals(PlannerInfo *root, RelOptInfo *rel);
|
2000-02-05 13:26:09 -05:00
|
|
|
|
1999-11-23 15:07:06 -05:00
|
|
|
/*
|
|
|
|
|
* tidpath.h
|
|
|
|
|
* routines to generate tid paths
|
|
|
|
|
*/
|
2005-06-05 18:32:58 -04:00
|
|
|
extern void create_tidscan_paths(PlannerInfo *root, RelOptInfo *rel);
|
1999-11-23 15:07:06 -05:00
|
|
|
|
1996-07-09 02:22:35 -04:00
|
|
|
/*
|
1999-07-27 02:23:12 -04:00
|
|
|
* joinpath.c
|
1997-09-07 01:04:48 -04:00
|
|
|
* routines to create join paths
|
1996-07-09 02:22:35 -04:00
|
|
|
*/
|
2005-06-05 18:32:58 -04:00
|
|
|
extern void add_paths_to_joinrel(PlannerInfo *root, RelOptInfo *joinrel,
|
2001-03-21 23:01:46 -05:00
|
|
|
RelOptInfo *outerrel,
|
|
|
|
|
RelOptInfo *innerrel,
|
|
|
|
|
JoinType jointype,
|
|
|
|
|
List *restrictlist);
|
2000-02-06 23:41:04 -05:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* joinrels.c
|
|
|
|
|
* routines to determine which relations to join
|
|
|
|
|
*/
|
2005-06-05 18:32:58 -04:00
|
|
|
extern List *make_rels_by_joins(PlannerInfo *root, int level, List **joinrels);
|
|
|
|
|
extern RelOptInfo *make_join_rel(PlannerInfo *root,
|
2005-12-19 21:30:36 -05:00
|
|
|
RelOptInfo *rel1, RelOptInfo *rel2);
|
1997-09-07 01:04:48 -04:00
|
|
|
|
1996-07-09 02:22:35 -04:00
|
|
|
/*
|
1999-08-15 22:17:58 -04:00
|
|
|
* pathkeys.c
|
|
|
|
|
* utilities for matching and building path keys
|
1996-07-09 02:22:35 -04:00
|
|
|
*/
|
1999-08-15 22:17:58 -04:00
|
|
|
typedef enum
|
|
|
|
|
{
|
2001-10-28 01:26:15 -05:00
|
|
|
PATHKEYS_EQUAL, /* pathkeys are identical */
|
|
|
|
|
PATHKEYS_BETTER1, /* pathkey 1 is a superset of pathkey 2 */
|
|
|
|
|
PATHKEYS_BETTER2, /* vice versa */
|
|
|
|
|
PATHKEYS_DIFFERENT /* neither pathkey includes the other */
|
1999-08-15 22:17:58 -04:00
|
|
|
} PathKeysComparison;
|
1996-07-09 02:22:35 -04:00
|
|
|
|
2005-06-05 18:32:58 -04:00
|
|
|
extern void add_equijoined_keys(PlannerInfo *root, RestrictInfo *restrictinfo);
|
|
|
|
|
extern bool exprs_known_equal(PlannerInfo *root, Node *item1, Node *item2);
|
|
|
|
|
extern void generate_implied_equalities(PlannerInfo *root);
|
|
|
|
|
extern List *canonicalize_pathkeys(PlannerInfo *root, List *pathkeys);
|
1999-08-15 22:17:58 -04:00
|
|
|
extern PathKeysComparison compare_pathkeys(List *keys1, List *keys2);
|
|
|
|
|
extern bool pathkeys_contained_in(List *keys1, List *keys2);
|
1999-08-20 23:49:17 -04:00
|
|
|
extern Path *get_cheapest_path_for_pathkeys(List *paths, List *pathkeys,
|
2000-04-12 13:17:23 -04:00
|
|
|
CostSelector cost_criterion);
|
2000-02-15 15:49:31 -05:00
|
|
|
extern Path *get_cheapest_fractional_path_for_pathkeys(List *paths,
|
2000-04-12 13:17:23 -04:00
|
|
|
List *pathkeys,
|
|
|
|
|
double fraction);
|
2005-06-05 18:32:58 -04:00
|
|
|
extern List *build_index_pathkeys(PlannerInfo *root, IndexOptInfo *index,
|
2006-01-29 12:27:42 -05:00
|
|
|
ScanDirection scandir, bool canonical);
|
2005-06-05 18:32:58 -04:00
|
|
|
extern List *convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel,
|
2005-10-14 22:49:52 -04:00
|
|
|
List *subquery_pathkeys);
|
2005-06-05 18:32:58 -04:00
|
|
|
extern List *build_join_pathkeys(PlannerInfo *root,
|
2001-03-21 23:01:46 -05:00
|
|
|
RelOptInfo *joinrel,
|
2005-01-22 21:21:36 -05:00
|
|
|
JoinType jointype,
|
2001-03-21 23:01:46 -05:00
|
|
|
List *outer_pathkeys);
|
1999-08-20 23:49:17 -04:00
|
|
|
extern List *make_pathkeys_for_sortclauses(List *sortclauses,
|
2000-04-12 13:17:23 -04:00
|
|
|
List *tlist);
|
2005-06-05 18:32:58 -04:00
|
|
|
extern void cache_mergeclause_pathkeys(PlannerInfo *root,
|
2001-10-25 01:50:21 -04:00
|
|
|
RestrictInfo *restrictinfo);
|
2005-06-05 18:32:58 -04:00
|
|
|
extern List *find_mergeclauses_for_pathkeys(PlannerInfo *root,
|
2001-03-21 23:01:46 -05:00
|
|
|
List *pathkeys,
|
|
|
|
|
List *restrictinfos);
|
2005-06-05 18:32:58 -04:00
|
|
|
extern List *make_pathkeys_for_mergeclauses(PlannerInfo *root,
|
2001-03-21 23:01:46 -05:00
|
|
|
List *mergeclauses,
|
|
|
|
|
RelOptInfo *rel);
|
2005-06-05 18:32:58 -04:00
|
|
|
extern int pathkeys_useful_for_merging(PlannerInfo *root,
|
2001-03-21 23:01:46 -05:00
|
|
|
RelOptInfo *rel,
|
|
|
|
|
List *pathkeys);
|
2005-06-05 18:32:58 -04:00
|
|
|
extern int pathkeys_useful_for_ordering(PlannerInfo *root, List *pathkeys);
|
|
|
|
|
extern List *truncate_useless_pathkeys(PlannerInfo *root,
|
2001-03-21 23:01:46 -05:00
|
|
|
RelOptInfo *rel,
|
|
|
|
|
List *pathkeys);
|
2001-10-28 01:26:15 -05:00
|
|
|
|
2001-11-05 12:46:40 -05:00
|
|
|
#endif /* PATHS_H */
|