Page MenuHomePhabricator

[Platform API] Improve efficiency of database queries in PublicWikiController
Open, Needs TriagePublic

Description

During T421877: Intended for reuse prototype - inferred from intended use data we noticed that the queries executed in PublicWikiController as part of the /wiki endpoint weren't efficient.

The current logic results in N+2 queries being executed, where N is the total number of Wiki instances; at least with these query params /wiki?sort=pages&direction=desc&page=1&per_page=10.

We should investigate if we can modify the logic to reduce the number of queries being executed to a fixed number regardless of the number of Wiki instances.

Some related reading that might help: https://laravel-news.com/laravel-n1-query-problems

Event Timeline

Ollie.Shotton_WMDE renamed this task from [Platform API] Improve database efficiencey in PublicWikiController to [Platform API] Improve database efficiency in PublicWikiController.Apr 13 2026, 10:55 AM
Ollie.Shotton_WMDE updated the task description. (Show Details)
Ollie.Shotton_WMDE renamed this task from [Platform API] Improve database efficiency in PublicWikiController to [Platform API] Improve efficiency of database queries in PublicWikiController.Apr 13 2026, 11:02 AM