mirror of https://github.com/citusdata/citus.git
Columnar: add GUC to control qual pushdown. (#4586)
parent
62e0383150
commit
15297cab49
|
@ -76,6 +76,7 @@ static void ColumnarScan_ExplainCustomScan(CustomScanState *node, List *ancestor
|
||||||
static set_rel_pathlist_hook_type PreviousSetRelPathlistHook = NULL;
|
static set_rel_pathlist_hook_type PreviousSetRelPathlistHook = NULL;
|
||||||
|
|
||||||
static bool EnableColumnarCustomScan = true;
|
static bool EnableColumnarCustomScan = true;
|
||||||
|
static bool EnableColumnarQualPushdown = true;
|
||||||
|
|
||||||
|
|
||||||
const struct CustomPathMethods ColumnarScanPathMethods = {
|
const struct CustomPathMethods ColumnarScanPathMethods = {
|
||||||
|
@ -114,13 +115,23 @@ columnar_customscan_init()
|
||||||
DefineCustomBoolVariable(
|
DefineCustomBoolVariable(
|
||||||
"columnar.enable_custom_scan",
|
"columnar.enable_custom_scan",
|
||||||
gettext_noop("Enables the use of a custom scan to push projections and quals "
|
gettext_noop("Enables the use of a custom scan to push projections and quals "
|
||||||
"into the storage layer"),
|
"into the storage layer."),
|
||||||
NULL,
|
NULL,
|
||||||
&EnableColumnarCustomScan,
|
&EnableColumnarCustomScan,
|
||||||
true,
|
true,
|
||||||
PGC_USERSET,
|
PGC_USERSET,
|
||||||
GUC_NO_SHOW_ALL,
|
GUC_NO_SHOW_ALL,
|
||||||
NULL, NULL, NULL);
|
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;
|
CustomScanState *cscanstate = &columnarScanState->custom_scanstate;
|
||||||
cscanstate->methods = &ColumnarExecuteMethods;
|
cscanstate->methods = &ColumnarExecuteMethods;
|
||||||
|
|
||||||
|
if (EnableColumnarQualPushdown)
|
||||||
|
{
|
||||||
columnarScanState->qual = cscan->scan.plan.qual;
|
columnarScanState->qual = cscan->scan.plan.qual;
|
||||||
|
}
|
||||||
|
|
||||||
return (Node *) cscanstate;
|
return (Node *) cscanstate;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,10 @@ CREATE TABLE simple_chunk_filtering(i int) USING COLUMNAR;
|
||||||
INSERT INTO simple_chunk_filtering SELECT generate_series(0,234567);
|
INSERT INTO simple_chunk_filtering SELECT generate_series(0,234567);
|
||||||
EXPLAIN (analyze on, costs off, timing off, summary off)
|
EXPLAIN (analyze on, costs off, timing off, summary off)
|
||||||
SELECT * FROM simple_chunk_filtering WHERE i > 123456;
|
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
|
-- https://github.com/citusdata/citus/issues/4555
|
||||||
TRUNCATE simple_chunk_filtering;
|
TRUNCATE simple_chunk_filtering;
|
||||||
|
|
|
@ -130,6 +130,18 @@ EXPLAIN (analyze on, costs off, timing off, summary off)
|
||||||
Columnar Chunks Removed by Filter: 12
|
Columnar Chunks Removed by Filter: 12
|
||||||
(4 rows)
|
(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
|
-- https://github.com/citusdata/citus/issues/4555
|
||||||
TRUNCATE simple_chunk_filtering;
|
TRUNCATE simple_chunk_filtering;
|
||||||
INSERT INTO simple_chunk_filtering SELECT generate_series(0,200000);
|
INSERT INTO simple_chunk_filtering SELECT generate_series(0,200000);
|
||||||
|
|
Loading…
Reference in New Issue