Alex Gleason on Nostr: Refreshing is the right workaround. The second time you load it's cached so it works, ...
Refreshing is the right workaround. The second time you load it's cached so it works, but the cache goes stale after like a minute so it gets slow again.
The root cause is that tag queries are slow.
I figured out it's because the query is trying to load all "p" tags EVER that reference your pubkey instead of just the ones it needs. This means it will retrieve 30,000+ tag rows just to render 20 events. So I am doing surgery on the database in production right now trying to resolve it, but creating the necessary indexes is taking several days.
Published at
2024-07-20 20:15:52Event JSON
{
"id": "385f2f6f7a85932aea0450541583e3ef7da12334c39ed11516532692f52a4a8b",
"pubkey": "0461fcbecc4c3374439932d6b8f11269ccdb7cc973ad7a50ae362db135a474dd",
"created_at": 1721499352,
"kind": 1,
"tags": [
[
"e",
"b36776090b44c8d238d0c40644d66528e75992fbeb1f5c4eeb12b29d95ae85a3",
"wss://gleasonator.dev/relay",
"root"
],
[
"e",
"044f8491c72e13b61ab57c971d7c5be85e87e8bd62cc36fea294c371ea32c0b0",
"wss://gleasonator.dev/relay",
"reply"
],
[
"p",
"604e96e099936a104883958b040b47672e0f048c98ac793f37ffe4c720279eb2"
]
],
"content": "Refreshing is the right workaround. The second time you load it's cached so it works, but the cache goes stale after like a minute so it gets slow again.\n\nThe root cause is that tag queries are slow.\n\nI figured out it's because the query is trying to load all \"p\" tags EVER that reference your pubkey instead of just the ones it needs. This means it will retrieve 30,000+ tag rows just to render 20 events. So I am doing surgery on the database in production right now trying to resolve it, but creating the necessary indexes is taking several days.",
"sig": "1f7e8f0e262deec033cf0392558b46d631af998acfc32a0f5fd02bb73438fc41652a272103e9bf3df549eb515c1efea3f202f3f5726b96f95d553a985d79c0c4"
}