diff options
author | Tom Lane | 2011-12-25 00:03:21 +0000 |
---|---|---|
committer | Tom Lane | 2011-12-25 00:03:21 +0000 |
commit | 472d3935a2793343e450ba7cda4adbc323a984c3 (patch) | |
tree | 30fc6e85cc76a7b48ff84243237ccdc1dd41a00b /src/include/optimizer | |
parent | e2c2c2e8b1df7dfdb01e7e6f6191a569ce3c3195 (diff) |
In commit e2c2c2e8b1df7dfdb01e7e6f6191a569ce3c3195 I made use of nested
list structures to show which clauses went with which index columns, but
on reflection that's a data structure that only an old-line Lisp hacker
could love. Worse, it adds unnecessary complication to the many places
that don't much care which clauses go with which index columns. Revert
to the previous arrangement of flat lists of clauses, and instead add a
parallel integer list of column numbers. The places that care about the
pairing can chase both lists with forboth(), while the places that don't
care just examine one list the same as before.
The only real downside to this is that there are now two more lists that
need to be passed to amcostestimate functions in case they care about
column matching (which btcostestimate does, so not passing the info is not
an option). Rather than deal with 11-argument amcostestimate functions,
pass just the IndexPath and expect the functions to extract fields from it.
That gets us down to 7 arguments which is better than 11, and it seems
more future-proof against likely additions to the information we keep
about an index path.
Diffstat (limited to 'src/include/optimizer')
-rw-r--r-- | src/include/optimizer/cost.h | 5 | ||||
-rw-r--r-- | src/include/optimizer/pathnode.h | 4 | ||||
-rw-r--r-- | src/include/optimizer/paths.h | 7 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h index 125808ae98..6c56439f10 100644 --- a/src/include/optimizer/cost.h +++ b/src/include/optimizer/cost.h @@ -67,9 +67,8 @@ extern double clamp_row_est(double nrows); extern double index_pages_fetched(double tuples_fetched, BlockNumber pages, double index_pages, PlannerInfo *root); extern void cost_seqscan(Path *path, PlannerInfo *root, RelOptInfo *baserel); -extern void cost_index(IndexPath *path, PlannerInfo *root, IndexOptInfo *index, - List *indexQuals, List *indexOrderBys, - bool indexonly, RelOptInfo *outer_rel); +extern void cost_index(IndexPath *path, PlannerInfo *root, + RelOptInfo *outer_rel); extern void cost_bitmap_heap_scan(Path *path, PlannerInfo *root, RelOptInfo *baserel, Path *bitmapqual, RelOptInfo *outer_rel); extern void cost_bitmap_and_node(BitmapAndPath *path, PlannerInfo *root); diff --git a/src/include/optimizer/pathnode.h b/src/include/optimizer/pathnode.h index 38c8c1c9a3..8eec2ac596 100644 --- a/src/include/optimizer/pathnode.h +++ b/src/include/optimizer/pathnode.h @@ -30,8 +30,10 @@ extern void add_path(RelOptInfo *parent_rel, Path *new_path); extern Path *create_seqscan_path(PlannerInfo *root, RelOptInfo *rel); extern IndexPath *create_index_path(PlannerInfo *root, IndexOptInfo *index, - List *clause_groups, + List *indexclauses, + List *indexclausecols, List *indexorderbys, + List *indexorderbycols, List *pathkeys, ScanDirection indexscandir, bool indexonly, diff --git a/src/include/optimizer/paths.h b/src/include/optimizer/paths.h index b0075d7865..2fa862fb6f 100644 --- a/src/include/optimizer/paths.h +++ b/src/include/optimizer/paths.h @@ -57,11 +57,10 @@ extern bool eclass_matches_any_index(EquivalenceClass *ec, RelOptInfo *rel); extern bool match_index_to_operand(Node *operand, int indexcol, IndexOptInfo *index); -extern List *expand_indexqual_conditions(IndexOptInfo *index, - List *clausegroups); +extern void expand_indexqual_conditions(IndexOptInfo *index, + List *indexclauses, List *indexclausecols, + List **indexquals_p, List **indexqualcols_p); extern void check_partial_indexes(PlannerInfo *root, RelOptInfo *rel); -extern List *flatten_clausegroups_list(List *clausegroups); -extern List *flatten_indexorderbys_list(List *indexorderbys); extern Expr *adjust_rowcompare_for_index(RowCompareExpr *clause, IndexOptInfo *index, int indexcol, |