Yuki Kishimoto on Nostr: It's possible to integrate any database, also ones that not support arbitrary ...
It's possible to integrate any database, also ones that not support arbitrary queries, by using the `DatabaseIndexes`.
All the current backends available for nostr-sdk (SQLite, indexeddb, RocksDB, ...) rely on it, also SQLite that has the ability to perform complex queries.
The flow under the hood is: build in-memory indexes (700_000 events are indexed in ~1.5 sec, not faster due to param/replaceable and deletion events checks), query indexes by filters and use the output (event IDs) to get full events from persistent DB.
Published at
2023-12-17 23:40:54Event JSON
{
"id": "d88e436d92257146f44c8cc7b0b7cf6412ee259b11f615f351085ac881ed2e72",
"pubkey": "68d81165918100b7da43fc28f7d1fc12554466e1115886b9e7bb326f65ec4272",
"created_at": 1702856454,
"kind": 1,
"tags": [
[
"e",
"d1296b09f567eee81d57e003185f97dbe9f1d4b64ea0e141f6330d84e1a5e5dd",
"",
"root"
],
[
"e",
"189bf17113ca6acbc605d6e6dcf2b51d30a07baf03f793bada70eb3bd9b638a5"
],
[
"e",
"7c87e2076403765a1358abac8da5335bb566abac566bbef819937e3421ee16c4",
"",
"reply"
],
[
"p",
"68d81165918100b7da43fc28f7d1fc12554466e1115886b9e7bb326f65ec4272"
],
[
"p",
"f0293508f3eb9e6fe99c2fd8ba69ff446216872a2d9f67979bfa4db8b3155806"
],
[
"p",
"32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245"
],
[
"p",
"8fb9450003a599bb1b34f03fadb9b137f6c0e5a850ba205964bee4732ccce549"
]
],
"content": "It's possible to integrate any database, also ones that not support arbitrary queries, by using the `DatabaseIndexes`.\n\nAll the current backends available for nostr-sdk (SQLite, indexeddb, RocksDB, ...) rely on it, also SQLite that has the ability to perform complex queries.\n\nThe flow under the hood is: build in-memory indexes (700_000 events are indexed in ~1.5 sec, not faster due to param/replaceable and deletion events checks), query indexes by filters and use the output (event IDs) to get full events from persistent DB.\n",
"sig": "5ab100d7650168e03f2ffca086fddcbbbf41e5c15b0bc635d89107995090fd237b16944e50f4dcf8c12a60141258060c3b4ae6b57a4b0bfbb8503ee20be384a1"
}