Skip to content

Add auto_explain mode #19215

@nuno-faria

Description

@nuno-faria

Is your feature request related to a problem or challenge?

It would be useful to collect plans from queries automatically, without needing to explicitly add EXPLAIN ANALYZE. This would ensure that the original application would not need to change, as the queries would still return data as normal, while the plans would be printed to stdout/stderr.

Some existing systems already support this feature, like auto_explain in Postgres and eqp in SQLite.

Describe the solution you'd like

Some datafusion.execution.auto_explain config that would enable this feature.

I already created a small proof of concept and this feature would be relatively easy to implement. We just need to wrap execution plans in an AnalyzeExec. This AnalyzeExec would also need a flag to know when it's in the auto_explain mode, in which case it would print the plans and return the input batches.

I would be happy to create a PR with this.

Describe alternatives you've considered

Adding EXPLAIN ANALYZE manually, but this changes the application.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions