From e84ced6f79f871d85f3d4058bcc60b4abc4d0609 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Thu, 27 Jan 2022 01:42:48 +0000 Subject: [PATCH] Add some useful indexes. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3798 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/ssb.db.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ssb.db.c b/src/ssb.db.c index 41bcb20d..ec76e601 100644 --- a/src/ssb.db.c +++ b/src/ssb.db.c @@ -30,6 +30,8 @@ void tf_ssb_db_init(tf_ssb_t* ssb) sqlite3_exec(db, "CREATE INDEX IF NOT EXISTS messages_author_id_index ON messages (author, id)", NULL, NULL, NULL); sqlite3_exec(db, "CREATE INDEX IF NOT EXISTS messages_author_sequence_index ON messages (author, sequence)", NULL, NULL, NULL); sqlite3_exec(db, "CREATE INDEX IF NOT EXISTS messages_author_timestamp_index ON messages (author, timestamp)", NULL, NULL, NULL); + sqlite3_exec(db, "CREATE INDEX IF NOT EXISTS messages_author_type_sequence_index ON messages (author, json_extract(content, '$.type'), sequence)", NULL, NULL, NULL); + sqlite3_exec(db, "CREATE INDEX IF NOT EXISTS messages_author_type_timestamp_index ON messages (author, json_extract(content, '$.type'), timestamp)", NULL, NULL, NULL); sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS blobs (" " id TEXT PRIMARY KEY,"