-
Notifications
You must be signed in to change notification settings - Fork 26
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
TypeORM discussion #1131
Comments
Public app optimizations:
Backend:
|
@seanmalbert Together with @bpsushi we are having problems with exposing listing in application DTO as IdDto without joining it earlier using a query builder. Expected model:
Current state is that we would like to use My suspicion is that since we are extending application.entity.ts entity class (with OmitType) we are inheriting decorators for keys that are omitted too and later those are passed to class-transformer (unexpectedly). What we want to try next is geting rid of |
Is there more we want to do on this or can I close? @pbn4 |
The problem with our current setup (my subjective opinion):
Excessive memory usage when querying listings and applications because of nested joins, see issues:
relations
typeorm/typeorm#3857The problem is two-fold: TypeORM might be better with memory usage when handling nested relations and our data model requires many JOIN operations to fetch all data requires for server response.
Querybuilder ease of use, right now to join relations we have to write something like this:
which I find problematic because this is not typed in any way and you have no guarantee that what's actually returned matches your runtime model, you have to check it yourself.
Potential solutions
Point 1 is crucial, point 2 is something we can live with eventually. I've been watching those linked issues for quite a bit now and there seems to be no progress in improving performance, neither do I feel competent to fix it myself and submit a PR to TypeORM repo, so we have two options:
Option 1. Query optimizations for Application and Listing models.
Applications
Currently we have a following query built on each application retrieval:
I think we could optimize it slightly by removing:
user
join because we do not return user information in application DTOs at alllisting
join because we only return listingId from the APIListings
We currently cannot optimize any joins:
so we solved long query time with http caching, which we will not be able to use when we introduce CMS (data changes should be reflected immediately in e.g. preview).
Option 2. Find TypeORM replacement:
This approach requires:
Finding an ORM which:
Replacing TypeORM with this new ORM:
ORMs that I'm currently researching:
The text was updated successfully, but these errors were encountered: