Files
vikunja/pkg/models
kolaente cccb76e80e perf(tasks): only use DISTINCT when a join can multiply rows
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.
2026-08-29 17:50:20 +02:00
..