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

Question: select count optimization #723

Open
stalexxx opened this issue Nov 15, 2017 · 0 comments
Open

Question: select count optimization #723

stalexxx opened this issue Nov 15, 2017 · 0 comments

Comments

@stalexxx
Copy link

First of all, thank you for great work!
So, I am working with google clound sql and it performs very poor on sql connection, so I try to optimize my query amount, so, for example I have following data model:

@entity
interface Racer : Persistable {
@get:Key
@get:Generated
@get:JsonView(Views.Rating::class)
var id: Int

@get:JsonView(Views.Rating::class)
var name: String

@get:JsonView(Views.Rating::class)
var number: Int

}

@entity
interface Rating : Persistable {
@get:Key
@get:Generated
var id: Int

@get:ManyToOne
@get:Column(name = "racer_id")
var racer: Racer

}

Then, I want to retrieve full list of ratings with racers and it is clear for me that we can retrieve full list by one select with join, but how?
Another way that I can imagine is to select full list on Racers and when we select Ratings, racers should already be loaded from cache.. but they don't
Otherwise I got 1 + n selects, that's to crappy

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

1 participant