Add index based on subscriber_id to scheduled_task_subscribers
[MAILPOET-1382] This is done to avoid full table scans when scheduling welcome emails and checking whether or not an email has been sent. There we have to query based on `subscriber_id`, but without having a `task_id`, so MySQL cannot make use of the `(task_id, subscriber_id)` primary key.
This commit is contained in:
@@ -131,7 +131,8 @@ class Migrator {
|
||||
'subscriber_id int(11) unsigned NOT NULL,',
|
||||
'processed int(1) NOT NULL,',
|
||||
'created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,',
|
||||
'PRIMARY KEY (task_id, subscriber_id)',
|
||||
'PRIMARY KEY (task_id, subscriber_id),',
|
||||
'KEY subscriber_id (subscriber_id)'
|
||||
);
|
||||
return $this->sqlify(__FUNCTION__, $attributes);
|
||||
}
|
||||
|
Reference in New Issue
Block a user