beets
beets copied to clipboard
Make queries fast, filter all flexible attributes
- Make LazyClassProperty / cached_classproperty reusable
- Add support for filtering relations
- Add ability to debug queries
- Fix querying fields present in both tables
- Aggregate flexible attributes
- Add ability to filter flexible attributes through the Query
- Enable querying related flexible attributes
- Remove slow lookups from beetsplug/aura
Description
Another and (hopefully) final attempt to improve querying speed.
Fixes #4360 #3515 and possibly more issues to do with slow queries.
This PR supersedes #4746.
What's been done
The album
and item
tables are joined, and corresponding data from item_attributes
and album_attributes
is merged and made available for filtering. This enables to achieve the following:
- [x] Faster album path queries,
beet list -a path::some/path
- [x] Faster flexible attributes queries, both albums and tracks,
beet list play_count:10
- [x] (New) Ability to filter albums with track-level (and vice-versa) db field queries,
beet list -a title:something
- [x] (New) Ability to filter tracks with album-level flexible field queries,
beet list artpath:cover
- [x] (New) Ability to filter albums with track-level flexible field queries,
beet list -a art_source:something
Benchmarks
You can see that now querying speed is more or less constant regardless of the query, and the speed is mostly influenced by how many results need to be printed out
Compare this with what we had previously
To Do
- [ ] Documentation. (If you've add a new command-line flag, for example, find the appropriate page under
docs/
to describe it.) - [ ] Changelog. (Add an entry to
docs/changelog.rst
near the top of the document.) - [x] Tests. (Encouraged but not strictly required.)
Later
- [ ] Submit PR with the corresponding adjustment for sorting and fix for
lslimit
- [ ] Submit PR with the corresponding adjustment for template variables resolution