From 97c06aba1a49cb51836aa73227c175deafada405 Mon Sep 17 00:00:00 2001 From: Deluan Date: Sat, 19 Oct 2024 20:46:54 -0400 Subject: [PATCH] perf(server): add index for sort tags. Improves search performance when searching with PreferSortTags=true --- db/migrations/20241020003138_add_sort_tags_index.sql | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 db/migrations/20241020003138_add_sort_tags_index.sql diff --git a/db/migrations/20241020003138_add_sort_tags_index.sql b/db/migrations/20241020003138_add_sort_tags_index.sql new file mode 100644 index 000000000..6d86971e7 --- /dev/null +++ b/db/migrations/20241020003138_add_sort_tags_index.sql @@ -0,0 +1,9 @@ +-- +goose Up +create index if not exists media_file_sort_title on media_file(coalesce(nullif(sort_title,''),order_title)); +create index if not exists album_sort_name on album(coalesce(nullif(sort_album_name,''),order_album_name)); +create index if not exists artist_sort_name on artist(coalesce(nullif(sort_artist_name,''),order_artist_name)); + +-- +goose Down +drop index if exists media_file_sort_title; +drop index if exists album_sort_name; +drop index if exists artist_sort_name; \ No newline at end of file