ssb: Mentions have become too slow. Using refs instead of fts seems better and faster, again?

This commit is contained in:
2025-11-29 15:37:17 -05:00
parent f4c6e2db1f
commit 89d3e9b4fe
2 changed files with 5 additions and 4 deletions

View File

@@ -118,10 +118,11 @@ class TfTabNewsFeedElement extends LitElement {
result = await tfrpc.rpc.query(
`
WITH mentions AS (SELECT messages.rowid, messages.id, messages.previous, messages.author, messages.sequence, messages.timestamp, messages.hash, json(messages.content) AS content, messages.signature
FROM messages_fts(?1)
JOIN messages ON messages.rowid = messages_fts.rowid
FROM messages_refs
JOIN messages ON messages.id = messages_refs.message
JOIN json_each(?2) AS following ON messages.author = following.value
WHERE
messages_refs.ref = ?1 AND
messages.author != ?1 AND
(?3 IS NULL OR messages.timestamp >= ?3) AND messages.timestamp < ?4
ORDER BY timestamp DESC limit ?5)
@@ -133,7 +134,7 @@ class TfTabNewsFeedElement extends LitElement {
SELECT TRUE AS is_primary, * FROM mentions
`,
[
'"' + this.whoami.replace('"', '""') + '"',
this.whoami,
JSON.stringify(this.following),
start_time,
end_time,