mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-26 23:25:56 -05:00
[db] Use ANALYZE instead of PRAGMA optimize (reverts commit cd96ec5
)
Turns out PRAGMA optimize does not analyze tables on a fresh install, which means that sqlite_stat1 is not available for the query planner, which means that wrong indexes are used. See https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=49928&sid=1e5d1d418315d7565ae027d751dd94a0&start=1350#p1328964
This commit is contained in:
parent
cf6813f2e4
commit
9d95466e09
4
src/db.c
4
src/db.c
@ -1102,7 +1102,7 @@ db_exec(const char *query, char **errmsg)
|
||||
static void
|
||||
db_pragma_optimize(void)
|
||||
{
|
||||
const char *query = "PRAGMA optimize;";
|
||||
const char *query = "ANALYZE;";
|
||||
char *errmsg;
|
||||
int ret;
|
||||
|
||||
@ -1111,7 +1111,7 @@ db_pragma_optimize(void)
|
||||
ret = db_exec(query, &errmsg);
|
||||
if (ret != SQLITE_OK)
|
||||
{
|
||||
DPRINTF(E_LOG, L_DB, "PRAGMA optimize failed: %s\n", errmsg);
|
||||
DPRINTF(E_LOG, L_DB, "ANALYZE failed: %s\n", errmsg);
|
||||
|
||||
sqlite3_free(errmsg);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user