mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-23 23:20:51 +01:00
[PR #6031] [MERGED] Run SQLite query planner optimization at shutdown/restart #10603
Labels
No labels
area:database
awaiting-feedback
backend
blocked
breaking change: web api
bug
build
ci
confirmed
discussion needed
dotnet future
downstream
duplicate
EFjellyfin.db
enhancement
feature
future
github-actions
good first issue
hdr
help wanted
invalid
investigation
librarydb
live-tv
lyrics
media playback
music
needs testing
nuget
performance
platform
pull-request
question
regression
release critical
requires-web
roadmap
security
security
stale
support
syncplay
ui & ux
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: starred/jellyfin#10603
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/jellyfin/jellyfin/pull/6031
Author: @ferferga
Created: 5/11/2021
Status: ✅ Merged
Merged: 5/24/2021
Merged by: @cvium
Base:
master← Head:sql-optimization📝 Commits (3)
69baa9cRun SQLite query planner optimization at shutdown/restart3b82211Create scheduled task for database optimization6db229aAddress review comments📊 Changes
5 files changed (+118 additions, -2 deletions)
View changed files
📝
Emby.Server.Implementations/Emby.Server.Implementations.csproj(+1 -0)📝
Emby.Server.Implementations/Localization/Core/en-US.json(+3 -1)📝
Emby.Server.Implementations/Localization/Core/es.json(+3 -1)➕
Emby.Server.Implementations/ScheduledTasks/Tasks/OptimizeDatabaseTask.cs(+101 -0)📝
Jellyfin.Server/Program.cs(+10 -0)📄 Description
Runs
PRAGMA optimizeafter disposing Jellyfin's application host. According to SQLite docs, this should be run at the end of the connection, when it's most suitable to run the query planner optimizations.Source https://www.sqlite.org/pragma.html#pragma_optimize and https://sqlite.org/lang_analyze.html
EFCore arbitrarily creates or reuses connections for database contexts (based in EF6, not EFCore documentation I could find, https://docs.microsoft.com/en-us/ef/ef6/fundamentals/connection-management) but I assume that with SQLite provider (given all the concurrency issues it has) the same connection is reused no matter what, so we're taking full advantage of the query planner. More insights on this are appreciated.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.