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

Do two preloads of the same model with one query #66

Open
yansal opened this issue Jun 20, 2019 · 0 comments
Open

Do two preloads of the same model with one query #66

yansal opened this issue Jun 20, 2019 · 0 comments
Labels

Comments

@yansal
Copy link
Contributor

yansal commented Jun 20, 2019

Let's say we have the following models

type User struct {}
type Project struct {
    Owner *User
    Manager *User
    Supporters []User
}

We want to query a project and preload the Owner, Manager and Supporters fields.

Today makroud does 3 queries. An optimization could be to do the 3 preloads with one query, as they all are in the same table.

@yansal yansal changed the title Do two preloads of the same model in one query Do two preloads of the same model with one query Jun 20, 2019
@yansal yansal added the ideas label Jun 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant