UPDATE 5 - MySQL 8.0
Iv'e exported the data to a 8.0 instance and both the fast-query and slow-query are working fast.
But this is not enough since combining two of them together (which is actually a business requirement) is slow, probably because mysql should choose a single index and each team size dictates a different optimal index but both does not have an optimal index but multiple (2).
The query that doesnt work on 8.0:
SELECT
tbl.customerId,
tbl.country,
tbl.language,
tbl.lastLoginDate
FROM
CustomerTable tbl
INNER JOIN TeamCustomerMapping tbl2 on tbl.customerId= tbl2.customerId
WHERE
1 = 1
and tbl2.teamId in (7,9)
order by tbl.lastLoginDate asc
UPDATE 6 - SQL-Server experiment
Iv'e exported the tables into a sql server instance.
all queries executes fast.
explaining the query plan for the and tbl2.teamId in (7,9) ...
shows that 3 different indexes are used - one for the mapping table, and two for the main customer table.
Is this the obvious use case where sql server is preferable?