Files
vikunja/pkg/webtests
kolaente 98235c670c perf(tasks): index (project_id, done, due_date) instead of (done, due_date)
The overview's task query filters `project_id IN (...) AND done = false` and
sorts by due_date. `done` is not selective, so with an index on
(done, due_date) the planner walks it in due_date order and heap-probes every
open task in the database just to test project_id.

Leading with project_id lets the scan seek to the user's projects and top-N
sort a small set instead.

The old index is dropped rather than kept: its only other consumer is the daily
overdue-reminder cron, whose selective predicate is the due_date range that
IDX_tasks_due_date already covers.

ProjectID moves above Done in the Task struct because xorm orders composite
index columns by struct field order, which also shifts project_id earlier in
the serialized JSON — hence the churn in the task collection test's expected
response bodies.
2026-09-04 10:32:56 +02:00
..