Columnar: add GUC to control qual pushdown. (#4586)

pull/4581/head
jeff-davis 2021-01-27 09:57:40 -08:00 committed by GitHub
parent 62e0383150
commit 15297cab49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 2 deletions

View File

@ -76,6 +76,7 @@ static void ColumnarScan_ExplainCustomScan(CustomScanState *node, List *ancestor
static set_rel_pathlist_hook_type PreviousSetRelPathlistHook = NULL;
static bool EnableColumnarCustomScan = true;
static bool EnableColumnarQualPushdown = true;
const struct CustomPathMethods ColumnarScanPathMethods = {
@ -114,13 +115,23 @@ columnar_customscan_init()
DefineCustomBoolVariable(
"columnar.enable_custom_scan",
gettext_noop("Enables the use of a custom scan to push projections and quals "
"into the storage layer"),
"into the storage layer."),
NULL,
&EnableColumnarCustomScan,
true,
PGC_USERSET,
GUC_NO_SHOW_ALL,
NULL, NULL, NULL);
DefineCustomBoolVariable(
"columnar.enable_qual_pushdown",
gettext_noop("Enables qual pushdown into columnar. This has no effect unless "
"columnar.enable_custom_scan is true."),
NULL,
&EnableColumnarQualPushdown,
true,
PGC_USERSET,
GUC_NO_SHOW_ALL,
NULL, NULL, NULL);
}
@ -294,7 +305,10 @@ ColumnarScan_CreateCustomScanState(CustomScan *cscan)
CustomScanState *cscanstate = &columnarScanState->custom_scanstate;
cscanstate->methods = &ColumnarExecuteMethods;
if (EnableColumnarQualPushdown)
{
columnarScanState->qual = cscan->scan.plan.qual;
}
return (Node *) cscanstate;
}

View File

@ -76,6 +76,10 @@ CREATE TABLE simple_chunk_filtering(i int) USING COLUMNAR;
INSERT INTO simple_chunk_filtering SELECT generate_series(0,234567);
EXPLAIN (analyze on, costs off, timing off, summary off)
SELECT * FROM simple_chunk_filtering WHERE i > 123456;
SET columnar.enable_qual_pushdown = false;
EXPLAIN (analyze on, costs off, timing off, summary off)
SELECT * FROM simple_chunk_filtering WHERE i > 123456;
SET columnar.enable_qual_pushdown TO DEFAULT;
-- https://github.com/citusdata/citus/issues/4555
TRUNCATE simple_chunk_filtering;

View File

@ -130,6 +130,18 @@ EXPLAIN (analyze on, costs off, timing off, summary off)
Columnar Chunks Removed by Filter: 12
(4 rows)
SET columnar.enable_qual_pushdown = false;
EXPLAIN (analyze on, costs off, timing off, summary off)
SELECT * FROM simple_chunk_filtering WHERE i > 123456;
QUERY PLAN
---------------------------------------------------------------------
Custom Scan (ColumnarScan) on simple_chunk_filtering (actual rows=111111 loops=1)
Filter: (i > 123456)
Rows Removed by Filter: 123457
Columnar Chunks Removed by Filter: 0
(4 rows)
SET columnar.enable_qual_pushdown TO DEFAULT;
-- https://github.com/citusdata/citus/issues/4555
TRUNCATE simple_chunk_filtering;
INSERT INTO simple_chunk_filtering SELECT generate_series(0,200000);