The current implementation of the tourbook export has two performance killers.
- To resolve the tourbook entries, there is a loop over all entries inside the corresponding export where every entry creates additional database queries (N+1 query problem) inside the
TourbookEntryVerbose.
Solution: Create a single DAO method that joins the Ascend, Route, Rock, Sector, and Region tables. This way, you get all the data in one single query.
- The
TourbookEntryVerbose makes use of Kotlin reflection, which also has a performance impact.
Solution: Use a data class.
The current implementation of the tourbook export has two performance killers.
TourbookEntryVerbose.Solution: Create a single DAO method that joins the Ascend, Route, Rock, Sector, and Region tables. This way, you get all the data in one single query.
TourbookEntryVerbosemakes use of Kotlin reflection, which also has a performance impact.Solution: Use a data class.