[db] Speed up Q_PL query used by e.g. '/databases/1/containers' request

The previous solution would use subqueries to count the number of items and
streams in each playlist, which means that response time gets pretty slow if
there are many playlists.

This commit also includes a number of lesser db code changes.
This commit is contained in:
ejurgensen
2019-05-28 23:40:41 +02:00
parent 1aae870449
commit 4f5966c9ff
7 changed files with 190 additions and 308 deletions

View File

@@ -1032,7 +1032,7 @@ source_item_ownpl_get(struct artwork_ctx *ctx)
mfi_path = ctx->dbmfi->path;
format = ART_E_NONE;
while (((ret = db_query_fetch_pl(&qp, &dbpli, 0)) == 0) && (dbpli.id) && (format == ART_E_NONE))
while (((ret = db_query_fetch_pl(&qp, &dbpli)) == 0) && (dbpli.id) && (format == ART_E_NONE))
{
if (!dbpli.path)
continue;