From 6e92c96c6a159dcdcb7bb5b17d11963dc6141854 Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Thu, 23 Jul 2026 08:56:22 +0100 Subject: [PATCH] appview/db: add indices to load issues-by-repo quicker Signed-off-by: oppiliappan --- appview/db/db.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/appview/db/db.go b/appview/db/db.go index 3da2bd71..51357984 100644 --- a/appview/db/db.go +++ b/appview/db/db.go @@ -2476,6 +2476,17 @@ func Make(ctx context.Context, dbPath string) (*DB, error) { return err }) + // gets rid of a few b-tree order bys in getissue queries and replaces them with search + orm.RunMigration(conn, logger, "add-issue-list-indexes", func(tx *sql.Tx) error { + _, err := tx.Exec(` + drop index if exists idx_issues_repo_did; + create index if not exists idx_issues_repo_created on issues(repo_did, created desc); + create index if not exists idx_comments_subject_uri on comments(subject_uri); + create index if not exists idx_label_ops_subject on label_ops(subject); + `) + return err + }) + return &DB{ db, logger, -- 2.51.2