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

Possibility to share the type cache across clients #1039

Open
rudolphfroger opened this issue Jun 2, 2023 · 4 comments
Open

Possibility to share the type cache across clients #1039

rudolphfroger opened this issue Jun 2, 2023 · 4 comments

Comments

@rudolphfroger
Copy link

It would be great if one would be able to share the type cache, for example by providing a shared instance of the cache when creating a new connection. For larger scale usage of PostgreSQL the usage of external connection poolers like PgBouncer can bring certain benefits. Often this also means using quite short lived connections to a local PgBouncer instance. Every new client has a fresh type cache so that leads to unnecessary overhead of looking up type information.

Would you be open to add such functionality? Me or one of my colleagues could help by starting a PR.

@rudolphfroger rudolphfroger changed the title Possibility to share the type cache across connections Possibility to share the type cache across clients Jun 2, 2023
@sfackler
Copy link
Owner

sfackler commented Jun 2, 2023

Is the bouncer sitting in front of a cluster of Postgresi? If so, I don't know if I'd expect to be able to guarantee that the OIDs of types defined by extensions would be identical across the entire cluster.

@rudolphfroger
Copy link
Author

The bouncer is in front of a single PostgreSQL instance. Such a feature should go with a warning that sharing the cache across connections is only safe when the connection are made to the same database and server instance.

@sfackler
Copy link
Owner

sfackler commented Jun 7, 2023

If there's only a single instance, it seems like an application-level connection pool would work? I may be missing something about what value the bouncer provides.

@rudolphfroger
Copy link
Author

rudolphfroger commented Jun 8, 2023

Our application uses multiple processes so an external connection pooler helps to reduce the number of idle connections. But even without a pooler it may be beneficial to share the type cache between connections within an application-level connection pool.

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

No branches or pull requests

2 participants