Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Enabling statement cache for PostgreSQL #143

Merged
merged 2 commits into from Jun 19, 2020
Merged

Enabling statement cache for PostgreSQL #143

merged 2 commits into from Jun 19, 2020

Conversation

pimeys
Copy link
Contributor

@pimeys pimeys commented Jun 17, 2020

Adds a new parameter statement_cache_size to enable statement caching for PostgreSQL. By default 0, meaning no cache. If pgbouncer flag is on, cache will be disabled.

issue: prisma/prisma#2720

Copy link
Contributor

@tomhoule tomhoule left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tight code, short PR, nice!

@@ -226,6 +236,7 @@ impl PostgresUrl {
let mut socket_timeout = None;
let mut connect_timeout = None;
let mut pg_bouncer = false;
let mut statement_cache_size = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll probably figure things out as we start using it, but for other quaint users, if it works we may want to default to a non-zero size.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to enable this to everybody by default. Should be opt-in.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no other way to reuse prepared statements currently, so this should at least to be well documented.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Making the default here to 500. Let's see...

@pimeys pimeys self-assigned this Jun 17, 2020
@pimeys pimeys added the kind/feature A request for a new feature. label Jun 17, 2020
@pimeys pimeys added this to the 2.1.0 milestone Jun 19, 2020
@pimeys pimeys merged commit 1488842 into master Jun 19, 2020
@pimeys pimeys deleted the pg-stmt-cache branch June 19, 2020 14:28
pimeys pushed a commit to prisma/prisma-engines that referenced this pull request Jun 19, 2020
pimeys pushed a commit to prisma/prisma-engines that referenced this pull request Jun 19, 2020
pimeys pushed a commit to prisma/prisma-engines that referenced this pull request Jun 19, 2020
* Caching postgres statements

* Enabling statement caching for PostgreSQL

- Quaint PR: prisma/quaint#143
- Issue: prisma/prisma#2720

* Disabling statement caching on ME
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature A request for a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants