зеркало из https://github.com/mozilla/fxa.git
Merge pull request #6180 from mozilla/fix/issue-6064
fix(admin): split query for index usage
This commit is contained in:
Коммит
41da2dbbdc
|
@ -54,13 +54,14 @@ export class AccountResolver {
|
|||
@FieldResolver()
|
||||
public async emailBounces(@Root() account: Account) {
|
||||
const uidBuffer = uuidTransformer.to(account.uid);
|
||||
const subquery = Emails.query()
|
||||
// MySQL Query optimizer does weird things, use separate queries to force index use
|
||||
const emails = await Emails.query()
|
||||
.select('emails.normalizedEmail')
|
||||
.where('emails.uid', uidBuffer);
|
||||
const result = await EmailBounces.query().where(
|
||||
'emailBounces.email',
|
||||
'in',
|
||||
subquery
|
||||
emails.map((x) => x.normalizedEmail)
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче