I must have tired you, but...
maybe it makes sense to use inner join
instead of left join
About 25% speed increase
And very important with complex queries (screens)
maybe it makes sense to use inner join
Code:
'IS NOT NULL' => [
'innerJoins' => [['phoneNumbers', 'phoneNumbersMultiple']],
'distinct' => true
],
Code:
'IS NOT NULL' => [
'leftJoins' => [['phoneNumbers', 'phoneNumbersMultiple']],
'whereClause' => [
'phoneNumbersMultiple.name!=' => null,
],
'distinct' => true
],
And very important with complex queries (screens)

Comment