Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading Ahoy - recommended table indexes #211

eliotsykes opened this issue Aug 23, 2016 · 1 comment


Copy link

commented Aug 23, 2016

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?


This comment has been minimized.

Copy link

commented Aug 25, 2016

Hey @eliotsykes, thanks for the suggestion.

For visits, the new index isn't necessary, as this was part of making ActiveRecordTokenStore the default again.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.