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
Copy file name to clipboardExpand all lines: README.md
+27
Original file line number
Diff line number
Diff line change
@@ -173,6 +173,20 @@ end
173
173
174
174
```
175
175
176
+
Furthermore, there is an argument `max_ids_per_query` setting max ids per query. This helps prevent running a single query with too large list of ids which may be less efficient than splitting into multiple queries.
# SELECT contact_id, COUNT(*) FROM addresses WHERE contact_id IN (1, 2, 3, ... ,10) GROUP BY contact_id
187
+
# SELECT contact_id, COUNT(*) FROM addresses WHERE contact_id IN (11, 12, 13) GROUP BY contact_id
188
+
```
189
+
176
190
### Preloading a subset of an association
177
191
178
192
There are often times when you want to preload a subset of an association, or change how the SQL statement is generated. For example, if a `Contact` model has
@@ -213,6 +227,7 @@ end
213
227
### Jit preloading globally across your application
214
228
215
229
The JitPreloader can be globally enabled, in which case most N+1 queries in your app should just disappear. It is off by default.
230
+
The `max_ids_per_query` argument on loading aggregate methods can also apply on a global level.
0 commit comments