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

Poor performance on high latency connections with varbit type #2959

Closed
fqazi opened this issue Oct 2, 2023 · 0 comments · Fixed by #2960
Closed

Poor performance on high latency connections with varbit type #2959

fqazi opened this issue Oct 2, 2023 · 0 comments · Fixed by #2960

Comments

@fqazi
Copy link
Contributor

fqazi commented Oct 2, 2023

Please read https://stackoverflow.com/help/minimal-reproducible-example

Describe the issue
When fetching type information for the varbit builtin types, poor performance can be encountered on high latency connections since OID information needs to be fetched from the database. Since this is a builtin type, we can add this directly into the TypeInfoCache to avoid queries for fetching type information for prepared statements.

Driver Version?
latest

Java Version?
any

OS Version?
MacOS Ventura

PostgreSQL Version?
16

To Reproduce
Making a query to fetch varbit column in a prepared statement and execute it, and observe on slower conection's this fetch adds to the execution time.

Expected behaviour
Because of the network latency, we initially have an extra round trip on a connection fetch type information.

Possible fix
Adding this information to TypeInfoCache would avoid overhead. It also makes logical sense since it's a built-in type. I know there is #908 to add proper support, but the proposal is to map this to TYPES.OTHER and java.lang.String similar to the metadata fetch.

fqazi added a commit to fqazi/pgjdbc that referenced this issue Oct 2, 2023
Currently, extra queries are needed to resolve type information for the
varbit type, even though the OID and type information are entirely
predictable. This patch will adds the builtin type into the TypeInfoCache,
to avoid extra round trips on high latency connections.

Fixes: pgjdbc#2959
davecramer pushed a commit that referenced this issue Oct 6, 2023
Currently, extra queries are needed to resolve type information for the
varbit type, even though the OID and type information are entirely
predictable. This patch will adds the builtin type into the TypeInfoCache,
to avoid extra round trips on high latency connections.

Fixes: #2959
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.

1 participant