diff options
Diffstat (limited to 'src/include/nodes/relation.h')
-rw-r--r-- | src/include/nodes/relation.h | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index cf48ba433c8..45ca52e516e 100644 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -449,6 +449,10 @@ typedef struct RelOptInfo * The indexprs and indpred expressions have been run through * prepqual.c and eval_const_expressions() for ease of matching to * WHERE clauses. indpred is in implicit-AND form. + * + * indextlist is a TargetEntry list representing the index columns. + * It provides an equivalent base-relation Var for each simple column, + * and links to the matching indexprs element for each expression column. */ typedef struct IndexOptInfo { @@ -478,6 +482,8 @@ typedef struct IndexOptInfo List *indexprs; /* expressions for non-simple index columns */ List *indpred; /* predicate if a partial index, else NIL */ + List *indextlist; /* targetlist representing index columns */ + bool predOK; /* true if predicate matches query */ bool unique; /* true if a unique index */ bool hypothetical; /* true if index doesn't really exist */ @@ -640,6 +646,9 @@ typedef struct Path /*---------- * IndexPath represents an index scan over a single index. * + * This struct is used for both regular indexscans and index-only scans; + * path.pathtype is T_IndexScan or T_IndexOnlyScan to show which is meant. + * * 'indexinfo' is the index to be scanned. * * 'indexclauses' is a list of index qualification clauses, with implicit @@ -673,14 +682,10 @@ typedef struct Path * NoMovementScanDirection for an indexscan, but the planner wants to * distinguish ordered from unordered indexes for building pathkeys.) * - * 'indexonly' is TRUE for an index-only scan, that is, the index's access - * method has amcanreturn = TRUE and we only need columns available from the - * index. - * * 'indextotalcost' and 'indexselectivity' are saved in the IndexPath so that * we need not recompute them when considering using the same index in a * bitmap index/heap scan (see BitmapHeapPath). The costs of the IndexPath - * itself represent the costs of an IndexScan plan type. + * itself represent the costs of an IndexScan or IndexOnlyScan plan type. * * 'rows' is the estimated result tuple count for the indexscan. This * is the same as path.parent->rows for a simple indexscan, but it is @@ -698,7 +703,6 @@ typedef struct IndexPath List *indexorderbys; bool isjoininner; ScanDirection indexscandir; - bool indexonly; Cost indextotalcost; Selectivity indexselectivity; double rows; /* estimated number of result tuples */ @@ -714,11 +718,12 @@ typedef struct IndexPath * The individual indexscans are represented by IndexPath nodes, and any * logic on top of them is represented by a tree of BitmapAndPath and * BitmapOrPath nodes. Notice that we can use the same IndexPath node both - * to represent a regular IndexScan plan, and as the child of a BitmapHeapPath - * that represents scanning the same index using a BitmapIndexScan. The - * startup_cost and total_cost figures of an IndexPath always represent the - * costs to use it as a regular IndexScan. The costs of a BitmapIndexScan - * can be computed using the IndexPath's indextotalcost and indexselectivity. + * to represent a regular (or index-only) index scan plan, and as the child + * of a BitmapHeapPath that represents scanning the same index using a + * BitmapIndexScan. The startup_cost and total_cost figures of an IndexPath + * always represent the costs to use it as a regular (or index-only) + * IndexScan. The costs of a BitmapIndexScan can be computed using the + * IndexPath's indextotalcost and indexselectivity. * * BitmapHeapPaths can be nestloop inner indexscans. The isjoininner and * rows fields serve the same purpose as for plain IndexPaths. |