Hi, when using QOR restful API (GET something.json), it seems that if "something" has nested structs which can themselves have nested structs, the API performance is not great (several seconds per request). It seems than instead of doing joined tables requests with the mysql backend, qor does a lot of request on tables and join the data together itself. Is there a way to improve the performance ?
My structs :
type Election struct {
gorm.Model
Name string
Date time.Time
Areas []Area
FirstTour bool
}
type Area struct {
gorm.Model
Name string
ElectionID uint
Election Election
SeatNumber uint
MapId uint
Cities []City
CandidateLists []CandidateList
}
type City struct {
gorm.Model
Name string
AreaID uint
Area Area
Desks []Desk
MapId uint
}
type Desk struct {
gorm.Model
DeskIdentifier uint
Name string
Subscribed uint
CityID uint
City City
Votes []Vote
Completed bool
DateCompleted time.Time
Validated bool
}
type Party struct {
gorm.Model
Name string
Color string
CandidateLists []CandidateList
}
type CandidateList struct {
gorm.Model
Name string
PartyID uint
Party Party
AreaID uint
Area Area
Candidates []Candidate
Votes []Vote
}
// Candidate
type Candidate struct {
gorm.Model
Name string
FirstName string
Rank uint
Birthdate time.Time
PotentialIcompatibility bool
Refused bool
Removed bool
CandidateListID uint
}
// Vote
type Vote struct {
gorm.Model
CandidateListID uint
CandidateList CandidateList
DeskID uint
Desk Desk
VoiceNumber uint
Blank bool
NullVote bool
}
Hi, when using QOR restful API (GET something.json), it seems that if "something" has nested structs which can themselves have nested structs, the API performance is not great (several seconds per request). It seems than instead of doing joined tables requests with the mysql backend, qor does a lot of request on tables and join the data together itself. Is there a way to improve the performance ?
My structs :