mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-11-17 02:43:52 -06:00
The task search always emitted SELECT DISTINCT tasks.*, but the only join that can produce duplicate rows is task_buckets without a project view to pin it — task_positions and task_buckets are both unique on (task_id, project_view_id), and every other condition filters through a subquery. DISTINCT forced a sort+unique over every matching row before the LIMIT could apply, so `ORDER BY due_date ... LIMIT n` on the home overview could never walk an index. On MySQL the longtext description also pushed it into an on-disk temp table. Gate it, and the count query along with it. Selecting task_positions.position was only needed to satisfy Postgres' rule that ORDER BY expressions appear in a DISTINCT select list, so that goes too.