Dario Pellegrini
05/18/2022, 10:18 AMfindById
I see a large number of SELECT queries instead of a single one. This could be a problem if server and database are not in the same network. Is there any way to force Exposed use a single query?
class HighlightDAO(id: EntityID<Int>): IntEntity(id) {
companion object : IntEntityClass<HighlightDAO>(Highlights)
val video by VideoDAO referencedOn Highlights.video
val preview by FileDAO referencedOn Highlights.preview
val title by Highlights.title
var createdAt by Highlights.createdAt
var match by MatchDAO referencedOn Highlights.matchId
var players by PlayerDAO via HighlightsPlayers
val events by HighlightEventDAO referrersOn HighlightEvents.highlightId
val homeScore by Highlights.homeScore
val awayScore by Highlights.awayScore
val empty by Highlights.empty
}
...
HighlightDAO.findById(highlightId)
neetkee
05/19/2022, 2:54 PMfindById
. Do you also request any referencedOn
fields by any chance?Dario Pellegrini
05/19/2022, 9:56 PMneetkee
05/20/2022, 7:02 AMHighlightDAO.wrapRow
Dario Pellegrini
05/20/2022, 10:17 AMLucas
06/22/2022, 3:38 PMDario Pellegrini
06/22/2022, 3:40 PMLucas
06/22/2022, 3:43 PMDario Pellegrini
06/22/2022, 3:47 PMLucas
06/22/2022, 4:03 PMSELECT IndividualData.InfoProdutoCliente.id, ... FROM IndividualData.InfoProdutoCliente INNER JOIN ... WHERE IndividualData.InfoProdutoCliente.idTenant = 1003
But again, i wish there was a better way to do thiswrapRow
and entity
referencedOn
with
and referencedOn
reduced the number of queries to one per relation (before i was getting 1 per relation/record), which for now, is enough