aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2022-06-24 14:00:54 +0100
committerChristopher Baines <mail@cbaines.net>2022-06-24 14:00:54 +0100
commit5acfcc0a9d99d78a167c365534aa5bf592f5625e (patch)
tree35675bff733b68e9e07bc63e15c2a90e95583535
parenteb07d3e0deed95eda76db9300b55a66c959133c6 (diff)
downloadnar-herder-master.tar
nar-herder-master.tar.gz
Add index on narinfo_files.narinfo_idHEADmaster
This is important for finding narinfo_files by narinfo, which happens in database-select-narinfo-files.
-rw-r--r--nar-herder/database.scm9
1 files changed, 8 insertions, 1 deletions
diff --git a/nar-herder/database.scm b/nar-herder/database.scm
index 61f5bb1..64655df 100644
--- a/nar-herder/database.scm
+++ b/nar-herder/database.scm
@@ -97,6 +97,8 @@ CREATE TABLE narinfo_files (
url TEXT NOT NULL
);
+CREATE INDEX narinfo_files_narinfo_id ON narinfo_files (narinfo_id);
+
CREATE TABLE narinfo_references (
narinfo_id INTEGER NOT NULL REFERENCES narinfos (id),
store_path TEXT NOT NULL
@@ -139,7 +141,12 @@ SELECT name FROM sqlite_master WHERE type = 'table' AND name = :name")))
(#f (perform-initial-database-setup db))
(_ #f))
- (sqlite-finalize statement)))
+ (sqlite-finalize statement))
+
+ (sqlite-exec
+ db
+ "CREATE INDEX IF NOT EXISTS narinfo_files_narinfo_id
+ ON narinfo_files (narinfo_id);"))
(define (setup-database database-file metrics-registry)
(let ((db (db-open database-file)))