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 | |
parent | 04ce41ca622c40c0501de1e31cf888f64f1736bf (diff) | |
download | postgresql-4a8c5d0375f17d8d961a280cbb640996aaa8bf0d.tar.gz postgresql-4a8c5d0375f17d8d961a280cbb640996aaa8bf0d.zip |
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')
-rw-r--r-- | src/backend/optimizer/path/allpaths.c | 5 | ||||
-rw-r--r-- | src/backend/optimizer/path/costsize.c | 34 | ||||
-rw-r--r-- | src/backend/optimizer/path/joinpath.c | 3 |
3 files changed, 39 insertions, 3 deletions
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c index 16513108450..dc5091c69af 100644 --- a/src/backend/optimizer/path/allpaths.c +++ b/src/backend/optimizer/path/allpaths.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.125 2005/04/06 16:34:05 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.126 2005/04/19 22:35:15 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -898,6 +898,9 @@ print_path(Query *root, Path *path, int indent) case T_IndexPath: ptype = "IdxScan"; break; + case T_BitmapHeapPath: + ptype = "BitmapHeapScan"; + break; case T_TidPath: ptype = "TidScan"; break; diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c index 967536393ee..06ebe18fe78 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; diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c index 97e4d7dda87..b75cb6128d7 100644 --- a/src/backend/optimizer/path/joinpath.c +++ b/src/backend/optimizer/path/joinpath.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/path/joinpath.c,v 1.92 2005/01/23 02:21:26 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/path/joinpath.c,v 1.93 2005/04/19 22:35:15 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -391,6 +391,7 @@ match_unsorted_outer(Query *root, * waste of time.) */ if (!(IsA(inner_cheapest_total, IndexPath) || + IsA(inner_cheapest_total, BitmapHeapPath) || IsA(inner_cheapest_total, TidPath))) matpath = (Path *) create_material_path(innerrel, inner_cheapest_total); |