What is Nostr?
Nate / Nate Levin
npub1amt…c0mj
2024-07-02 05:30:25
in reply to nevent1q…5k9e

Nate on Nostr: Again, I could very well be reading this wrong, but the joins dont look necassary to ...

Again, I could very well be reading this wrong, but the joins dont look necassary to me, it could look something like this

SELECT *
FROM nostr_events ne
WHERE (kind IN ($1, $2) AND pubkey IN ($3))
AND EXISTS (
SELECT 1
FROM nostr_tags tag0
WHERE tag0.event_id = ne.id
AND tag0.name = $4
AND tag0.value IN ($5, $6)
))

(this isnt directly taken from your query below, this is just an example)

This is also why i recommended the use of the composite index (event_id, name, value), which I would image would give a huge performance boost on that EXISTS check, but without being able to test it (and make sure it returns the correct results) I could be talking out of my ass
Author Public Key
npub1amtt4ht2vwuxc4lydp6tkd0w6a2kzstmnxltwpzwc20c2pgp7uzq2gc0mj