You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When writing a Query that involves preloading a foreign-key object (for example: DBModel.NewObjectQuerySet(DBConn).PrimaryKeyEq(pk).PreloadNestedObject()), the Nested Objects are fetched in a query that has a WHERE clause with all the foreign-key IDs.
The problem arises when said Nested Objects are the same for multiple instances of Object (a many-to-one relationship); the underlying query repeats the key. For example:
Object PK
Nested Object FK
1
1
2
2
3
1
4
1
5
1
Results in the following query when using PreloadNestedObject():
SELECT * FROM NestedObject WHERE pk IN (1, 1, 1, 1, 2);
This massively slows down the underlying queries when fetching fairly average resultsets (tens of seconds every 30000 simple records).
The text was updated successfully, but these errors were encountered:
@DazedNConfused- thank you for issue and nice formatting, but I can't control this behaviour in go-queryset. It's a gorm issue. As I understood it was fixed in this commit, please try updating gorm
When writing a Query that involves preloading a foreign-key object (for example:
DBModel.NewObjectQuerySet(DBConn).PrimaryKeyEq(pk).PreloadNestedObject()
), the Nested Objects are fetched in a query that has aWHERE
clause with all the foreign-key IDs.The problem arises when said Nested Objects are the same for multiple instances of
Object
(a many-to-one relationship); the underlying query repeats the key. For example:Results in the following query when using
PreloadNestedObject()
:SELECT * FROM NestedObject WHERE pk IN (1, 1, 1, 1, 2);
This massively slows down the underlying queries when fetching fairly average resultsets (tens of seconds every 30000 simple records).
The text was updated successfully, but these errors were encountered: