The bounded count for filtered scene lists ran `SELECT count(*) FROM (SELECT scenes.* ... LIMIT 1001)` because the base query selects the full Scene entity. Counting over all columns made the planner pick a far worse plan via psycopg bound params (~4s for has_playback) than the same logic over the PK (~30-400ms). Count semantics are unchanged — we only need rows to exist — so count over `base.with_only_columns(Scene.id)`. Partial: this fixes the count leg. The main ordered fetch on filtered lists (has_playback / tags) can still pick a gather-all-then-sort plan under bound params (fast with literal binds, slow parameterized) — tracked separately. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| admin.py | ||
| admin_html.py | ||
| blacklist.py | ||
| bug_reports.py | ||
| expo_updates.py | ||
| favorites.py | ||
| movies.py | ||
| playback.py | ||
| scene_favorites.py | ||
| scenes.py | ||
| schemas.py | ||
| seo.py | ||
| sources.py | ||
| stream_proxy.py | ||
| taxonomies.py | ||
| watch.py | ||