alamb opened a new issue, #28003: URL: https://github.com/apache/datafusion/issues/28003
### Is your feature request related to a problem or challenge? The cost of creating Physical Plans (`ExecutionPlan`s) is non trivial (can take ms or more depending on the query complexity, optimizations, and other ideas). Currently `ExecutionPlan`s have state -- for example the contents of dynamic filters, subquery results, materialized CTEs, etc. so they can not be run concurrently as the concurrent executions can interfere with each other. thanks to @askalt it is possible to *reuse* an existing plan; Once a plan has completed executing, you can reset the internal state by calling [`ExecutionPlan::reset_state`](https://docs.rs/datafusion/latest/datafusion/physical_plan/trait.ExecutionPlan.html#method.reset_state) so However, you still can not reliable run the same plan concurrently and there is no easy way to make a "deep copy" or something similar to avoid the cost of re-creating the same plan plan Some potential usecases where reusing the same physical plan would be valuable: * Prepared statements: https://github.com/apache/datafusion/issues/26706 from @nuno-faria * one plan running at the same time, inside a single task as described by @AhmedSoliman in https://github.com/apache/datafusion/issues/19905#issuecomment-7276129451 It is not clear to me if prepared statements would actually run the exact same query plan, or if they would want to make a copy of at least some of the plan to fill in the bound parameter values and try and reoptimize (to do file pruning, for example) ### Describe the solution you'd like _No response_ ### Describe alternatives you've considered - Here is a proposal from @askalt https://github.com/apache/datafusion/issues/19351 - Here is another that came up when I was talking with @adriangb today https://github.com/apache/datafusion/issues/28002 ### Additional context _No response_ ### Willingness to contribute None -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
