fiatjaf / relayer

A Nostr relay server framework.
The Unlicense
303 stars 82 forks source link

Proposal for improving indexing of tags #46

Open stereosteve opened 1 year ago

stereosteve commented 1 year ago

All the storage adapters loose the association between tag key and value and generally just query by value. There's kinda some todos about this in the code and conversation about it on the sqlite3 PR.

But now I'm like "couldn't we just concatenate the key and value together and index that?" In general a storage adapter will index the tags outside of the actual event.tags field for better performance, so storage adapter can do the same at query time.

So the plan:

Anyway I'm happy to take a stab at this if it sounds good. Just wanted to check that it'd be okay to index the concatenated key + value and that I'm not missing something.

fiatjaf commented 1 year ago

Awesome idea.

Yes, if you want to work on it that will be great.

But let me ask first: are you planning on using Relayer for anything?

stereosteve commented 1 year ago

Cool will do.

I'm just experimenting with it for now, but like that it's pretty simple and flexible as compared to the other relays... more of a simple framework than a baked-binary relay. So my interest would be in some custom auth (a-la whitelist example) plus also maybe some custom mirroring to other relays and maybe some traditional REST / opengraph server side rendering stuff eventually.

In reality it's just a side project that will probably fizzle out and die, but it's nice to work on relayer as a way to learn about the nostr.

Why you ask would you advise against using it in "prod" (whatever prod means)?

stereosteve commented 1 year ago

but if you're saying hack on the app not relayer... I hear you. Client is just a CRUD app with two screens atm, but hope to work on it and put it up on the github in a week or two. I'm pointing it at a relayer server to see what's useful or missing.