code for Global-Partition-Index feature
Signed-off-by: xiliu <xiliu_h@163.com>
This commit is contained in:
@ -2770,18 +2770,40 @@ static void make_partiterator_pathkey(
|
||||
itrpath->direction = (BTLessStrategyNumber == pk_strategy ? ForwardScanDirection : BackwardScanDirection);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check scan path for partition table whether use global partition index
|
||||
*/
|
||||
static bool CheckPathUseGlobalPartIndex(Path* path)
|
||||
{
|
||||
if (path->pathtype == T_IndexScan || path->pathtype == T_IndexOnlyScan) {
|
||||
IndexPath* indexPath = (IndexPath*)path;
|
||||
if (indexPath->indexinfo->isGlobal) {
|
||||
return true;
|
||||
}
|
||||
} else if (path->pathtype == T_BitmapHeapScan) {
|
||||
BitmapHeapPath* bitmapHeapPath = (BitmapHeapPath*)path;
|
||||
if (CheckBitmapQualIsGlobalIndex(bitmapHeapPath->bitmapqual)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static Path* create_partiterator_path(PlannerInfo* root, RelOptInfo* rel, Path* path, Relation relation)
|
||||
{
|
||||
Path* result = NULL;
|
||||
|
||||
switch (path->pathtype) {
|
||||
case T_IndexScan:
|
||||
case T_IndexOnlyScan:
|
||||
case T_BitmapHeapScan:
|
||||
case T_SeqScan:
|
||||
case T_CStoreScan:
|
||||
case T_TsStoreScan:
|
||||
case T_BitmapHeapScan:
|
||||
case T_TidScan:
|
||||
case T_IndexScan:
|
||||
case T_IndexOnlyScan: {
|
||||
case T_TidScan: {
|
||||
PartIteratorPath* itrpath = makeNode(PartIteratorPath);
|
||||
|
||||
itrpath->subPath = path;
|
||||
@ -2848,6 +2870,11 @@ static void try_add_partiterator(PlannerInfo* root, RelOptInfo* rel, RangeTblEnt
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Use globa partition index */
|
||||
if (CheckPathUseGlobalPartIndex(path)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
itrPath = create_partiterator_path(root, rel, path, relation);
|
||||
|
||||
/* replace entry in pathlist */
|
||||
|
||||
Reference in New Issue
Block a user