Upgrading Ahoy - recommended table indexes #211
In March 2016, the table indexes changed:
- add_index :ahoy_events, [:visit_id] - add_index :ahoy_events, [:user_id] - add_index :ahoy_events, [:time] + add_index :ahoy_events, [:visit_id, :name] + add_index :ahoy_events, [:user_id, :name] + add_index :ahoy_events, [:name, :time] ... + add_index :visits, [:visit_token], unique: true add_index :visits, [:user_id]
Would it be a welcome contribution to the upgrading guide to suggest upgraders migrate their tables indexes as above and explain the reason as a likely performance gain?
Hey @eliotsykes, thanks for the suggestion.
For visits, the new index isn't necessary, as this was part of making
For events, I'm not sure the first two are significantly better than the previous ones (they won't be worse for query performance, but take up more space). The third (name & time) should be better for the typical use case, so it may be worth mentioning either in the upgrade guide or somewhere else in the readme.