wrolpi/alembic
Roland 07980af10c
collections: listing answers channel and download queries from covering indexes
The listing still read every channel row (for the summary columns) and every download
row of the listed Collections (for the minimum frequency). Both tables store yt-dlp
info_json, so rows are tens of KB and each sits on its own scattered page; selecting
fewer columns did not help because the seek per row is the cost. From a cold disk
cache that was 5 s per table, 10+ s total, on a large library.

Two covering indexes, channel (collection_id, video_count, total_size) and
download (collection_id, frequency), answer both queries without touching a row. The
listing no longer loads Download objects at all; it computes min_download_frequency
with one grouped query and drops the unused `downloads` array from listing rows (the
detail endpoints keep it; the list views only read min_download_frequency).

Adds a models-vs-migrations test (alembic check) so an index or column added to a
model without a migration, or vice versa, fails the suite.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-27 12:36:14 -06:00
..
versions collections: listing answers channel and download queries from covering indexes 2026-09-27 12:36:14 -06:00
env.py Postgres -> SQLite hard cutover: the database moves into the media directory. 2026-07-12 14:09:37 -06:00
README A new start 2021-11-01 16:43:09 -06:00
script.py.mako Postgres -> SQLite hard cutover: the database moves into the media directory. 2026-07-12 14:09:37 -06:00

Generic single-database configuration.