Join scanning #38
-
Hi, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
It would be better if we can preload ToMany relationships and scan the results back to R with group by from PK. |
Beta Was this translation helpful? Give feedback.
-
Preloading a Option 1: CachingHave a cache of all scanned objects by primary key and reuse them if encountered again. I think this is very error-prone. It also requires the scanner to keep track of every row which breaks features like Additionally, the complexity of this method grows with each nested load. It would seem that a flattened cache of each object and their relationship will have to be maintained to be able to handle nested loaders well. Option 2: Use
|
Beta Was this translation helpful? Give feedback.
Preloading a
ToMany
is kind of difficult. By default, using a left join that has more than one match will duplicate the row for each match. There are several ways to make this work.Option 1: Caching
Have a cache of all scanned objects by primary key and reuse them if encountered again. I think this is very error-prone. It also requires the scanner to keep track of every row which breaks features like
Cursor
. Also, significant changes will have to be made to thescan
package and I think this may be fighting against SQL which is not what Bob is about.Additionally, the complexity of this method grows with each nested load. It would seem that a flattened cache of each object and their relat…