-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A more efficient means of selecting the random featured product
Works by selecting all product IDs that are featured and then choosing randomly from within that result set, completely removing recursive calls yet getting a valid result on the first try every time in most cases. Since only the product IDs are fetched, memory overhead should be minimal even in the unlikely scenario that a store has thousands of featured products. Efficiency could be optimized even further with an index on the `featured` column.
- Loading branch information
1 parent
3d78c95
commit 3c4a7dc
Showing
1 changed file
with
54 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters