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 there were thousands of users for suggestion, this method seems like cost 2-3 second. Then I google how to get random records by sql in rails, here is the result I got:
But different database get different rand function. See detail in this url: http://www.petefreitag.com/item/466.cfm
I don't know how many kinds of database SocialStream need to support. With a support list, it might could optimize it with a method to get current random func for current database.
Anyway, for somebody who got this problem, could just use the decorator to rewrite this method.
The text was updated successfully, but these errors were encountered:
When there were thousands of users for suggestion, this method seems like cost 2-3 second. Then I google how to get random records by sql in rails, here is the result I got:
In this way, the solution could be
This will more faster then the original code.
But different database get different rand function. See detail in this url:
http://www.petefreitag.com/item/466.cfm
I don't know how many kinds of database SocialStream need to support. With a support list, it might could optimize it with a method to get current random func for current database.
Anyway, for somebody who got this problem, could just use the decorator to rewrite this method.
The text was updated successfully, but these errors were encountered: