Add covering indexes for *{,_sort} fields

These indexes help queries searching on these fields and will act as covering
indexes for sort strings, too.
This commit is contained in:
Julien BLACHE 2011-06-12 11:30:13 +02:00
parent becdfdb062
commit 617c026060

View File

@ -3975,6 +3975,21 @@ db_perthread_deinit(void)
#define I_STATEMKINDSAI \
"CREATE INDEX IF NOT EXISTS idx_state_mkind_sai ON files(disabled, media_kind, songalbumid);"
#define I_ARTIST \
"CREATE INDEX IF NOT EXISTS idx_artist ON files(artist, artist_sort);"
#define I_ALBUMARTIST \
"CREATE INDEX IF NOT EXISTS idx_albumartist ON files(album_artist, album_artist_sort);"
#define I_COMPOSER \
"CREATE INDEX IF NOT EXISTS idx_composer ON files(composer, composer_sort);"
#define I_TITLE \
"CREATE INDEX IF NOT EXISTS idx_title ON files(title, title_sort);"
#define I_ALBUM \
"CREATE INDEX IF NOT EXISTS idx_album ON files(album, album_sort);"
#define I_FILEPATH \
"CREATE INDEX IF NOT EXISTS idx_filepath ON playlistitems(filepath ASC);"
@ -4045,6 +4060,12 @@ static const struct db_init_query db_init_queries[] =
{ I_SONGALBUMID, "create songalbumid index" },
{ I_STATEMKINDSAI, "create state/mkind/sai index" },
{ I_ARTIST, "create artist index" },
{ I_ALBUMARTIST, "create album_artist index" },
{ I_COMPOSER, "create composer index" },
{ I_TITLE, "create title index" },
{ I_ALBUM, "create album index" },
{ I_FILEPATH, "create file path index" },
{ I_PLITEMID, "create playlist id index" },
{ I_PAIRING, "create pairing guid index" },