mirror of
https://github.com/postgres/postgres.git
synced 2025-07-26 01:22:12 +03:00
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.
This commit is contained in:
@ -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;
|
||||
|
@ -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 $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -400,6 +400,36 @@ cost_index(Path *path, Query *root,
|
||||
path->total_cost = startup_cost + run_cost;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user