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

Better use of prepare and immutable bind #198

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Virgiel
Copy link
Member

@Virgiel Virgiel commented Feb 5, 2023

I found a way to have explicit prepare, implicit prepare for client with cache and immutable bind:

// If can cache, cache-prepare else doesn't prepare
// Same as current API but whiteout implicit prepare when it can add unamortized latency
query().bind(&client, 1).await?;

// Prepare once and reuse statement, best perf when reused
query().prepare(&client).await?.bind(&client,1).await?; 

We might want to add a method to disable preparation even if it can be cached (to reduce memory cost of rare queries)

Context: https://discord.com/channels/987088069280825401/1060289763443232879

@Virgiel Virgiel changed the title Bind client earlier Better use of prepare and immutable bind Feb 5, 2023
@Virgiel Virgiel marked this pull request as ready for review February 5, 2023 03:30
@LouisGariepy
Copy link
Member

I only did an overview, but this looks very promising from what I have seen. I'll take a full on look by the end of the week.

Thank you for you work on this PR, as always =]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants