Related to issue #293 - creates the index on all use fields instead of three. This improves the joins tremendously.
Create the the index on all four used fields for better performance
The unique indices migration change from the generated migration should be
add_index :tags, :name, unique: true
add_index :taggings, [:tag_id, :taggable_type, :taggable_id, :context, :tagger_id, :tagger_type], unique: true, name: 'tagging_idx'
remove_index :tags, :name
remove_index :taggings, name: 'tagging_idx'
see https://github.com/mbleigh/acts-as-taggable-on/blob/master/lib/acts_as_taggable_on/tag.rb#L14 and https://github.com/mbleigh/acts-as-taggable-on/blob/master/lib/acts_as_taggable_on/tagging.rb#L20
you can add indexes if you need it. Some would prefere to not have ones.
I'm curious why? Since the app enforces uniquness, shouldn't the database as well?
@bf4 yes, I think so. Care to submit a pull request?
At a minimum, please bring the :name portion over from this pull request. I have to use a table prefix, so the current index name that is auto generated in the migration is over 64 chars. The :name field in the migration mitigates this issue.
thanks Tanel for this change.