Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Index scan #205

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions columnar/src/backend/columnar/columnar.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ bool columnar_enable_vectorization = true;
bool columnar_enable_dml = true;
bool columnar_enable_page_cache = true;
int columnar_page_cache_size = 200U;
bool columnar_index_scan = false;

static const struct config_enum_entry columnar_compression_options[] =
{
Expand Down Expand Up @@ -195,6 +196,17 @@ columnar_guc_init()
NULL,
NULL,
NULL);

DefineCustomBoolVariable("columnar.enable_columnar_index_scan",
gettext_noop("Enables custom columnar index scan"),
NULL,
&columnar_index_scan,
false,
PGC_USERSET,
GUC_NO_SHOW_ALL,
NULL,
NULL,
NULL);
}


Expand Down
13 changes: 8 additions & 5 deletions columnar/src/backend/columnar/columnar_customscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ static List * set_deparse_context_planstate(List *dpcontext, Node *node,

/* other helpers */
static List * ColumnarVarNeeded(ColumnarScanState *columnarScanState);
static Bitmapset * ColumnarAttrNeeded(ScanState *ss, List *customList);
static bool IsCreateTableAs(const char *query);

/* saved hook value in case of unload */
Expand Down Expand Up @@ -608,9 +607,13 @@ CostColumnarIndexPath(PlannerInfo *root, RelOptInfo *rel, Oid relationId,
* instead of overwriting total cost, we "add" ours to the cost estimated
* by indexAM since we should consider index traversal related costs too.
*/
Cost columnarIndexScanCost = ColumnarIndexScanAdditionalCost(root, rel, relationId,
indexPath);
indexPath->path.total_cost += columnarIndexScanCost;

if (!columnar_index_scan)
{
Cost columnarIndexScanCost = ColumnarIndexScanAdditionalCost(root, rel, relationId,
indexPath);
indexPath->path.total_cost += columnarIndexScanCost;
}

ereport(DEBUG4, (errmsg("columnar table index scan costs re-estimated "
"by columnarAM (including indexAM costs): "
Expand Down Expand Up @@ -1986,7 +1989,7 @@ ColumnarScan_BeginCustomScan(CustomScanState *cscanstate, EState *estate, int ef
* Throws an error if finds a Var referencing to an attribute not supported
* by ColumnarScan.
*/
static Bitmapset *
Bitmapset *
ColumnarAttrNeeded(ScanState *ss, List *customList)
{
TupleTableSlot *slot = ss->ss_ScanTupleSlot;
Expand Down
Loading