Hydration performance issue on complex dataset
Problem
Issue type: [X] question [ ] bug report [ ] feature request [ ] documentation issue Database system/driver: [ ] `cordova` [ ] `mongodb` [ ] `mssql` [ ] `mysql` / `mariadb` [ ] `oracle` [X] `postgres` [ ] `sqlite` [ ] `sqljs` [ ] `react-native` TypeORM version: [ ] `latest` [ ] `@next` [X] `0.2.6` *Steps to reproduce or a small repository showing the problem: Hi, we have a performance issue in hydration for a (quite) complex query like this: [code block] This generates a SQL query like the following: [code block] The SQL query in our development database takes approximately 32ms and returns a raw resultset of approx 4400 rows, as you can see it's very fast. On the other hand the hydration process takes approx 4500ms running inside an hi-end Intel I7 CPU. Have you any clues why the hydration process takes so long ? Could be something related to the entities config ? Thanks in adavnce for your help, Leonardo
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Hydration performance issue on complex dataset
Ok, we are actually hitting the same problem right now. The worst part of this is that it's blocking our server (the nestjs thread) and I have no clue why. We have the same kind of architecture and complexity as @leoperria . Edit: So more info on this. After digging a bit the issue comes from the `RawSqlResultsToEntityTransformer.transform()` method. The massive use of find, map and other ope
Trust Score
5 verifications
- 1
Ok, we are actually hitting the same problem right now. The worst part of this i
Ok, we are actually hitting the same problem right now. The worst part of this is that it's blocking our server (the nestjs thread) and I have no clue why.
- 2
We have the same kind of architecture and complexity as @leoperria .
We have the same kind of architecture and complexity as @leoperria .
- 3
So more info on this. After digging a bit the issue comes from the `RawSqlResult
So more info on this. After digging a bit the issue comes from the `RawSqlResultsToEntityTransformer.transform()` method.
- 4
The massive use of find, map and other operators is probably the root cause. But
The massive use of find, map and other operators is probably the root cause. But the side effect is that all this is synchronous, meaning it's blocking.
Validation
Resolved in typeorm/typeorm GitHub issue #2381. Community reactions: 10 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep