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> |
||
|---|---|---|
| .. | ||
| api | ||
| connectors | ||
| extractors | ||
| models | ||
| normalize | ||
| resolve | ||
| scheduler | ||
| templates | ||
| __init__.py | ||
| auth.py | ||
| config.py | ||
| db.py | ||
| ingest.py | ||
| main.py | ||