And this is why we always benchmark the before and after! Because the answer is: It Depends.https://twitter.com/sgrif/status/1029822043716378624 …
Filtering in SQL will definitely always be faster than filtering in Ruby. The only thing that "depends" is whether it's enough of a difference to care
-
-
My experience is that this isn't always true. Example: `SomeModel.some_scope` is needed early in the view. Later, they want `SomeModel.some_scope.where { this_thing: false }`. Sometimes much faster to just enumerable it rather than let the DB do the work.
-
Yes, if you *already* have the data on the Ruby side enumerating there will always be faster than round tripping to the DB
- 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.