damus-io / nostrdb

The unfairly fast embedded nostr database backed by lmdb
Other
87 stars 15 forks source link

Add created_at query plan #26

Closed jb55 closed 4 months ago

jb55 commented 4 months ago

For timeline queries and query fallbacks, the simplest possible query plan is the created_at scan. This works well for timelines in our case, because nostrdb is not typically used as a global database and should contain notes intended for us anyways. This allows us to simplify timeline queries into a linear scan. Since most of our indices are ordered by created_at, this linear scan is pretty efficient for looking for recent notes.