From fc3874138ab6094b7cb863e898971775cdae20c5 Mon Sep 17 00:00:00 2001 From: David Hoppenbrouwers Date: Sat, 8 Oct 2022 14:24:52 +0200 Subject: [PATCH] Index threads.forum_id and comments.thread_id --- schema.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/schema.txt b/schema.txt index 9d59e9c..f9275cf 100644 --- a/schema.txt +++ b/schema.txt @@ -34,8 +34,13 @@ create table comments ( ); create table forums ( - forum_id integer unique not null primary key autoincrement, - name varchar(64) not null, + forum_id integer unique not null primary key autoincrement, + name varchar(64) not null, description text, - allowed_roles_mask integer not null + allowed_roles_mask integer not null ); + +-- Both of these speed up searches significantly if there are many threads or comments. +-- Other indices have no measureable impact (yet, at least). +create index forum_id on threads(forum_id); +create index thread_id on comments(thread_id);