Skip to content

Blog post about TopK filter pushdown #15513

Closed
apache/datafusion-site
#103

Description

@alamb

Is your feature request related to a problem or challenge?

@adriangb has a great PR to add dynamic filtering with TopK in DataFusion here:

Describe the solution you'd like

It would be really nice to write a blog post about this optimization in DataFusion (and maybe call out how it works)

Here are some related work

High level points

  • Study DuckDB plan Make ClickBench Q23 Go Faster #15177 (hos much faster)
  • Went back and forth to design something that could be general purpose
  • Did benchmarking,
  • Results are amazing, etc

Describe alternatives you've considered

No response

Additional context

No response

Activity

  1. added
    enhancementNew feature or request
    documentationImprovements or additions to documentation
    on Mar 31, 2025
  2. aaryyya commented on Apr 6, 2025

    @aaryyya

    take

  3. alamb commented on Apr 6, 2025

    @alamb
    ContributorAuthor

    Thanks @aaryyya -- note we'll need to actually finish the work before we can publish a blog

    Of course, blog driven development does work pretty well -- it is basically we @clflushopt @scsmithr and I did with another project (wrote the outline of the blog we wanted to see and then wrote the code to make it happen 😆 )

  4. adriangb commented on Jun 18, 2025

    @adriangb
    Contributor

    I think we're ready to publish a blogpost!

  5. alamb commented on Jun 18, 2025

    @alamb
    ContributorAuthor

    Now all we need to do is find time to write one 😆

    I think a great visual is to have is some chart showing the performance improvement with/without topk pushdown

    Basically like this https://arrow.apache.org/blog/2023/08/05/datafusion_fast_grouping/

    Image

  6. alamb commented on Jul 2, 2025

    @alamb
    ContributorAuthor

    Here is my suggestion for a blog / outline:

    The goal is a technical evangelism piece. The reader should come away having learned something about columnar query engines (not just that DataFusion is great, which it is!)

    Title: Using Dynamic Filterers and to make TopK / LIMIT queries much faster

    Structure:

    Intro

    w/ some sort of summary performance chart

    Running example:
    A simple example query -- I think the clickbench Q23 SELECT * FROM hits ORDER BY time DESC LIMIT 10 is a pretty good one as it is so simple but illustrates the point. More details can be summarized from #15177

    Background

    Show the plan for Q23

    Explain the existing topk optimization (that there is a heap)

    Explain that the query does much more work than necessary because it decodes all rows just to throw all but 10 of them away

    Introduce the notion of filter pushdown and point out that DataFusion does it at multiple phases

    • Listing table (prune files)
    • During opening (prune files again)
    • During row group / data page filtering
    • During the scan (if pushdown_filters is on)

    Dynamic Filters

    Explain that the topk operator knows the minimum time that could be emitted after the plan started -- basically like WHERE time > (current min in top k).

    However the current min isn't know at plan time

    Then describe the summary technical approach, highlighting that you made it general purpose to aslo support SIPs and other user defined dynamic filters; Also highlight you worked with the community to do this

    • Add an API for pushing down filter and introducing dynamic filters to ExecutionPlan trait
    • Add appropriate APIs for updating those filters at runtime and adding new points to prune (e..g on file open)

    Results

    Show some sort of results if possible

    Conclusion / Call to action

    This will be released in DataFusion 49

    Come help / join us / use DataFusion 🎣

  7. self-assigned this
    on Aug 17, 2025
  8. adriangb commented on Aug 17, 2025

    @adriangb
    Contributor

    I'd also like to list the "next steps" to 🎣 contributors:

  9. adriangb commented on Aug 19, 2025

    @adriangb
    Contributor

    Initial draft is up! apache/datafusion-site#102

  10. assigned and unassigned on Sep 4, 2025
  11. aaryyya commented on Oct 16, 2025

    @aaryyya

    as this feature is complete is this issue still open for documentation?

  12. adriangb commented on Oct 16, 2025

    @adriangb
    Contributor

    If there are updates or improvements you'd like to make this blog post or DataFusion's documentation it's very welcome, just make a new issue / PR!

  13. alamb commented on Oct 16, 2025

    @alamb
    ContributorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions