Skip to content
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

query relations #1105

Closed
prophetdeng opened this issue Jan 8, 2025 · 2 comments
Closed

query relations #1105

prophetdeng opened this issue Jan 8, 2025 · 2 comments

Comments

@prophetdeng
Copy link

Is it possible to configure bun to load relations by multiple query instead of join?

@j2gg0s
Copy link
Collaborator

j2gg0s commented Jan 9, 2025

For belongs-to & has-one?

Could you provide an introduction to the specific situations where such a requirement arises?
I am not familiar with this.

@emoss08
Copy link
Contributor

emoss08 commented Jan 16, 2025

Is it possible to configure bun to load relations by multiple query instead of join?

If you're doing belongs-to & has-one, this would cause N+1 queries. If you're doing relations on a m2m or has-many it should already do this for you.

If you still want to do this, you can always have a struct that you append to with the query results, but I imagine that would be very slow and probably not optimal for any database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants