diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-04-19 22:35:18 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-04-19 22:35:18 +0000 |
| commit | 4a8c5d0375f17d8d961a280cbb640996aaa8bf0d (patch) | |
| tree | d12840ac104b45911406a533274add8456300815 /src/backend/optimizer/path/costsize.c | |
| parent | 04ce41ca622c40c0501de1e31cf888f64f1736bf (diff) | |
| download | postgresql-4a8c5d0375f17d8d961a280cbb640996aaa8bf0d.tar.gz | |
Create executor and planner-backend support for decoupled heap and index
scans, using in-memory tuple ID bitmaps as the intermediary. The planner
frontend (path creation and cost estimation) is not there yet, so none
of this code can be executed. I have tested it using some hacked planner
code that is far too ugly to see the light of day, however. Committing
now so that the bulk of the infrastructure changes go in before the tree
drifts under me.
Diffstat (limited to 'src/backend/optimizer/path/costsize.c')
| -rw-r--r-- | src/backend/optimizer/path/costsize.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c index 967536393e..06ebe18fe7 100644 --- a/src/backend/optimizer/path/costsize.c +++ b/src/backend/optimizer/path/costsize.c @@ -49,7 +49,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.141 2005/04/04 01:43:12 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.142 2005/04/19 22:35:15 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -401,6 +401,36 @@ cost_index(Path *path, Query *root, } /* + * cost_bitmap_scan + * Determines and returns the cost of scanning a relation using a bitmap + * index-then-heap plan. + * + * 'root' is the query root + * 'baserel' is the relation to be scanned + * 'bitmapqual' is an AND/OR tree of IndexPaths for the component scans + * 'is_injoin' is T if we are considering using the scan as the inside + * of a nestloop join (hence, some of the quals are join clauses) + */ +void +cost_bitmap_scan(Path *path, Query *root, RelOptInfo *baserel, + Node *bitmapqual, bool is_injoin) +{ + Cost startup_cost = 0; + Cost run_cost = 0; + + /* Should only be applied to base relations */ + Assert(IsA(baserel, RelOptInfo)); + Assert(baserel->relid > 0); + Assert(baserel->rtekind == RTE_RELATION); + + /* XXX lots to do here */ + run_cost += 10; + + path->startup_cost = startup_cost; + path->total_cost = startup_cost + run_cost; +} + +/* * cost_tidscan * Determines and returns the cost of scanning a relation using TIDs. */ @@ -760,6 +790,8 @@ cost_nestloop(NestPath *path, Query *root) */ if (IsA(inner_path, IndexPath)) inner_path_rows = ((IndexPath *) inner_path)->rows; + else if (IsA(inner_path, BitmapHeapPath)) + inner_path_rows = ((BitmapHeapPath *) inner_path)->rows; if (!enable_nestloop) startup_cost += disable_cost; |
