-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`taggings.count.zero?` executes the following sql `SELECT COUNT(*) FROM taggings WHERE taggings.tag_id = ?` This can be very slow on large tables by using `taggings.none?` it instead executes: `SELECT 1 AS one FROM taggings WHERE taggings.tag_id = 304185392 LIMIT 1` which can always use the primary key index and is much faster.
- Loading branch information
Showing
2 changed files
with
17 additions
and
1 deletion.
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
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