Repository navigation
Description
Bug description
This is a summary from Claude
Comparison: Prisma 6 vs Prisma 7
Performance & Memory Metrics Comparison
| Metric | Prisma 6 | Prisma 7 | Change |
|---|---|---|---|
| TypeScript Compilation Time | 60.23s | 62.97s | +4.5% slower |
| Memory Used (tsc) | 5,531MB | 7,298MB | +32% more memory |
| Total Types | 1,585,693 | 5,093,854 | +221% more types |
| Type Instantiations | 11,441,158 | 30,242,287 | +164% more instantiations |
| Files Analyzed | 9,371 | 8,951 | -4.5% fewer files |
| Total Lines | 4,137,772 | 2,136,914 | -48% fewer lines |
| Model Files Size | 31MB (603,685 lines) | 31MB (607,567 lines) | ~Same size |
| tsserver Memory | 816MB + 162MB | 22MB + 20MB | -95% less (after conversion) |
Key Differences
- Prisma 7 is WORSE for TypeScript Performance:
- 30.2 million type instantiations (vs 11.4M in v6)
- 7.3GB memory usage (vs 5.5GB in v6)
- 5 million types generated (vs 1.6M in v6) - Model File Structure Changed:
// Prisma 7 - Still heavy but different structure
export type QuoteModel = runtime.Types.Result.DefaultSelection<Prisma.$QuotePayload> - vs Prisma 6:
export type QuoteModel = runtime.Types.Result.DefaultSelection<Prisma.$QuotePayload> - Why Prisma 7 is Worse:
- 3x more type instantiations (30M vs 11M)
- 3x more types generated (5M vs 1.6M)
- 32% more memory usage
- Similar compilation time but with much higher resource usage
Critical Finding
Prisma 7 made the TypeScript performance problem significantly WORSE:
- Type instantiations increased by 164%
- Memory usage increased by 32%
- Total types increased by 221%
This explains why the lightweight conversion to Prisma.GetPayload<{}> types is even more critical with Prisma 7. The newer version generates substantially more complex type definitions, causing:
- Exponential growth in type checking complexity
- Massive memory consumption
- Slower IDE responsiveness
Severity
Reproduction
Hard to reproduce.
Expected vs. Actual Behavior
See the report above
Frequency
Consistently reproducible
Does this occur in development or production?
Only in development (e.g., CLI tools, migrations, Prisma Studio)
Is this a regression?
Yes. Upgrading from 6 -> 7.2.0.
Workaround
Downgrading.
Prisma Schema & Queries
// Add relevant schema.prisma snippet// Add relevant Prisma Client queryThis is a massive project
Prisma Config
// Add your `prisma.config.ts`Logs & Debug Info
// Debug logs here
Environment & Setup
- OS: macOs
- Database: PostgreSQL
- Node.js version: 22
Prisma Version
// Prisma version output
prisma : 7.2.0
@prisma/client : 7.2.0
Operating System : darwin
Architecture : arm64
Node.js : v22.14.0
TypeScript : 5.9.3
Query Compiler : enabled
PSL : @prisma/prisma-schema-wasm 7.2.0-4.0c8ef2ce45c83248ab3df073180d5eda9e8be7a3
Schema Engine : schema-engine-cli 0c8ef2ce45c83248ab3df073180d5eda9e8be7a3 (at node_modules/.pnpm/@prisma[email protected]/node_modules/@prisma/engines/schema-engine-darwin-arm64)
Default Engines Hash : 0c8ef2ce45c83248ab3df073180d5eda9e8be7a3
Studio : 0.9.0
Preview Features : fullTextSearchPostgres, relationJoins, views
Activity
mmahalwy commentedon Jan 8, 2026
Another test I just ran
TypeScript Performance Comparison: Prisma 6 vs Prisma 7
Here's the comparison after downgrading back to Prisma 6:
Performance Metrics
Key Findings
Prisma 6 is significantly better for TypeScript performance:
Summary
The downgrade to Prisma 6 provides:
Recommendation: Stay on Prisma 6 until Prisma addresses the significant performance regression in v7. The v7 upgrade introduced massive type complexity that makes TypeScript compilation significantly slower and
more memory-intensive.
mmahalwy commentedon Jan 13, 2026
I guess this isnt important?
yigitahmetsahin commentedon Jan 19, 2026
Similar issue also reported in #28776 . @jacek-prisma can you please also check here.
Aluisio commentedon Jan 22, 2026
@mmahalwy Yesterday version 7.3.0 was released. Could you run the benchmarks again? It would also be interesting to know the performance difference between compilerBuild fast and small.
yigitahmetsahin commentedon Jan 28, 2026
@mmahalwy have you observed any improvements with the new version?
Xetoxyc commentedon Jan 28, 2026
@yigitahmetsahin at least we do not feel like anything is faster, we still have to wait mutliple seconds even with 7.3
No matter on the compiler build option
i do not have this performance overview as @mmahalwy does
mmahalwy commentedon Feb 10, 2026
@Aluisio i can run this test tonight. Sorry for the late reply here.
mmahalwy commentedon Feb 11, 2026
@Aluisio it doesnt make a difference at all....
Here's the GitHub comment:
Prisma 7.3
compilerBuild—fastvssmallvs Prisma 6.19TypeScript Performance
All benchmarks run with
--incremental false,--noEmit.What
compilerBuildActually DoesThe
compilerBuildoption only changes the runtime WASM query compiler bundle — it swaps 3 import references inclass.tsbetweenquery_compiler_fast_bgandquery_compiler_small_bg. That's it.It has zero impact on TypeScript type generation. The generated types, models, and internal namespace files are byte-for-byte identical between
fastandsmall. All type metrics (Types, Instantiations, Symbols) are exactly the same.Key Takeaway
compilerBuildis a runtime performance vs bundle size tradeoff for the WASM query compiler:fast= larger WASM (4.6 MB), optimized for query execution speedsmall= smaller WASM (2.3 MB), optimized for serverless/edge bundle sizeIt does nothing to address the TypeScript performance regression (3.5× more type instantiations, 2.7× slower compilation). The core problem remains in the
@prisma/client/runtime/client.d.tstype definitions, whichcompilerBuilddoesn't touch.Aluisio commentedon Feb 11, 2026
sanny-io commentedon Feb 11, 2026
@Aluisio you may be confusing compile/build time typescript compilation performance vs runtime query performance related to query compilation.
Those are not the same thing. This issue is regarding typescript compilation at compile/build time.
mmahalwy commentedon Feb 18, 2026
@sanny-io correct. @Aluisio this has to do with typescript, not the engine.
timAdrien commentedon Feb 27, 2026
I'm experiencing the same problem. My production build takes infinite type checking, I debugged and it's effectively the resolution of millions of types for only few tables that takes so long... How is that possible to release a such thing ? CPU hang on it:
vincentrolfs commentedon Mar 20, 2026
This issue makes Prisma 7 unusable for us. See also the related #28967
16 remaining items
mmahalwy commentedon May 28, 2026
@jacek-prisma this is getting frustrating, we literally cannot upgrade to any 7.x version. This is the latest for 247 models
Aluisio commentedon May 28, 2026
To me it's clear: Prisma 7 was released prematurely, and with the development of the new Prisma "next," it's been forgotten.
What worries me most is that Prisma "next" will alter the syntax and have major breaking changes, which will make migration impossible for large, professional projects.
I'm still using version 6 and I'm already convinced that I'll hardly migrate to another version. How am I going to rewrite more than 1000 selects in a Prisma update to the "next" version? Impossible!
If I have to rewrite my code, I'll seriously consider migrating to another ORM as well.
osulli commentedon May 29, 2026
Sort of in the same boat. To migrate to Prisma 7 now seems like a footgun - I'm waiting on 1.0 of Drizzle to do a comparison - I was originally against Drizzle as I don't like writing SQL and with Drizzle being closer to SQL I was against it but... then I realised that in all honesty Claude writes 99.9% of any DB queries anyway so.
I hope Prisma Next becomes a reasonable choice by the time Drizzle 1.0 is out as otherwise Prisma is out of the running which will be a shame.
Prisma 6 is doing just fine for now though but my concern is that it is now "2 versions" behind in Prisma's eyes so it can't be a long-term pick anymore.
sanny-io commentedon May 29, 2026
@Aluisio @osulli you should consider using ZenStack. Its function signatures and schema are Prisma compatible, but it's powered by Kysely, and includes many new features. I have switched to it a while ago and it's been great.
https://zenstack.dev
nfl1ryxditimo12 commentedon May 30, 2026
Hi 👋 cc @jacek-prisma @jkomyno @aqrln — apologies for the direct ping. I spent some time digging into this regression and opened #29592 with what looks like a small, targeted fix. It would be great if someone could take a look when review bandwidth allows.
As far as I can tell, the regression traces back to #28375, which changed the
OmitOptsdefault on thePrismaClientinterface from its constraint toundefined:This seems to unintentionally revert the short-circuit optimization from #27777 / ORM-850. My current understanding is that when the default equals the constraint, a bare
PrismaClient— the common “no client options” case — resolvesOmitOptsto its constraint, allowing TypeScript to reuse a single canonical instantiation across model delegates.With
= undefined, each delegate appears to be re-instantiated with{ omit: undefined }, which re-runs the omit-application chain (ExtractGlobalOmit→ApplyOmit) per model × per operation. That seems consistent with the ~30M type instantiations reported here. I have not traced the compiler internals, so please treat this part as my best-effort explanation.One thing I did confirm: the resolved result types are identical either way — both apply no global omit — so this appears to be an evaluation-cost regression rather than a behavior change.
Rough benchmark on a 406-model schema using
tsgo --extendedDiagnostics:= undefinedcurrent= …['omit']fixMore detail is in #29592. Please feel free to correct me if I missed something — I’m happy to adjust the PR if there is a better way to approach this.
fix(client): restore OmitOpts default type to improve type-checking p…
mmahalwy commentedon Jun 12, 2026
I love you all for fixing this.... but this has been open since Jan. It took ~6 months for a 1-line change? 😓
Aluisio commentedon Jun 25, 2026
@mmahalwy Just a single line, and they still haven't released the fix.
It's clear they are focused on Prisma Next and aren't concerned with maintaining versions 6 and 7.
SagnikPradhanPearSuite commentedon Jul 14, 2026
In case anybody is interested, you can add a small bash script to patch it manually after every generation
feat(prisma): migra para Prisma 7 sem engine Rust (prisma-client-js +… (
fix(client): restore OmitOpts default type to improve type-checking p…
docs(adr-099): say what the generated Prisma bulk is, and is not
refactor(typescript): move the workspace to TypeScript 7, and stop a …
refactor(typescript): move the workspace to TypeScript 7, and stop a …