wrolpi/modules/videos
lrnselfreliance 570c63ffc7
Channel statistics: read from covering indexes, not video or file_group rows (#1059)
* Channel statistics: find a Channel's Videos in an index, not their rows

Each video row carries its ffprobe_json, so the statistics query read a
page per Video to get file_group_id.  A Channel with thousands of Videos
took seconds from a cold disk cache.  An index of (channel_id,
file_group_id) replaces video_channel_id_idx, and the tagged-Videos
subquery reads that index instead of looking up each tagged FileGroup's
video row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Channel statistics: read FileGroup sizes from a covering index

After the video index, the remaining cold cost was reading each Video's
file_group row for its size and length: a scattered page per Video.  An
index of file_group (id, size, length) holds them densely.  SQLite
prefers the rowid for an id lookup, so the query names the index with
INDEXED BY.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Channel statistics: widen the FileGroup index to cover published dates

A Video's neighbors are found by the published dates of its Channel's
Videos, which reads the same scattered file_group rows.  One index of
file_group (id, published_datetime, size, length) serves both, so an
upgrade builds one index rather than two.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 14:22:21 -07:00
..
channel Channel statistics: read from covering indexes, not video or file_group rows (#1059) 2026-12-01 14:22:21 -07:00
test The Any Tag filter works on the Videos, Archives and Docs searches (#958) 2026-11-11 19:21:06 -07:00
video The Any Tag filter works on the Videos, Archives and Docs searches (#958) 2026-11-11 19:21:06 -07:00
__init__.py files: shared modeler batch loop for video, doc, zim, archive (#722) 2026-09-24 16:47:46 -06:00
api.py db: request-path library functions use the request's connection (#774) 2026-10-04 11:05:20 -06:00
common.py The tail-decode check ignores the h264 decoder's "mmco: unref short failure" note (#938) 2026-11-02 18:00:03 -07:00
conftest.py The Any Tag filter works on the Videos, Archives and Docs searches (#958) 2026-11-11 19:21:06 -07:00
cookies.py Using shared context to sync cookies between processes. 2026-02-22 14:32:27 -07:00
downloader.py A download records the sha256 of its files in the wrolpi section (#904) 2026-10-30 19:34:49 -06:00
errors.py Remove unused code found by vulture (#885) 2026-10-27 15:50:09 -06:00
lib.py A channels.yaml import keeps a Channel's once-Downloads (#898) 2026-10-29 16:59:56 -06:00
models.py Channel statistics: read from covering indexes, not video or file_group rows (#1059) 2026-12-01 14:22:21 -07:00
normalize_video_url.py A video that is uploaded is attached to its Channel. Saving Channels config with both download url and frequency in case downloads config is corrupted. 2024-10-16 18:56:11 -06:00
schema.py The Any Tag filter works on the Videos, Archives and Docs searches (#958) 2026-11-11 19:21:06 -07:00
transcode.py A transcode or remux refreshes the sha256 sums a download recorded (#906) 2026-10-30 19:41:29 -06:00