From 6e83c085358d5b4ee8e3c3c3bbd9d3bc192d9a05 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sat, 23 Nov 2024 17:50:32 -0500 Subject: [PATCH] ssb: Add an index that helps me calculate feed size about 8x faster. --- src/ssb.db.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ssb.db.c b/src/ssb.db.c index 6713b3c68..9456d22c6 100644 --- a/src/ssb.db.c +++ b/src/ssb.db.c @@ -134,6 +134,7 @@ void tf_ssb_db_init(tf_ssb_t* ssb) _tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_author_timestamp_index ON messages (author, timestamp)"); _tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_timestamp_index ON messages (timestamp)"); _tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_type_timestamp_index ON messages (content ->> 'type', timestamp)"); + _tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS messages_size_by_author_index ON messages (author, length(content))"); _tf_ssb_db_exec(db, "CREATE TABLE IF NOT EXISTS blobs (" " id TEXT PRIMARY KEY,"