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

Statement caching for PostgreSQL #2720

Closed
pimeys opened this issue Jun 11, 2020 · 2 comments
Closed

Statement caching for PostgreSQL #2720

pimeys opened this issue Jun 11, 2020 · 2 comments
Assignees
Labels
kind/feature A request for a new feature. tech/engines Issue for tech Engines. topic: performance
Milestone

Comments

@pimeys
Copy link
Contributor

pimeys commented Jun 11, 2020

Motivation

As described in the epic, caching statements saves a lot of database CPU time and would be beneficial for our users.

As I described in my comment, doing this for MySQL or SQLite right now requires much bigger changes, so we'll do it first for PostgreSQL.

Requirements

  • implement prepared statement caching in our SQL library quaint
  • quaint users must be able to opt in to this feature (we observed that caching leads to problems in the migration engine)
  • the cache settings must be configurable through a parameter in the connection string of a datasource.
    • suggested name for this parameter: preparedStatementCacheSize. It specifies the maximum number of entries in that cache.
    • If the the parameter is set to 0 the cache is deactivated.

Validating the performance improvement with:

  • Chihiro benchmarks with the normal queries, graphs and notion and all that.
  • Valgrind for memory usage
  • htop for postgres and application CPU usage
@pimeys
Copy link
Contributor Author

pimeys commented Jun 19, 2020

Naming the parameter as statement_cache_size due to all other parameters being snake_case too...

pimeys pushed a commit to prisma/prisma-engines that referenced this issue Jun 19, 2020
pimeys pushed a commit to prisma/prisma-engines that referenced this issue Jun 19, 2020
pimeys pushed a commit to prisma/prisma-engines that referenced this issue 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
@pimeys
Copy link
Contributor Author

pimeys commented Jun 19, 2020

Merged in prisma/prisma-engines#828

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature A request for a new feature. tech/engines Issue for tech Engines. topic: performance
Projects
None yet
Development

No branches or pull requests

2 participants