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

Use prepared statement metadata to decode results of prepared statements #169

Closed
piodul opened this issue Feb 20, 2021 · 1 comment · Fixed by #925
Closed

Use prepared statement metadata to decode results of prepared statements #169

piodul opened this issue Feb 20, 2021 · 1 comment · Fixed by #925
Assignees
Milestone

Comments

@piodul
Copy link
Collaborator

piodul commented Feb 20, 2021

As of now (075ad41), when executing a statement - no matter if prepared or unprepared - we always request full result metadata to be returned in response. This metadata contains information about the type of each column returned in response, and we use it to decode rows from the response.

However, for prepared statements, this information is not necessary - the same metadata can be returned by the DB when the statement is being prepared and can be cached by the driver. When executing prepared statements, we can request the metadata to be omitted in response and use the cached metadata instead, which will save some bandwith.

There is at least one problem this approach is known to have, so we should discuss how to handle it: https://docs.datastax.com/en/developer/java-driver/3.0/manual/statements/prepared/#avoid-preparing-select-queries

@cvybhu
Copy link
Contributor

cvybhu commented Sep 29, 2023

Requesting the full metadata on every SELECT could cause significant overhead.

Recently a user reported that on the same workload Rust driver uses 60MiB/s of network bandwidth while the C++ driver uses only 23MiB/s. (https://scylladb-users.slack.com/archives/C01D7LCL44D/p1695956648707279)
I suspect that this could be caused by us not using the skip_metadata flag, for a SELECT with only a few int values sending the metadata could easily double the used bandwidth.

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 a pull request may close this issue.

4 participants