Closed S3bb1 closed 4 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 89.79%. Comparing base (
925fd81
) to head (c44954b
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hi @mirceanis
I checked all findOne
references in the code. The only "bad" findOne
s are those which have included relations
setting.
What issue is this PR fixing
This PR addresses a performance issue with TypeORM (https://github.com/typeorm/typeorm/issues/5694)
When using
findOne()
with attached relations, TypeORM executes two queries:the two queries are specially gaining performance when doing pagination (where we have skip and take). In the datastore we explicitly don't want/need to page, just getting the first entry back.
When executing the query with just a "find" and taking the first element in the array, TypeORM executes only one query:
This results in a performance boost when generating VPs (in our case the "find" executes in half of the time as with "findOne")
Quality
Check all that apply:
pnpm i
,pnpm build
,pnpm test
,pnpm test:browser
locally.