Skip to content

Conversation

gongxun0928
Copy link
Contributor

when seq scan begins, check whether the scanflags of table am is set to determine whether the runtime filter is pushed down.

When the runtime filter is pushed down to pax am, pax am converts the min/max scankey in the runtime filter into PFTNode and performs min/max filtering.

CREATE TABLE t1(c1 int, c2 int, c3 int, c4 int, c5 int) using pax with(minmax_columns='c1,c2');
insert into t1 select i,i,i,i,i from generate_series(1,10000000) i;
analyze t1;

CREATE TABLE t2(c1 int, c2 int, c3 int, c4 int, c5 int) with (appendonly=true, orientation=column) distributed REPLICATED;
INSERT INTO t2 VALUES (1,1,1,1,1), (2,2,2,2,2), (3,3,3,3,3), (4,4,4,4,4);
INSERT INTO t2 select * FROM t2;
INSERT INTO t2 select * FROM t2;
INSERT INTO t2 select * FROM t2;

set gp_enable_runtime_filter_pushdown to off;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
SELECT t1.c3 FROM t1, t2 WHERE t1.c2 = t2.c2;
                                    QUERY PLAN
----------------------------------------------------------------------------------
 Gather Motion 1:1  (slice1; segments: 1) (actual rows=32 loops=1)
   ->  Hash Join (actual rows=32 loops=1)
         Hash Cond: (t1.c2 = t2.c2)
         Extra Text: Hash chain length 8.0 avg, 8 max, using 4 of 524288 buckets.
         ->  Seq Scan on t1 (actual rows=10000000 loops=1)
         ->  Hash (actual rows=32 loops=1)
               Buckets: 524288  Batches: 1  Memory Usage: 4098kB
               ->  Seq Scan on t2 (actual rows=32 loops=1)
 Optimizer: GPORCA
(9 rows)

Time: 1576.548 ms (00:01.577)

gpadmin=# set gp_enable_runtime_filter_pushdown to on;
SET
Time: 0.362 ms
gpadmin=# EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
SELECT t1.c3 FROM t1, t2 WHERE t1.c2 = t2.c2;
                                    QUERY PLAN
----------------------------------------------------------------------------------
 Gather Motion 1:1  (slice1; segments: 1) (actual rows=32 loops=1)
   ->  Hash Join (actual rows=32 loops=1)
         Hash Cond: (t1.c2 = t2.c2)
         Extra Text: Hash chain length 8.0 avg, 8 max, using 4 of 524288 buckets.
         ->  Seq Scan on t1 (actual rows=131072 loops=1)
         ->  Hash (actual rows=32 loops=1)
               Buckets: 524288  Batches: 1  Memory Usage: 4098kB
               ->  Seq Scan on t2 (actual rows=32 loops=1)
 Optimizer: GPORCA
(9 rows)

Time: 38.471 ms

Fixes #ISSUE_Number

What does this PR do?

Type of Change

  • Bug fix (non-breaking change)
  • New feature (non-breaking change)
  • Breaking change (fix or feature with breaking changes)
  • Documentation update

Breaking Changes

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Passed make installcheck
  • Passed make -C src/test installcheck-cbdb-parallel

Impact

Performance:

User-facing changes:

Dependencies:

Checklist

Additional Context

CI Skip Instructions


@gongxun0928 gongxun0928 changed the title feat: support runtime filter push down to Table AM feat: support pushdown the runtime filter to Table AM Aug 22, 2025
@gongxun0928 gongxun0928 changed the title feat: support pushdown the runtime filter to Table AM feat: pushdown the runtime filter to Table AM Aug 22, 2025
@gongxun0928 gongxun0928 force-pushed the pax/support-runtime-filter-pushdown branch from a70e655 to 3c3317e Compare September 2, 2025 02:14
when seq scan begins, check whether the scanflags of table am is set to
determine whether the runtime filter is pushed down.

When the runtime filter is pushed down to pax am, pax am converts the min/max
scankey in the runtime filter into PFTNode and performs min/max filtering.
@gongxun0928 gongxun0928 force-pushed the pax/support-runtime-filter-pushdown branch from 3c3317e to a0316f5 Compare September 2, 2025 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants