EventsDB: use a subquery instead of a join

This commit is contained in:
Alex Gleason 2024-03-21 19:22:40 -05:00
parent 8bed0c17be
commit c3adafa860
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 2 additions and 3 deletions

View File

@ -200,9 +200,8 @@ class EventsDB implements NStore {
) as { key: 'domain'; value: string } | undefined)?.value;
if (domain) {
query = query
.innerJoin('pubkey_domains', 'pubkey_domains.pubkey', 'events.pubkey')
.where('pubkey_domains.domain', '=', domain);
query = query.where('events.pubkey', 'in', (eb) =>
eb.selectFrom('pubkey_domains').select('pubkey').where('domain', '=', domain));
}
const q = tokens.filter((t) =>