[db] Improve speed of browse queries (issue #478)

Before, we returned either unordered (for RSP, meaning client had to
sort) or ordered by a client selected sort_clause[]. The latter are
multi-purpose and therefore not optimised for browse queries.

To speed up, we predefine the entire set of browse queries, including
order, with matching indices. The predefined queries are used except
if the client explicitly requests a non-default order or query.

As a special bonus, the commit also allows queries with I_SUB that
have an offset but no limit.
This commit is contained in:
ejurgensen
2018-01-21 00:22:21 +01:00
parent 121b812c30
commit ea6fd1476a
8 changed files with 129 additions and 109 deletions

View File

@@ -26,7 +26,7 @@
* is a major upgrade. In other words minor version upgrades permit downgrading
* forked-daapd after the database was upgraded. */
#define SCHEMA_VERSION_MAJOR 19
#define SCHEMA_VERSION_MINOR 06
#define SCHEMA_VERSION_MINOR 07
int
db_init_indices(sqlite3 *hdl);