PERF: add index on user email logs
This index makes it much faster to figure out if a user reached email limit on sites where lots of emails are skipped
This commit is contained in:
parent
8765279c90
commit
fb91d24deb
|
@ -0,0 +1,8 @@
|
|||
class AddSkippedCreatedAtUserIdIndexOnEmailLogs < ActiveRecord::Migration[5.1]
|
||||
def up
|
||||
execute "CREATE INDEX idx_email_logs_user_created_filtered ON email_logs(user_id, created_at) WHERE skipped = 'f'"
|
||||
end
|
||||
def down
|
||||
execute "DROP INDEX idx_email_logs_user_created_filtered"
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue