Very slow nested writes when connecting with remote DB Postrgsql on AWS
See original GitHub issueI am currently testing different ORMs to find a good fit for our project. I write a very basic query with a nested write in Prisma which takes an extremly long time.
See my schema:
model Context {
id Int @id @default(autoincrement())
contextName String
createdAt DateTime @default(now())
statements Statement[]
}
model Statement {
id Int @id @default(autoincrement())
content String
context Context @relation(fields: [contextId], references: [id], onDelete: Cascade)
contextId Int
createdAt DateTime @default(now())
}
I create a new context with around 600 statements inside. This the code sample:
const context = await this.prisma.context.create({
data: {
contextName: contextData.name,
statements: {
create: statements,
},
},
include: {
statements: true,
},
});
I’ve tried to debug the request but haven’t noticed anything suspicious from the Prisma output.
Check out the repo to see the full code and the request.
If I write to the local DB with prisma it takes around 4s vs to remote DB is more than 100s
The same operation with typeorm takes around 2s to the remote DB.
Any hints on how can improve the query?
_Originally posted by @monapasan in https://github.com/prisma/prisma/discussions/9552_
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Prisma: very slow nested writes when connecting with remote ...
When connecting to PostgreSQL on AWS it goes up to 90 seconds. Any ideas why is it taking so long? Please find an...
Read more >Troubleshoot performance issues in RDS and Aurora ...
My Amazon Relational Database Service (Amazon RDS) for PostgreSQL instance is slow. I want to identify and troubleshoot the slow-running ...
Read more >Improving query performance - Amazon Redshift
To fix this issue, run ANALYZE. Nested loop. If a nested loop is present, you might see a nested loop alert event in...
Read more >Factors affecting query performance - Amazon Redshift
Dataset size – A higher volume of data in the cluster can slow query performance for queries, because more rows need to be...
Read more >Diagnostic queries for query tuning - Amazon Redshift
This topic provides queries to identify issues with queries or their underlying tables that can affect query performance.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I understand your point. Thanks for agreeing to help, I have already created an issue about this in the docs repository. Please feel free to follow it or drop a comment if you have any suggestions!
And you can be assured this wasn’t an intentional omission 😅
Awesome. Glad I could help 😄
This is a very good point. We need to make this information more discoverable if it isn’t already. I will make sure to bring this up internally 👌
Btw I’m closing this issue as I’m assuming your problem has been resolved.