Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SUMMARY ISSUE] - Batching and Non-uniform batches #2390

Open
hgschmie opened this issue Jun 14, 2023 · 0 comments
Open

[SUMMARY ISSUE] - Batching and Non-uniform batches #2390

hgschmie opened this issue Jun 14, 2023 · 0 comments
Labels
help wanted improvement Summary Summary issue to track a wider theme

Comments

@hgschmie
Copy link
Contributor

hgschmie commented Jun 14, 2023

This is a summary issue to track all the challenges with batches and especially non-uniform batches. It has all relevant issues and PRs linked to it so we can close those and still keep track of them.

The current batch code is pretty brittle, hard to understand and extend. It might be a good time to take a new, fresh look.

Issues:

challenges with non-uniform batches

Currently, the Jdbi code analyzes the structure for a batch operation by analyzing the very first line in the batch. It assumes that all following operations use the same argument types and structure and therefore caches the argument type resolution and tries to bind the arguments for following batch lines using the cached type resolution. This fails if the lines are non-uniform, e.g. an argument binds an integer for one line and a string for the next or a varying number of arguments.

Batch derives all of its speed from this caching. But to solve this problem for non-uniform batches, the solution would be to not cache which has no performance advantages over a simple loop executing the same statement again and again and resolving the argument bindings every time.

We spent a bit of time discussing this on the slack channel, there is a proposal to use "templates" where multiple sets of resolved arguments ("argument templates") are created and then a batch line can choose which template to use. This loosens up the rigid "every set of batch arguments must be uniform" but does not go all the way to "resolve the arguments anew for every line".

Issues:

PRs:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted improvement Summary Summary issue to track a wider theme
Development

No branches or pull requests

1 participant