Skip to content

feat: Add selectivity-tracking wrapper for dynamic filters#20160

Draft
adriangb wants to merge 13 commits intoapache:mainfrom
pydantic:dynamic-dynamic-filters
Draft

feat: Add selectivity-tracking wrapper for dynamic filters#20160
adriangb wants to merge 13 commits intoapache:mainfrom
pydantic:dynamic-dynamic-filters

Conversation

@adriangb
Copy link
Contributor

@adriangb adriangb commented Feb 5, 2026

Summary

Add SelectivityAwareFilterExpr, a wrapper PhysicalExpr that tracks filter selectivity at runtime and automatically disables filters that aren't pruning enough rows. This addresses the issue where dynamic filters from HashJoinExec can be expensive to evaluate for little benefit when the build side covers most of the probe side values.

Key Features

  • Selectivity threshold: Filter disabled when rows_passed / rows_total >= threshold
  • Minimum rows: Statistics collected for min_rows before making a decision
  • Generation-aware reset: Resets when inner filter updates (e.g., hash table built)
  • Permanent disable: Once disabled, stays disabled for rest of query
  • Disabled behavior: Returns all-true array to bypass filter evaluation

New Configuration Options

Added to OptimizerOptions:

  • enable_dynamic_filter_selectivity_tracking (default: false)
  • dynamic_filter_selectivity_threshold (default: 0.95)
  • dynamic_filter_min_rows_for_selectivity (default: 10000)

Files Changed

File Changes
datafusion/physical-expr/src/expressions/selectivity_aware_filter.rs NEW - Core wrapper implementation
datafusion/physical-expr/src/expressions/mod.rs Add module and re-export
datafusion/common/src/config.rs Add 3 new config options to OptimizerOptions
datafusion/physical-plan/src/joins/hash_join/exec.rs Wrap dynamic filter with selectivity tracker
datafusion/sqllogictest/test_files/dynamic_filter_pushdown_config.slt Add integration tests

Test plan

  • Unit tests for SelectivityAwareFilterExpr (6 tests)
  • Hash join tests (367 tests pass)
  • SQL logic tests for config options
  • Verify queries return correct results with selectivity tracking enabled

🤖 Generated with Claude Code

@github-actions github-actions bot added physical-expr Changes to the physical-expr crates sqllogictest SQL Logic Tests (.slt) common Related to common crate physical-plan Changes to the physical-plan crate labels Feb 5, 2026
@adriangb adriangb force-pushed the dynamic-dynamic-filters branch from 8ccef6c to 9a1ebd9 Compare February 5, 2026 11:33
Comment on lines 1118 to 1144
/// Enable selectivity-based disabling of dynamic filters from joins.
///
/// When enabled, join dynamic filters that pass most rows (above the threshold)
/// will be automatically disabled to avoid evaluation overhead. This is useful
/// when the build side of a join covers most of the probe side values, making
/// the filter expensive to evaluate for little benefit.
///
/// The selectivity tracking resets when the dynamic filter is updated (e.g., when
/// the hash table is built), allowing the filter to be re-evaluated with new data.
pub enable_dynamic_filter_selectivity_tracking: bool, default = false

/// Selectivity threshold for disabling join dynamic filters.
///
/// If the filter passes this fraction or more of rows, it will be disabled.
/// Value should be between 0.0 and 1.0.
///
/// For example, 0.95 means if 95% or more of rows pass the filter, it will be disabled.
/// Only used when `enable_dynamic_filter_selectivity_tracking` is true.
pub dynamic_filter_selectivity_threshold: f64, default = 0.95

/// Minimum number of rows to process before making a selectivity decision
/// for join dynamic filters.
///
/// The filter will remain in a tracking state until this many rows have been
/// processed. This ensures statistical stability before making the disable decision.
/// Only used when `enable_dynamic_filter_selectivity_tracking` is true.
pub dynamic_filter_min_rows_for_selectivity: usize, default = 10_000
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure we need all of these, or at least not sure they should be prefixed with dynamic_filter

pub struct SelectivityConfig {
/// Threshold above which the filter is disabled (e.g., 0.95 = 95% selectivity).
/// If the filter passes this fraction or more of rows, it will be disabled.
pub threshold: f64,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be in GB/s? Rows/s?

/// If the filter passes this fraction or more of rows, it will be disabled.
pub threshold: f64,
/// Minimum rows to process before making a selectivity decision.
pub min_rows: usize,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be in GB? Number of batches? Time? (or all of the above?)

@adriangb
Copy link
Contributor Author

adriangb commented Feb 5, 2026

run benchmark tpchds tpch

@adriangb
Copy link
Contributor Author

adriangb commented Feb 5, 2026

run benchmark tpchds tpch tpch10

@adriangb
Copy link
Contributor Author

adriangb commented Feb 5, 2026

run benchmarks

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Feb 5, 2026
@adriangb
Copy link
Contributor Author

adriangb commented Feb 5, 2026

show benchmark queue

@Dandandan
Copy link
Contributor

Dandandan commented Feb 5, 2026

run benchmark tpcds

@Dandandan
Copy link
Contributor

run benchmark tpch

@alamb-ghbot
Copy link

🤖 ./gh_compare_branch.sh gh_compare_branch.sh Running
Linux aal-dev 6.14.0-1018-gcp #19~24.04.1-Ubuntu SMP Wed Sep 24 23:23:09 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing dynamic-dynamic-filters (bd95912) to c92ba29 diff using: tpcds
Results will be posted here when complete

@alamb-ghbot
Copy link

🤖: Benchmark completed

Details

Comparing HEAD and dynamic-dynamic-filters
--------------------
Benchmark tpcds_sf1.json
--------------------
┏━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query     ┃        HEAD ┃ dynamic-dynamic-filters ┃        Change ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 1  │    73.03 ms │                72.19 ms │     no change │
│ QQuery 2  │   216.42 ms │               213.00 ms │     no change │
│ QQuery 3  │   157.55 ms │               154.02 ms │     no change │
│ QQuery 4  │  1921.19 ms │              2116.78 ms │  1.10x slower │
│ QQuery 5  │   259.22 ms │               261.63 ms │     no change │
│ QQuery 6  │  1457.05 ms │              1224.10 ms │ +1.19x faster │
│ QQuery 7  │   517.50 ms │               500.07 ms │     no change │
│ QQuery 8  │   167.00 ms │               164.80 ms │     no change │
│ QQuery 9  │   303.83 ms │               295.25 ms │     no change │
│ QQuery 10 │   174.40 ms │               169.75 ms │     no change │
│ QQuery 11 │  1286.14 ms │              1279.81 ms │     no change │
│ QQuery 12 │    67.86 ms │                66.96 ms │     no change │
│ QQuery 13 │   542.12 ms │               539.32 ms │     no change │
│ QQuery 14 │  1845.08 ms │              1901.43 ms │     no change │
│ QQuery 15 │    28.55 ms │               122.86 ms │  4.30x slower │
│ QQuery 16 │    64.94 ms │               180.33 ms │  2.78x slower │
│ QQuery 17 │   355.34 ms │               438.65 ms │  1.23x slower │
│ QQuery 18 │   192.54 ms │               387.14 ms │  2.01x slower │
│ QQuery 19 │   215.34 ms │               207.90 ms │     no change │
│ QQuery 20 │    24.59 ms │               108.44 ms │  4.41x slower │
│ QQuery 21 │    35.94 ms │               380.63 ms │ 10.59x slower │
│ QQuery 22 │   747.69 ms │               848.25 ms │  1.13x slower │
│ QQuery 23 │  1759.12 ms │              1848.79 ms │  1.05x slower │
│ QQuery 24 │   681.16 ms │               662.29 ms │     no change │
│ QQuery 25 │   517.65 ms │               515.14 ms │     no change │
│ QQuery 26 │   125.63 ms │               285.69 ms │  2.27x slower │
│ QQuery 27 │   507.48 ms │               501.38 ms │     no change │
│ QQuery 28 │   299.95 ms │               302.43 ms │     no change │
│ QQuery 29 │   445.55 ms │               439.76 ms │     no change │
│ QQuery 30 │    74.52 ms │                73.65 ms │     no change │
│ QQuery 31 │   301.40 ms │               297.91 ms │     no change │
│ QQuery 32 │    82.75 ms │               132.59 ms │  1.60x slower │
│ QQuery 33 │   207.60 ms │               202.12 ms │     no change │
│ QQuery 34 │   158.78 ms │               155.24 ms │     no change │
│ QQuery 35 │   173.36 ms │               187.88 ms │  1.08x slower │
│ QQuery 36 │   294.53 ms │               283.60 ms │     no change │
│ QQuery 37 │   259.33 ms │               258.64 ms │     no change │
│ QQuery 38 │   152.78 ms │               172.27 ms │  1.13x slower │
│ QQuery 39 │   197.20 ms │              1660.68 ms │  8.42x slower │
│ QQuery 40 │   176.28 ms │               173.94 ms │     no change │
│ QQuery 41 │    24.35 ms │                24.54 ms │     no change │
│ QQuery 42 │   144.75 ms │               142.10 ms │     no change │
│ QQuery 43 │   126.54 ms │               124.73 ms │     no change │
│ QQuery 44 │    28.47 ms │                28.65 ms │     no change │
│ QQuery 45 │    82.92 ms │                82.77 ms │     no change │
│ QQuery 46 │   317.91 ms │               318.33 ms │     no change │
│ QQuery 47 │  1026.32 ms │              1019.10 ms │     no change │
│ QQuery 48 │   395.30 ms │               398.92 ms │     no change │
│ QQuery 49 │   382.94 ms │               375.77 ms │     no change │
│ QQuery 50 │   329.82 ms │               332.32 ms │     no change │
│ QQuery 51 │   301.95 ms │               302.24 ms │     no change │
│ QQuery 52 │   144.66 ms │               143.23 ms │     no change │
│ QQuery 53 │   146.79 ms │               141.98 ms │     no change │
│ QQuery 54 │   203.08 ms │               224.04 ms │  1.10x slower │
│ QQuery 55 │   144.49 ms │               142.24 ms │     no change │
│ QQuery 56 │   206.41 ms │               203.46 ms │     no change │
│ QQuery 57 │   289.28 ms │               439.70 ms │  1.52x slower │
│ QQuery 58 │   484.32 ms │               488.51 ms │     no change │
│ QQuery 59 │   290.83 ms │               289.39 ms │     no change │
│ QQuery 60 │   210.70 ms │               206.66 ms │     no change │
│ QQuery 61 │   245.28 ms │               249.00 ms │     no change │
│ QQuery 62 │  1299.75 ms │              1268.90 ms │     no change │
│ QQuery 63 │   148.89 ms │               143.74 ms │     no change │
│ QQuery 64 │  1147.28 ms │              1146.32 ms │     no change │
│ QQuery 65 │   352.30 ms │               345.40 ms │     no change │
│ QQuery 66 │   399.04 ms │               394.30 ms │     no change │
│ QQuery 67 │   541.91 ms │               534.32 ms │     no change │
│ QQuery 68 │   375.35 ms │               372.55 ms │     no change │
│ QQuery 69 │   168.49 ms │               164.31 ms │     no change │
│ QQuery 70 │   489.95 ms │               485.54 ms │     no change │
│ QQuery 71 │   188.13 ms │               183.74 ms │     no change │
│ QQuery 72 │  2106.85 ms │             12164.89 ms │  5.77x slower │
│ QQuery 73 │   153.44 ms │               152.47 ms │     no change │
│ QQuery 74 │   817.71 ms │               802.13 ms │     no change │
│ QQuery 75 │   400.81 ms │               398.62 ms │     no change │
│ QQuery 76 │   180.07 ms │               186.19 ms │     no change │
│ QQuery 77 │   281.99 ms │               275.26 ms │     no change │
│ QQuery 78 │   685.55 ms │               672.94 ms │     no change │
│ QQuery 79 │   323.32 ms │               316.62 ms │     no change │
│ QQuery 80 │   521.98 ms │               520.43 ms │     no change │
│ QQuery 81 │    51.72 ms │                57.55 ms │  1.11x slower │
│ QQuery 82 │   283.32 ms │               276.27 ms │     no change │
│ QQuery 83 │    78.82 ms │                75.54 ms │     no change │
│ QQuery 84 │    69.50 ms │                67.74 ms │     no change │
│ QQuery 85 │   218.95 ms │               222.83 ms │     no change │
│ QQuery 86 │    58.12 ms │                56.80 ms │     no change │
│ QQuery 87 │   152.32 ms │               176.36 ms │  1.16x slower │
│ QQuery 88 │   254.96 ms │               253.77 ms │     no change │
│ QQuery 89 │   167.08 ms │               164.79 ms │     no change │
│ QQuery 90 │    44.52 ms │                44.45 ms │     no change │
│ QQuery 91 │    93.19 ms │                93.15 ms │     no change │
│ QQuery 92 │    81.02 ms │                80.08 ms │     no change │
│ QQuery 93 │   278.86 ms │               277.70 ms │     no change │
│ QQuery 94 │    90.71 ms │                87.78 ms │     no change │
│ QQuery 95 │   241.37 ms │               236.35 ms │     no change │
│ QQuery 96 │   114.00 ms │               110.34 ms │     no change │
│ QQuery 97 │   190.60 ms │               213.38 ms │  1.12x slower │
│ QQuery 98 │   217.96 ms │               211.53 ms │     no change │
│ QQuery 99 │ 13982.12 ms │             14284.22 ms │     no change │
└───────────┴─────────────┴─────────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary                      ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (HEAD)                      │ 49847.45ms │
│ Total Time (dynamic-dynamic-filters)   │ 62984.27ms │
│ Average Time (HEAD)                    │   503.51ms │
│ Average Time (dynamic-dynamic-filters) │   636.20ms │
│ Queries Faster                         │          1 │
│ Queries Slower                         │         20 │
│ Queries with No Change                 │         78 │
│ Queries with Failure                   │          0 │
└────────────────────────────────────────┴────────────┘

@alamb-ghbot
Copy link

🤖 ./gh_compare_branch.sh gh_compare_branch.sh Running
Linux aal-dev 6.14.0-1018-gcp #19~24.04.1-Ubuntu SMP Wed Sep 24 23:23:09 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing dynamic-dynamic-filters (bd95912) to c92ba29 diff using: tpch
Results will be posted here when complete

@alamb-ghbot
Copy link

🤖: Benchmark completed

Details

Comparing HEAD and dynamic-dynamic-filters
--------------------
Benchmark tpch_sf1.json
--------------------
┏━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query     ┃      HEAD ┃ dynamic-dynamic-filters ┃        Change ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 1  │ 179.73 ms │               179.63 ms │     no change │
│ QQuery 2  │  86.42 ms │                85.23 ms │     no change │
│ QQuery 3  │ 124.40 ms │               122.71 ms │     no change │
│ QQuery 4  │  78.85 ms │                77.12 ms │     no change │
│ QQuery 5  │ 169.89 ms │               168.71 ms │     no change │
│ QQuery 6  │  65.54 ms │                67.78 ms │     no change │
│ QQuery 7  │ 205.35 ms │               211.90 ms │     no change │
│ QQuery 8  │ 160.97 ms │               162.85 ms │     no change │
│ QQuery 9  │ 224.78 ms │               216.23 ms │     no change │
│ QQuery 10 │ 180.84 ms │               178.02 ms │     no change │
│ QQuery 11 │  62.98 ms │                59.62 ms │ +1.06x faster │
│ QQuery 12 │ 117.48 ms │               117.01 ms │     no change │
│ QQuery 13 │ 219.16 ms │               221.10 ms │     no change │
│ QQuery 14 │  89.96 ms │                88.88 ms │     no change │
│ QQuery 15 │ 125.22 ms │               121.54 ms │     no change │
│ QQuery 16 │  61.87 ms │                58.97 ms │     no change │
│ QQuery 17 │ 257.79 ms │               252.09 ms │     no change │
│ QQuery 18 │ 310.85 ms │               304.87 ms │     no change │
│ QQuery 19 │ 138.14 ms │               131.65 ms │     no change │
│ QQuery 20 │ 125.64 ms │               125.06 ms │     no change │
│ QQuery 21 │ 255.07 ms │               250.18 ms │     no change │
│ QQuery 22 │  40.20 ms │                40.10 ms │     no change │
└───────────┴───────────┴─────────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Benchmark Summary                      ┃           ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ Total Time (HEAD)                      │ 3281.12ms │
│ Total Time (dynamic-dynamic-filters)   │ 3241.24ms │
│ Average Time (HEAD)                    │  149.14ms │
│ Average Time (dynamic-dynamic-filters) │  147.33ms │
│ Queries Faster                         │         1 │
│ Queries Slower                         │         0 │
│ Queries with No Change                 │        21 │
│ Queries with Failure                   │         0 │
└────────────────────────────────────────┴───────────┘

@alamb-ghbot
Copy link

🤖 ./gh_compare_branch.sh gh_compare_branch.sh Running
Linux aal-dev 6.14.0-1018-gcp #19~24.04.1-Ubuntu SMP Wed Sep 24 23:23:09 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing dynamic-dynamic-filters (bd95912) to c92ba29 diff using: tpch
Results will be posted here when complete

@alamb-ghbot
Copy link

🤖: Benchmark completed

Details

Comparing HEAD and dynamic-dynamic-filters
--------------------
Benchmark tpch_sf1.json
--------------------
┏━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Query     ┃      HEAD ┃ dynamic-dynamic-filters ┃    Change ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ QQuery 1  │ 183.59 ms │               182.05 ms │ no change │
│ QQuery 2  │  86.16 ms │                86.25 ms │ no change │
│ QQuery 3  │ 123.52 ms │               123.63 ms │ no change │
│ QQuery 4  │  77.82 ms │                76.82 ms │ no change │
│ QQuery 5  │ 171.51 ms │               166.34 ms │ no change │
│ QQuery 6  │  66.28 ms │                64.86 ms │ no change │
│ QQuery 7  │ 204.87 ms │               203.42 ms │ no change │
│ QQuery 8  │ 166.10 ms │               162.66 ms │ no change │
│ QQuery 9  │ 227.99 ms │               223.17 ms │ no change │
│ QQuery 10 │ 180.73 ms │               180.58 ms │ no change │
│ QQuery 11 │  61.14 ms │                60.76 ms │ no change │
│ QQuery 12 │ 117.17 ms │               117.25 ms │ no change │
│ QQuery 13 │ 217.17 ms │               222.40 ms │ no change │
│ QQuery 14 │  91.27 ms │                88.63 ms │ no change │
│ QQuery 15 │ 123.28 ms │               122.67 ms │ no change │
│ QQuery 16 │  59.59 ms │                57.53 ms │ no change │
│ QQuery 17 │ 251.18 ms │               252.79 ms │ no change │
│ QQuery 18 │ 308.74 ms │               309.84 ms │ no change │
│ QQuery 19 │ 133.37 ms │               131.86 ms │ no change │
│ QQuery 20 │ 125.73 ms │               126.30 ms │ no change │
│ QQuery 21 │ 257.56 ms │               250.46 ms │ no change │
│ QQuery 22 │  41.77 ms │                43.60 ms │ no change │
└───────────┴───────────┴─────────────────────────┴───────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Benchmark Summary                      ┃           ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ Total Time (HEAD)                      │ 3276.53ms │
│ Total Time (dynamic-dynamic-filters)   │ 3253.83ms │
│ Average Time (HEAD)                    │  148.93ms │
│ Average Time (dynamic-dynamic-filters) │  147.90ms │
│ Queries Faster                         │         0 │
│ Queries Slower                         │         0 │
│ Queries with No Change                 │        22 │
│ Queries with Failure                   │         0 │
└────────────────────────────────────────┴───────────┘

@adriangb
Copy link
Contributor Author

adriangb commented Feb 5, 2026

I expect benchmarks to look bad - there's overhead this wrapper introduces right now even in no-op mode. I'm going to push a fix and run benches again.

@github-actions github-actions bot added the core Core DataFusion crate label Feb 5, 2026
@adriangb
Copy link
Contributor Author

adriangb commented Feb 5, 2026

run benchmark tpch

@alamb-ghbot
Copy link

🤖 ./gh_compare_branch.sh gh_compare_branch.sh Running
Linux aal-dev 6.14.0-1018-gcp #19~24.04.1-Ubuntu SMP Wed Sep 24 23:23:09 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing dynamic-dynamic-filters (214d54d) to c92ba29 diff using: tpch
Results will be posted here when complete

@adriangb
Copy link
Contributor Author

adriangb commented Feb 5, 2026

run benchmark tpcds

@alamb-ghbot
Copy link

🤖: Benchmark completed

Details

Comparing HEAD and dynamic-dynamic-filters
--------------------
Benchmark tpch_sf1.json
--------------------
┏━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Query     ┃      HEAD ┃ dynamic-dynamic-filters ┃    Change ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ QQuery 1  │ 181.44 ms │               177.08 ms │ no change │
│ QQuery 2  │  85.46 ms │                86.28 ms │ no change │
│ QQuery 3  │ 119.33 ms │               121.16 ms │ no change │
│ QQuery 4  │  76.31 ms │                77.53 ms │ no change │
│ QQuery 5  │ 168.76 ms │               167.91 ms │ no change │
│ QQuery 6  │  66.18 ms │                65.67 ms │ no change │
│ QQuery 7  │ 204.94 ms │               207.06 ms │ no change │
│ QQuery 8  │ 166.49 ms │               165.28 ms │ no change │
│ QQuery 9  │ 222.99 ms │               220.56 ms │ no change │
│ QQuery 10 │ 181.34 ms │               181.70 ms │ no change │
│ QQuery 11 │  62.22 ms │                60.04 ms │ no change │
│ QQuery 12 │ 116.31 ms │               116.68 ms │ no change │
│ QQuery 13 │ 217.24 ms │               225.71 ms │ no change │
│ QQuery 14 │  91.51 ms │                92.05 ms │ no change │
│ QQuery 15 │ 124.54 ms │               123.26 ms │ no change │
│ QQuery 16 │  58.34 ms │                58.92 ms │ no change │
│ QQuery 17 │ 250.47 ms │               252.93 ms │ no change │
│ QQuery 18 │ 306.19 ms │               306.54 ms │ no change │
│ QQuery 19 │ 132.26 ms │               133.61 ms │ no change │
│ QQuery 20 │ 127.25 ms │               123.44 ms │ no change │
│ QQuery 21 │ 254.26 ms │               252.49 ms │ no change │
│ QQuery 22 │  40.45 ms │                39.53 ms │ no change │
└───────────┴───────────┴─────────────────────────┴───────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Benchmark Summary                      ┃           ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ Total Time (HEAD)                      │ 3254.29ms │
│ Total Time (dynamic-dynamic-filters)   │ 3255.41ms │
│ Average Time (HEAD)                    │  147.92ms │
│ Average Time (dynamic-dynamic-filters) │  147.97ms │
│ Queries Faster                         │         0 │
│ Queries Slower                         │         0 │
│ Queries with No Change                 │        22 │
│ Queries with Failure                   │         0 │
└────────────────────────────────────────┴───────────┘

@alamb-ghbot
Copy link

🤖 ./gh_compare_branch.sh gh_compare_branch.sh Running
Linux aal-dev 6.14.0-1018-gcp #19~24.04.1-Ubuntu SMP Wed Sep 24 23:23:09 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing dynamic-dynamic-filters (0835dd2) to c92ba29 diff using: tpcds
Results will be posted here when complete

@alamb-ghbot
Copy link

🤖: Benchmark completed

Details

Comparing HEAD and dynamic-dynamic-filters
--------------------
Benchmark tpcds_sf1.json
--------------------
┏━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query     ┃        HEAD ┃ dynamic-dynamic-filters ┃        Change ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 1  │    71.79 ms │                72.86 ms │     no change │
│ QQuery 2  │   216.81 ms │               207.13 ms │     no change │
│ QQuery 3  │   156.35 ms │               151.73 ms │     no change │
│ QQuery 4  │  1878.67 ms │              1849.63 ms │     no change │
│ QQuery 5  │   262.88 ms │               256.31 ms │     no change │
│ QQuery 6  │  1460.47 ms │              1399.43 ms │     no change │
│ QQuery 7  │   514.21 ms │               515.29 ms │     no change │
│ QQuery 8  │   170.56 ms │               165.39 ms │     no change │
│ QQuery 9  │   296.97 ms │               294.02 ms │     no change │
│ QQuery 10 │   173.24 ms │               166.89 ms │     no change │
│ QQuery 11 │  1291.34 ms │              1256.21 ms │     no change │
│ QQuery 12 │    68.76 ms │                64.58 ms │ +1.06x faster │
│ QQuery 13 │   547.00 ms │               540.21 ms │     no change │
│ QQuery 14 │  1851.00 ms │              1847.62 ms │     no change │
│ QQuery 15 │    28.17 ms │                26.28 ms │ +1.07x faster │
│ QQuery 16 │    64.63 ms │                61.65 ms │     no change │
│ QQuery 17 │   355.09 ms │               352.96 ms │     no change │
│ QQuery 18 │   191.95 ms │               189.92 ms │     no change │
│ QQuery 19 │   215.23 ms │               210.00 ms │     no change │
│ QQuery 20 │    24.23 ms │                24.29 ms │     no change │
│ QQuery 21 │    35.38 ms │                34.87 ms │     no change │
│ QQuery 22 │   752.09 ms │               734.63 ms │     no change │
│ QQuery 23 │  1742.56 ms │              1772.29 ms │     no change │
│ QQuery 24 │   685.98 ms │               678.13 ms │     no change │
│ QQuery 25 │   521.26 ms │               518.93 ms │     no change │
│ QQuery 26 │   125.14 ms │               122.95 ms │     no change │
│ QQuery 27 │   510.44 ms │               507.89 ms │     no change │
│ QQuery 28 │   298.01 ms │               298.01 ms │     no change │
│ QQuery 29 │   446.44 ms │               439.43 ms │     no change │
│ QQuery 30 │    72.94 ms │                77.04 ms │  1.06x slower │
│ QQuery 31 │   312.36 ms │               299.47 ms │     no change │
│ QQuery 32 │    80.95 ms │                79.55 ms │     no change │
│ QQuery 33 │   206.36 ms │               201.21 ms │     no change │
│ QQuery 34 │   158.15 ms │               153.93 ms │     no change │
│ QQuery 35 │   174.10 ms │               168.99 ms │     no change │
│ QQuery 36 │   287.90 ms │               281.33 ms │     no change │
│ QQuery 37 │   260.08 ms │               254.26 ms │     no change │
│ QQuery 38 │   151.90 ms │               148.18 ms │     no change │
│ QQuery 39 │   196.88 ms │               195.05 ms │     no change │
│ QQuery 40 │   176.29 ms │               178.10 ms │     no change │
│ QQuery 41 │    25.57 ms │                25.17 ms │     no change │
│ QQuery 42 │   143.99 ms │               141.85 ms │     no change │
│ QQuery 43 │   128.49 ms │               123.85 ms │     no change │
│ QQuery 44 │    28.71 ms │                27.65 ms │     no change │
│ QQuery 45 │    84.71 ms │                85.60 ms │     no change │
│ QQuery 46 │   316.62 ms │               311.19 ms │     no change │
│ QQuery 47 │  1035.67 ms │              1001.11 ms │     no change │
│ QQuery 48 │   399.39 ms │               405.25 ms │     no change │
│ QQuery 49 │   385.97 ms │               376.47 ms │     no change │
│ QQuery 50 │   326.57 ms │               329.22 ms │     no change │
│ QQuery 51 │   304.25 ms │               296.87 ms │     no change │
│ QQuery 52 │   146.03 ms │               142.18 ms │     no change │
│ QQuery 53 │   146.78 ms │               143.43 ms │     no change │
│ QQuery 54 │   202.66 ms │               198.11 ms │     no change │
│ QQuery 55 │   144.65 ms │               140.58 ms │     no change │
│ QQuery 56 │   204.22 ms │               202.49 ms │     no change │
│ QQuery 57 │   288.73 ms │               283.31 ms │     no change │
│ QQuery 58 │   487.16 ms │               504.95 ms │     no change │
│ QQuery 59 │   290.13 ms │               285.92 ms │     no change │
│ QQuery 60 │   212.18 ms │               207.90 ms │     no change │
│ QQuery 61 │   246.24 ms │               244.90 ms │     no change │
│ QQuery 62 │  1240.27 ms │              1271.68 ms │     no change │
│ QQuery 63 │   146.06 ms │               145.43 ms │     no change │
│ QQuery 64 │  1158.32 ms │              1148.40 ms │     no change │
│ QQuery 65 │   355.80 ms │               348.77 ms │     no change │
│ QQuery 66 │   379.21 ms │               399.30 ms │  1.05x slower │
│ QQuery 67 │   542.60 ms │               545.03 ms │     no change │
│ QQuery 68 │   393.16 ms │               374.32 ms │     no change │
│ QQuery 69 │   174.00 ms │               164.27 ms │ +1.06x faster │
│ QQuery 70 │   498.81 ms │               480.70 ms │     no change │
│ QQuery 71 │   187.88 ms │               184.30 ms │     no change │
│ QQuery 72 │  2115.96 ms │              2128.76 ms │     no change │
│ QQuery 73 │   155.02 ms │               150.87 ms │     no change │
│ QQuery 74 │   805.75 ms │               799.10 ms │     no change │
│ QQuery 75 │   411.25 ms │               396.53 ms │     no change │
│ QQuery 76 │   181.27 ms │               185.08 ms │     no change │
│ QQuery 77 │   277.41 ms │               275.40 ms │     no change │
│ QQuery 78 │   684.87 ms │               682.63 ms │     no change │
│ QQuery 79 │   320.64 ms │               324.13 ms │     no change │
│ QQuery 80 │   533.71 ms │               523.60 ms │     no change │
│ QQuery 81 │    53.04 ms │                53.48 ms │     no change │
│ QQuery 82 │   284.92 ms │               278.24 ms │     no change │
│ QQuery 83 │    78.52 ms │                80.41 ms │     no change │
│ QQuery 84 │    67.73 ms │                69.00 ms │     no change │
│ QQuery 85 │   210.18 ms │               224.18 ms │  1.07x slower │
│ QQuery 86 │    58.63 ms │                59.45 ms │     no change │
│ QQuery 87 │   152.10 ms │               159.22 ms │     no change │
│ QQuery 88 │   255.92 ms │               253.68 ms │     no change │
│ QQuery 89 │   166.14 ms │               166.68 ms │     no change │
│ QQuery 90 │    44.64 ms │                43.64 ms │     no change │
│ QQuery 91 │    93.76 ms │                92.61 ms │     no change │
│ QQuery 92 │    81.59 ms │                79.22 ms │     no change │
│ QQuery 93 │   282.32 ms │               285.77 ms │     no change │
│ QQuery 94 │    90.64 ms │                88.27 ms │     no change │
│ QQuery 95 │   245.03 ms │               244.09 ms │     no change │
│ QQuery 96 │   113.22 ms │               112.46 ms │     no change │
│ QQuery 97 │   188.66 ms │               191.83 ms │     no change │
│ QQuery 98 │   214.68 ms │               219.93 ms │     no change │
│ QQuery 99 │ 13988.82 ms │             14016.23 ms │     no change │
└───────────┴─────────────┴─────────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary                      ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (HEAD)                      │ 49815.75ms │
│ Total Time (dynamic-dynamic-filters)   │ 49521.34ms │
│ Average Time (HEAD)                    │   503.19ms │
│ Average Time (dynamic-dynamic-filters) │   500.22ms │
│ Queries Faster                         │          3 │
│ Queries Slower                         │          3 │
│ Queries with No Change                 │         93 │
│ Queries with Failure                   │          0 │
└────────────────────────────────────────┴────────────┘

@adriangb
Copy link
Contributor Author

adriangb commented Feb 5, 2026

run benchmark tpcds

@alamb-ghbot
Copy link

🤖 ./gh_compare_branch.sh gh_compare_branch.sh Running
Linux aal-dev 6.14.0-1018-gcp #19~24.04.1-Ubuntu SMP Wed Sep 24 23:23:09 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing dynamic-dynamic-filters (9a90c37) to c92ba29 diff using: tpcds
Results will be posted here when complete

@alamb-ghbot
Copy link

🤖: Benchmark completed

Details

Comparing HEAD and dynamic-dynamic-filters
--------------------
Benchmark tpcds_sf1.json
--------------------
┏━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query     ┃        HEAD ┃ dynamic-dynamic-filters ┃        Change ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 1  │    73.94 ms │                71.11 ms │     no change │
│ QQuery 2  │   221.38 ms │               206.92 ms │ +1.07x faster │
│ QQuery 3  │   156.47 ms │               153.44 ms │     no change │
│ QQuery 4  │  1883.91 ms │              1866.82 ms │     no change │
│ QQuery 5  │   255.67 ms │               258.62 ms │     no change │
│ QQuery 6  │  1457.72 ms │              1441.12 ms │     no change │
│ QQuery 7  │   524.45 ms │               513.67 ms │     no change │
│ QQuery 8  │   169.97 ms │               166.72 ms │     no change │
│ QQuery 9  │   307.91 ms │               289.94 ms │ +1.06x faster │
│ QQuery 10 │   171.01 ms │               172.08 ms │     no change │
│ QQuery 11 │  1288.10 ms │              1261.80 ms │     no change │
│ QQuery 12 │    66.99 ms │                67.77 ms │     no change │
│ QQuery 13 │   547.06 ms │               537.90 ms │     no change │
│ QQuery 14 │  1833.65 ms │              1836.76 ms │     no change │
│ QQuery 15 │    28.29 ms │                27.00 ms │     no change │
│ QQuery 16 │    64.66 ms │                62.37 ms │     no change │
│ QQuery 17 │   356.31 ms │               354.29 ms │     no change │
│ QQuery 18 │   194.29 ms │               185.69 ms │     no change │
│ QQuery 19 │   215.73 ms │               210.89 ms │     no change │
│ QQuery 20 │    25.73 ms │                24.20 ms │ +1.06x faster │
│ QQuery 21 │    35.70 ms │                35.58 ms │     no change │
│ QQuery 22 │   748.67 ms │               713.48 ms │     no change │
│ QQuery 23 │  1783.92 ms │              1761.40 ms │     no change │
│ QQuery 24 │   690.55 ms │               688.44 ms │     no change │
│ QQuery 25 │   526.20 ms │               518.62 ms │     no change │
│ QQuery 26 │   127.65 ms │               125.06 ms │     no change │
│ QQuery 27 │   508.12 ms │               510.89 ms │     no change │
│ QQuery 28 │   300.10 ms │               302.95 ms │     no change │
│ QQuery 29 │   449.38 ms │               440.72 ms │     no change │
│ QQuery 30 │    76.79 ms │                74.65 ms │     no change │
│ QQuery 31 │   306.34 ms │               297.01 ms │     no change │
│ QQuery 32 │    82.35 ms │                80.08 ms │     no change │
│ QQuery 33 │   206.30 ms │               202.92 ms │     no change │
│ QQuery 34 │   158.84 ms │               158.01 ms │     no change │
│ QQuery 35 │   170.27 ms │               171.52 ms │     no change │
│ QQuery 36 │   286.03 ms │               278.26 ms │     no change │
│ QQuery 37 │   260.75 ms │               257.24 ms │     no change │
│ QQuery 38 │   153.30 ms │               153.01 ms │     no change │
│ QQuery 39 │   200.55 ms │               198.61 ms │     no change │
│ QQuery 40 │   177.77 ms │               179.41 ms │     no change │
│ QQuery 41 │    25.18 ms │                25.10 ms │     no change │
│ QQuery 42 │   146.68 ms │               141.77 ms │     no change │
│ QQuery 43 │   126.82 ms │               123.50 ms │     no change │
│ QQuery 44 │    27.89 ms │                27.75 ms │     no change │
│ QQuery 45 │    86.30 ms │                83.93 ms │     no change │
│ QQuery 46 │   325.71 ms │               317.84 ms │     no change │
│ QQuery 47 │  1016.88 ms │              1012.74 ms │     no change │
│ QQuery 48 │   400.72 ms │               402.88 ms │     no change │
│ QQuery 49 │   383.60 ms │               386.92 ms │     no change │
│ QQuery 50 │   337.08 ms │               330.03 ms │     no change │
│ QQuery 51 │   304.34 ms │               301.13 ms │     no change │
│ QQuery 52 │   144.74 ms │               142.63 ms │     no change │
│ QQuery 53 │   144.55 ms │               144.89 ms │     no change │
│ QQuery 54 │   201.33 ms │               201.04 ms │     no change │
│ QQuery 55 │   145.61 ms │               144.06 ms │     no change │
│ QQuery 56 │   204.03 ms │               203.68 ms │     no change │
│ QQuery 57 │   289.90 ms │               284.65 ms │     no change │
│ QQuery 58 │   496.64 ms │               494.03 ms │     no change │
│ QQuery 59 │   290.20 ms │               284.52 ms │     no change │
│ QQuery 60 │   215.40 ms │               208.56 ms │     no change │
│ QQuery 61 │   241.77 ms │               243.37 ms │     no change │
│ QQuery 62 │  1262.03 ms │              1278.61 ms │     no change │
│ QQuery 63 │   146.90 ms │               145.95 ms │     no change │
│ QQuery 64 │  1155.11 ms │              1148.23 ms │     no change │
│ QQuery 65 │   350.34 ms │               347.62 ms │     no change │
│ QQuery 66 │   395.99 ms │               389.03 ms │     no change │
│ QQuery 67 │   542.92 ms │               524.22 ms │     no change │
│ QQuery 68 │   379.74 ms │               364.58 ms │     no change │
│ QQuery 69 │   168.61 ms │               167.07 ms │     no change │
│ QQuery 70 │   489.86 ms │               483.95 ms │     no change │
│ QQuery 71 │   185.04 ms │               184.38 ms │     no change │
│ QQuery 72 │  2122.38 ms │              2108.10 ms │     no change │
│ QQuery 73 │   152.91 ms │               152.00 ms │     no change │
│ QQuery 74 │   811.75 ms │               799.66 ms │     no change │
│ QQuery 75 │   408.95 ms │               395.93 ms │     no change │
│ QQuery 76 │   186.79 ms │               182.83 ms │     no change │
│ QQuery 77 │   279.96 ms │               276.69 ms │     no change │
│ QQuery 78 │   683.79 ms │               666.57 ms │     no change │
│ QQuery 79 │   324.33 ms │               320.00 ms │     no change │
│ QQuery 80 │   532.50 ms │               523.61 ms │     no change │
│ QQuery 81 │    52.05 ms │                49.62 ms │     no change │
│ QQuery 82 │   285.86 ms │               279.66 ms │     no change │
│ QQuery 83 │    79.41 ms │                78.98 ms │     no change │
│ QQuery 84 │    69.84 ms │                69.04 ms │     no change │
│ QQuery 85 │   210.77 ms │               218.74 ms │     no change │
│ QQuery 86 │    59.56 ms │                57.97 ms │     no change │
│ QQuery 87 │   151.34 ms │               148.56 ms │     no change │
│ QQuery 88 │   253.92 ms │               250.47 ms │     no change │
│ QQuery 89 │   167.54 ms │               165.92 ms │     no change │
│ QQuery 90 │    44.57 ms │                43.95 ms │     no change │
│ QQuery 91 │    96.06 ms │                93.14 ms │     no change │
│ QQuery 92 │    80.42 ms │                80.12 ms │     no change │
│ QQuery 93 │   287.86 ms │               279.52 ms │     no change │
│ QQuery 94 │    90.47 ms │                89.39 ms │     no change │
│ QQuery 95 │   246.42 ms │               244.70 ms │     no change │
│ QQuery 96 │   113.98 ms │               111.64 ms │     no change │
│ QQuery 97 │   193.96 ms │               188.97 ms │     no change │
│ QQuery 98 │   212.32 ms │               214.47 ms │     no change │
│ QQuery 99 │ 13980.60 ms │             14014.95 ms │     no change │
└───────────┴─────────────┴─────────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary                      ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (HEAD)                      │ 49905.00ms │
│ Total Time (dynamic-dynamic-filters)   │ 49500.84ms │
│ Average Time (HEAD)                    │   504.09ms │
│ Average Time (dynamic-dynamic-filters) │   500.01ms │
│ Queries Faster                         │          3 │
│ Queries Slower                         │          0 │
│ Queries with No Change                 │         96 │
│ Queries with Failure                   │          0 │
└────────────────────────────────────────┴────────────┘

@adriangb
Copy link
Contributor Author

adriangb commented Feb 5, 2026

run benchmark tpcds

@alamb-ghbot
Copy link

🤖 ./gh_compare_branch.sh gh_compare_branch.sh Running
Linux aal-dev 6.14.0-1018-gcp #19~24.04.1-Ubuntu SMP Wed Sep 24 23:23:09 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing dynamic-dynamic-filters (9910b18) to c92ba29 diff using: tpcds
Results will be posted here when complete

@alamb-ghbot
Copy link

🤖: Benchmark completed

Details

Comparing HEAD and dynamic-dynamic-filters
--------------------
Benchmark tpcds_sf1.json
--------------------
┏━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query     ┃        HEAD ┃ dynamic-dynamic-filters ┃        Change ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 1  │    73.50 ms │                71.74 ms │     no change │
│ QQuery 2  │   215.54 ms │               208.18 ms │     no change │
│ QQuery 3  │   155.75 ms │               152.95 ms │     no change │
│ QQuery 4  │  1889.95 ms │              1914.54 ms │     no change │
│ QQuery 5  │   268.60 ms │               258.15 ms │     no change │
│ QQuery 6  │  1420.68 ms │              1432.08 ms │     no change │
│ QQuery 7  │   545.31 ms │               509.12 ms │ +1.07x faster │
│ QQuery 8  │   169.15 ms │               165.64 ms │     no change │
│ QQuery 9  │   295.98 ms │               291.15 ms │     no change │
│ QQuery 10 │   172.03 ms │               173.29 ms │     no change │
│ QQuery 11 │  1263.10 ms │              1268.09 ms │     no change │
│ QQuery 12 │    67.21 ms │                67.40 ms │     no change │
│ QQuery 13 │   541.98 ms │               536.28 ms │     no change │
│ QQuery 14 │  1853.25 ms │              1836.15 ms │     no change │
│ QQuery 15 │    28.00 ms │                27.65 ms │     no change │
│ QQuery 16 │    64.23 ms │                63.18 ms │     no change │
│ QQuery 17 │   355.16 ms │               358.79 ms │     no change │
│ QQuery 18 │   191.50 ms │               190.06 ms │     no change │
│ QQuery 19 │   214.33 ms │               210.89 ms │     no change │
│ QQuery 20 │    24.81 ms │                24.04 ms │     no change │
│ QQuery 21 │    36.82 ms │                35.30 ms │     no change │
│ QQuery 22 │   746.76 ms │               712.64 ms │     no change │
│ QQuery 23 │  1756.38 ms │              1749.21 ms │     no change │
│ QQuery 24 │   680.99 ms │               680.40 ms │     no change │
│ QQuery 25 │   523.28 ms │               524.11 ms │     no change │
│ QQuery 26 │   127.14 ms │               127.88 ms │     no change │
│ QQuery 27 │   510.77 ms │               512.42 ms │     no change │
│ QQuery 28 │   296.98 ms │               297.98 ms │     no change │
│ QQuery 29 │   452.76 ms │               453.09 ms │     no change │
│ QQuery 30 │    75.12 ms │                75.19 ms │     no change │
│ QQuery 31 │   312.61 ms │               299.83 ms │     no change │
│ QQuery 32 │    82.14 ms │                80.06 ms │     no change │
│ QQuery 33 │   206.41 ms │               203.71 ms │     no change │
│ QQuery 34 │   157.71 ms │               157.70 ms │     no change │
│ QQuery 35 │   174.13 ms │               178.41 ms │     no change │
│ QQuery 36 │   286.13 ms │               286.66 ms │     no change │
│ QQuery 37 │   258.62 ms │               256.19 ms │     no change │
│ QQuery 38 │   153.60 ms │               147.67 ms │     no change │
│ QQuery 39 │   199.69 ms │               193.37 ms │     no change │
│ QQuery 40 │   179.92 ms │               180.98 ms │     no change │
│ QQuery 41 │    25.20 ms │                25.10 ms │     no change │
│ QQuery 42 │   144.79 ms │               139.86 ms │     no change │
│ QQuery 43 │   127.12 ms │               125.07 ms │     no change │
│ QQuery 44 │    27.86 ms │                28.11 ms │     no change │
│ QQuery 45 │    85.90 ms │                83.57 ms │     no change │
│ QQuery 46 │   321.52 ms │               316.25 ms │     no change │
│ QQuery 47 │  1022.81 ms │              1006.83 ms │     no change │
│ QQuery 48 │   406.56 ms │               401.27 ms │     no change │
│ QQuery 49 │   382.96 ms │               376.56 ms │     no change │
│ QQuery 50 │   327.49 ms │               333.33 ms │     no change │
│ QQuery 51 │   302.24 ms │               306.77 ms │     no change │
│ QQuery 52 │   145.09 ms │               142.72 ms │     no change │
│ QQuery 53 │   146.60 ms │               143.77 ms │     no change │
│ QQuery 54 │   201.58 ms │               197.47 ms │     no change │
│ QQuery 55 │   144.77 ms │               139.61 ms │     no change │
│ QQuery 56 │   205.57 ms │               202.46 ms │     no change │
│ QQuery 57 │   289.26 ms │               284.24 ms │     no change │
│ QQuery 58 │   492.54 ms │               496.96 ms │     no change │
│ QQuery 59 │   286.83 ms │               285.11 ms │     no change │
│ QQuery 60 │   212.64 ms │               208.20 ms │     no change │
│ QQuery 61 │   244.74 ms │               247.41 ms │     no change │
│ QQuery 62 │  1239.99 ms │              1255.38 ms │     no change │
│ QQuery 63 │   147.00 ms │               145.03 ms │     no change │
│ QQuery 64 │  1150.56 ms │              1163.38 ms │     no change │
│ QQuery 65 │   348.11 ms │               350.09 ms │     no change │
│ QQuery 66 │   392.02 ms │               382.27 ms │     no change │
│ QQuery 67 │   528.48 ms │               533.04 ms │     no change │
│ QQuery 68 │   374.89 ms │               372.62 ms │     no change │
│ QQuery 69 │   167.50 ms │               169.49 ms │     no change │
│ QQuery 70 │   493.48 ms │               491.68 ms │     no change │
│ QQuery 71 │   186.61 ms │               183.05 ms │     no change │
│ QQuery 72 │  2073.01 ms │              2073.44 ms │     no change │
│ QQuery 73 │   153.06 ms │               151.92 ms │     no change │
│ QQuery 74 │   810.40 ms │               799.70 ms │     no change │
│ QQuery 75 │   404.66 ms │               399.90 ms │     no change │
│ QQuery 76 │   181.80 ms │               179.89 ms │     no change │
│ QQuery 77 │   280.71 ms │               274.18 ms │     no change │
│ QQuery 78 │   685.15 ms │               676.98 ms │     no change │
│ QQuery 79 │   322.15 ms │               319.93 ms │     no change │
│ QQuery 80 │   529.63 ms │               527.19 ms │     no change │
│ QQuery 81 │    52.11 ms │                54.04 ms │     no change │
│ QQuery 82 │   284.59 ms │               275.99 ms │     no change │
│ QQuery 83 │    77.91 ms │                77.61 ms │     no change │
│ QQuery 84 │    72.15 ms │                67.70 ms │ +1.07x faster │
│ QQuery 85 │   215.52 ms │               212.46 ms │     no change │
│ QQuery 86 │    59.30 ms │                56.65 ms │     no change │
│ QQuery 87 │   153.68 ms │               152.11 ms │     no change │
│ QQuery 88 │   256.33 ms │               251.48 ms │     no change │
│ QQuery 89 │   169.68 ms │               163.59 ms │     no change │
│ QQuery 90 │    46.02 ms │                44.73 ms │     no change │
│ QQuery 91 │    95.27 ms │                95.46 ms │     no change │
│ QQuery 92 │    81.08 ms │                78.77 ms │     no change │
│ QQuery 93 │   286.57 ms │               279.11 ms │     no change │
│ QQuery 94 │    91.82 ms │                88.24 ms │     no change │
│ QQuery 95 │   246.74 ms │               242.82 ms │     no change │
│ QQuery 96 │   112.76 ms │               111.14 ms │     no change │
│ QQuery 97 │   190.57 ms │               189.68 ms │     no change │
│ QQuery 98 │   216.92 ms │               212.12 ms │     no change │
│ QQuery 99 │ 13991.91 ms │             14011.35 ms │     no change │
└───────────┴─────────────┴─────────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary                      ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (HEAD)                      │ 49742.28ms │
│ Total Time (dynamic-dynamic-filters)   │ 49517.05ms │
│ Average Time (HEAD)                    │   502.45ms │
│ Average Time (dynamic-dynamic-filters) │   500.17ms │
│ Queries Faster                         │          2 │
│ Queries Slower                         │          0 │
│ Queries with No Change                 │         97 │
│ Queries with Failure                   │          0 │
└────────────────────────────────────────┴────────────┘

@adriangb
Copy link
Contributor Author

adriangb commented Feb 5, 2026

Hmm I am seeing much larger (1.20x faster) changes locally. Will have to run again and see what’s going on.

I do think it’s worth pondering what the units should be here. In particular I think we should incorporate filter evaluation time, something like (rows_filtered)/(compute_time) or (bytes_filtered)/(compute_time) (bytes/s, higher is better).

adriangb and others added 13 commits February 6, 2026 11:17
Add `SelectivityAwareFilterExpr`, a wrapper `PhysicalExpr` that tracks
filter selectivity at runtime and automatically disables filters that
aren't pruning enough rows. This addresses the issue where dynamic
filters from `HashJoinExec` can be expensive to evaluate for little
benefit when the build side covers most of the probe side values.

Key features:
- Selectivity threshold: Filter disabled when rows_passed/rows_total >= threshold
- Minimum rows: Statistics collected for min_rows before making a decision
- Generation-aware reset: Resets when inner filter updates (e.g., hash table built)
- Permanent disable: Once disabled, stays disabled for rest of query
- Disabled behavior: Returns all-true array to bypass filter evaluation

New configuration options in OptimizerOptions:
- enable_dynamic_filter_selectivity_tracking (default: false)
- dynamic_filter_selectivity_threshold (default: 0.95)
- dynamic_filter_min_rows_for_selectivity (default: 10000)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove duplicate import of DynamicFilterPhysicalExpr and lit
- Add new selectivity tracking config options to information_schema.slt

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Rename configuration options and the wrapper expression for clarity:
- dynamic_filter_min_rows_for_selectivity -> adaptive_filter_min_rows_for_selectivity
- dynamic_filter_selectivity_threshold -> adaptive_filter_selectivity_threshold
- enable_dynamic_filter_selectivity_tracking -> enable_adaptive_filter_selectivity_tracking
- SelectivityAwareFilterExpr -> AdaptiveSelectivityFilterExpr
- selectivity_aware_filter.rs -> adaptive_selectivity_filter.rs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove RwLock and optimize the hot path:
- Replace RwLock<SelectivityState> with simple atomics
- Fast path for ACTIVE state: single atomic load, no tracking
- Fast path for DISABLED state: single atomic load, return all-true
- Only call snapshot_generation() in TRACKING state
- No counter updates in ACTIVE state

This eliminates the performance overhead that was causing slowdowns
even with threshold=1.0, since the overhead came from lock acquisition
and generation checks on every evaluate() call.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The snapshot() method was returning None, causing the wrapper to be
preserved during snapshotting. Since PruningPredicate doesn't recognize
the wrapper type, it fell back to lit(true) which disabled all row group
and file pruning.

Changed snapshot() to return the inner expression directly, stripping
the wrapper during snapshotting so pruning predicates work correctly.

Also set enable_adaptive_filter_selectivity_tracking default to false
since this is an experimental feature.

Benchmarks show no slowdowns after this fix.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Simplifies the implementation by removing generation-aware reset logic:
- No longer tracks inner filter's generation
- snapshot_generation() returns inner's generation, or 0 when disabled
- Faster evaluate() path without generation checks

The generation tracking was unnecessary for hash join filters and added
overhead to the hot path.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@adriangb adriangb force-pushed the dynamic-dynamic-filters branch from a43489c to bc6cfac Compare February 6, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to common crate core Core DataFusion crate documentation Improvements or additions to documentation physical-expr Changes to the physical-expr crates physical-plan Changes to the physical-plan crate sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants