Merge pull request #854 from mailpoet/subscriber_listing_performance

Improve performance of a subscriber listing on MySQL 5.5 and lower [MAILPOET-867]
This commit is contained in:
mrcasual
2017-03-30 09:51:47 -04:00
committed by GitHub

View File

@@ -787,20 +787,13 @@ class Subscriber extends Model {
static function withoutSegments($orm) { static function withoutSegments($orm) {
return $orm->select(MP_SUBSCRIBERS_TABLE.'.*') return $orm->select(MP_SUBSCRIBERS_TABLE.'.*')
->rawJoin( ->whereRaw(
'LEFT OUTER JOIN ( MP_SUBSCRIBERS_TABLE . '.id NOT IN (
SELECT `subscriber_id` SELECT `subscriber_id`
FROM '.MP_SUBSCRIBER_SEGMENT_TABLE.' FROM '.MP_SUBSCRIBER_SEGMENT_TABLE.'
WHERE `status` = "'.self::STATUS_SUBSCRIBED.'" WHERE `status` = "'.self::STATUS_SUBSCRIBED.'"
)', )'
array( );
MP_SUBSCRIBERS_TABLE.'.id',
'=',
MP_SUBSCRIBER_SEGMENT_TABLE.'.subscriber_id'
),
MP_SUBSCRIBER_SEGMENT_TABLE
)
->whereNull(MP_SUBSCRIBER_SEGMENT_TABLE.'.subscriber_id');
} }
static function createMultiple($columns, $values) { static function createMultiple($columns, $values) {