From 628a2bd713f18e0dd576a5eaa2f78936655adf06 Mon Sep 17 00:00:00 2001 From: frederik Date: Sun, 25 Aug 2024 10:10:26 +0200 Subject: [PATCH] create db index on hot column --- scripts/createdb.sh | 1 + scripts/update_birdnet_snippets.sh | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/scripts/createdb.sh b/scripts/createdb.sh index 4c66ff3..661c86c 100755 --- a/scripts/createdb.sh +++ b/scripts/createdb.sh @@ -16,6 +16,7 @@ CREATE TABLE IF NOT EXISTS detections ( Overlap FLOAT, File_Name VARCHAR(100) NOT NULL); CREATE INDEX "detections_Com_Name" ON "detections" ("Com_Name"); +CREATE INDEX "detections_Sci_Name" ON "detections" ("Sci_Name"); CREATE INDEX "detections_Date_Time" ON "detections" ("Date" DESC, "Time" DESC); EOF chown $USER:$USER $HOME/BirdNET-Pi/scripts/birds.db diff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.sh index 26ea366..63b870a 100755 --- a/scripts/update_birdnet_snippets.sh +++ b/scripts/update_birdnet_snippets.sh @@ -215,6 +215,10 @@ if ! [ -L $HOME/BirdNET-Pi/model/labels.txt ]; then sudo_with_user install_language_label.sh fi +sqlite3 $HOME/BirdNET-Pi/scripts/birds.db << EOF +CREATE INDEX IF NOT EXISTS "detections_Sci_Name" ON "detections" ("Sci_Name"); +EOF + # update snippets above systemctl daemon-reload