Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Re-design execution engine's output pipeline. #1270

Open
pmenon opened this issue Oct 24, 2020 · 0 comments
Open

Re-design execution engine's output pipeline. #1270

pmenon opened this issue Oct 24, 2020 · 0 comments
Labels
performance Performance related issues or changes.

Comments

@pmenon
Copy link
Member

pmenon commented Oct 24, 2020

Feature Request

Summary

The execution currently buffers query output into local buffers and invokes a callback once these buffers are full. These intermediate buffers add overhead since we materialize "fat" SQL values, but also prevent the consumer of the query to push down logic into generated code.

Side note: The current OutputCallback can be invoked by multiple threads, but isn't documented for some reason.

Solution

I propose adding an ExecutionTarget interface type that participates in the translation infrastructure. Subclasses have the opportunity to generate code as part of the push-based data flow. This will replace the existing OutputTranslator. It is the responsibility of this ExecutionTarget to consume the result of the output. This also allows execution targets to be aware of and specialize handling for parallel query execution.

A trivial policy duplicates the current OutputTranslator logic into a BufferingExecutionTarget type that buffers results and dispatches into an injected callback. Another example would be a LibpqxxExecutionTarget that direclty invokes functions to serialize rows into network buffers.

This is the approach I've taken in my TPL repo, and it seems to work pretty well.

@lmwnshn lmwnshn added the performance Performance related issues or changes. label May 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
performance Performance related issues or changes.
Projects
None yet
Development

No branches or pull requests

3 participants