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
create method performance issues. #5474
Comments
Related #5475 |
Hey @yousufhasan Was this working in older version? Please try enabling unix domain socket transport once for data between prisma engine. Here is how you can do that: const prisma = new PrismaClient({
__internal:{
useUds: true
}
} as any); // remove as any if you are using js |
I would be interesting to confirm which version of Prisma you are running, from #5475 it seems it's |
Still getting the error: Yes the version is 2.16.0 |
Ok, this seems unrelated to uds. Would it be possible for you share your schema here so that we can look into the data structure and try reproducing this? |
Here is the data, You can duplicate it like 20,000 organizations each having 20 metas and 20 subOrganisations each having 15 metas. Apart from getting this error the other issue is because createMany doesn't work with nesting and create generates single query for each record. the performance is very bad when we compare it with other ORMs like TypeORM. also since $transactions doesn't support dependent entities we can not do it inside transactions as well. That is why support of nested queries with createMany is essential. {
"code": "3434",
"name": "test1",
"createdDate": "2021-02-10T01:06:45.074Z",
"updatedDate": "2021-02-10T01:06:45.074Z",
"organisations": {
"create": [
{
"name": "test1",
"createdDate": "2021-02-10T01:06:45.074Z",
"updatedDate": "2021-02-10T01:06:45.074Z",
"metas": {
"createMany": {
"data": [
{
"key": "dfdffd",
"value": "dfdff",
"createdDate": "2021-02-10T01:06:45.074Z",
"updatedDate": "2021-02-10T01:06:45.074Z"
},
{
"key": "dfdffd",
"value": "dfdff",
"createdDate": "2021-02-10T01:06:45.074Z",
"updatedDate": "2021-02-10T01:06:45.074Z"
}
]
}
},
"subOrginsations": {
"create": [
{
"name": "test1",
"createdDate": "2021-02-10T01:06:45.074Z",
"updatedDate": "2021-02-10T01:06:45.074Z",
"metas": {
"createMany": {
"data": [
{
"key": "dfdffd",
"value": "dfdff",
"createdDate": "2021-02-10T01:06:45.074Z",
"updatedDate": "2021-02-10T01:06:45.074Z"
},
{
"key": "dfdffd",
"value": "dfdff",
"createdDate": "2021-02-10T01:06:45.074Z",
"updatedDate": "2021-02-10T01:06:45.074Z"
}
]
}
}
}
]
}
}
]
}
}
|
We have a createMany method now which addressed this. I am going to close this. |
When passing a very large object e.g. 1 million records with many sub entities to create method. It doesn't start running queries for few minutes and only after taking few minutes it starts running the queries. I can't see any thing on my terminal until after few minutes which impacts the performance badly. It doesn't take that longer if the object size is smaller.
proivder: postgresql
binaryTargets = ["native", "linux-musl"]
Version: PostgreSQL 13.1 (Debian 13.1-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
The text was updated successfully, but these errors were encountered: