In Rails, you can find the number of records using both Model.size
and Model.count
. If you’re dealing with more complex queries is there any advantage to using one method over the other? How are they different?
For instance, I have users with photos. If I want to show a table of users and how many photos they have, will running many instances of user.photos.size
be faster or slower than user.photos.count
?
Thanks!