Comments (5)
Prisma actually uses prepared statements under the hood and also caches and reuses them.
I hence renamed the issue a tiny bit to make this a request for "manually managing" prepared statements.
from prisma.
Prisma actually uses prepared statements under the hood and also caches and reuses them.
I hence renamed the issue a tiny bit to make this a request for "manually managing" prepared statements.
If so, suppose if I have a conditional parameter like this
const isUsername = true
const username = "kavya"
PrismaClient.users.findUnique(
isUsername ? { where: { username } } : { where: { email: username } }
);
// there can be two different prepared sql query which are
// 1) select x,y,z from users where username="kavya"
// 2) select x,y,z from users where email="kavya"
Is this handled by prisma caching mechanism? like which query to select form cache.
It gets even more complicated when using multiple conditional statement in complex queries.
from prisma.
Yes, when executing these different "paths" different queries are generated - and the correct prepared statement from the cache is used for each case.
from prisma.
Alright, that's nice but still we need a manual prepared statement feature to optimize queries further and remove redundant overhead. Are contributors actively working on this?
from prisma.
We at Prisma are not.
from prisma.
Related Issues (20)
- `update`: Compile-time error is missing if suppliying non-objects to `data` argument
- Add full MongoDB queries to query spans
- findUnique behavior
- Accelerate breaks "PrismaClient is unable to run in this browser environment, or has been bundled for the browser" HOT 3
- Prisma (v5.12 & v5.14 & v5.15) client has errors accessing `cockroachdb` when using with cloudflare workers and the new `driverAdapter` preview feature
- Update behavior inconsistent between 1-n and 1-1 relation queries HOT 2
- Custom output path behaves different with `prismaSchemaFolder` preview feature HOT 10
- [Instrumentation] `registerInstrumentations` uses the global provider instead of the one passed in HOT 1
- Database migration error HOT 3
- Prisma Multiple Schema Migrations HOT 10
- `migrate diff` complains about schema not listed even though it is present HOT 1
- `prisma:engine:db_query` span missing for `count`/`aggregate` with MongoDB
- Prisma `Unsupported()` columns can be overwritten HOT 5
- Type issue where field is not null HOT 2
- Missing generated Enum in typescript definition when Enum isn't used in Prisma table
- internal error: entered unreachable code HOT 2
- Edge runtime incompatibility error on `$on` or `$use` usage attempt HOT 4
- Return a proper error code and description when encountering zero dates
- Filtering by relationship using "some" results in inefficient queries due to un-correlated sub queries
- Support nested queries in `query` extension
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prisma.