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

Prisma is 100x slower than "better-sqlite" #12785

Open
Mwni opened this issue Apr 12, 2022 · 3 comments
Open

Prisma is 100x slower than "better-sqlite" #12785

Mwni opened this issue Apr 12, 2022 · 3 comments
Labels
domain/client Issue in the "Client" domain: Prisma Client, Prisma Studio etc. kind/improvement An improvement to existing feature and code. topic: performance/queries topic: performance topic: sqlite

Comments

@Mwni
Copy link

Mwni commented Apr 12, 2022

Bug description

Running the same query, for example a simple INSERT, takes about 1ms with prisma, and 0.01ms with better-sqlite.
Is this a known issue or is there something wrong with my setup?

How to reproduce

https://github.com/Mwni/prisma-vs-better-sqlite

Environment & setup

  • OS: Darwin & Windows
  • Database: SQLite
  • Node.js version: 16.2

Prisma Version

prisma                  : 3.12.0
@prisma/client          : 3.12.0
Current platform        : darwin
Query Engine (Node-API) : libquery-engine 22b822189f46ef0dc5c5b503368d1bee01213980 (at node_modules/@prisma/engines/libquery_engine-darwin.dylib.node)
Migration Engine        : migration-engine-cli 22b822189f46ef0dc5c5b503368d1bee01213980 (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine    : introspection-core 22b822189f46ef0dc5c5b503368d1bee01213980 (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary           : prisma-fmt 22b822189f46ef0dc5c5b503368d1bee01213980 (at node_modules/@prisma/engines/prisma-fmt-darwin)
Default Engines Hash    : 22b822189f46ef0dc5c5b503368d1bee01213980
Studio                  : 0.459.0
@Mwni Mwni added the kind/bug A reported bug. label Apr 12, 2022
@Mwni
Copy link
Author

Mwni commented Apr 12, 2022

I was able to trace the origin down to the binary query engine. It makes up about 80% of the query time. From there on it's getting harder to profile this...

@Mwni Mwni changed the title SQLite is 100x slower than "better-sqlite" Prisma is 100x slower than "better-sqlite" Apr 12, 2022
@janpio janpio added domain/client Issue in the "Client" domain: Prisma Client, Prisma Studio etc. bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. topic: sqlite topic: performance labels Apr 15, 2022
@andykais
Copy link

If I had to guess, this probably has to do with a lack of query caching....but if I had to guess further, I would be very confused why thats an issue either, since most sqlite driver libraries have a caching layer below prepared statements

@dpetrick dpetrick removed bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. labels May 3, 2022
@tomhoule tomhoule added the kind/improvement An improvement to existing feature and code. label May 3, 2022
@janpio
Copy link
Member

janpio commented Sep 7, 2023

Probably related: #3303

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain/client Issue in the "Client" domain: Prisma Client, Prisma Studio etc. kind/improvement An improvement to existing feature and code. topic: performance/queries topic: performance topic: sqlite
Projects
None yet
Development

No branches or pull requests

5 participants