#111414Find the descendant pages in the frontend with one database query
Description
PageRepository::getDescendantPageIdsRecursive() and getPageIdsRecursive() walk the page tree with one query per page, plus a workspace overlay per page in a workspace. They are used by menus (HMENU), content objects with “recursive”, Extbase storage pids in the frontend, felogin, the XML sitemaps of EXT:seo and the indexed search.
For 780 pages below a page, this results in 783 queries, and about twice as many in a workspace.
The pages of all levels can be fetched with one query by the PageDescendantsRepository (#111406), resolved for the workspace of the context. The decisions about the pages stay as they are and are evaluated in PHP: enable fields and group access via RecordAccessVoter (including the RecordAccessGrantedEvent), “extendToSubpages”, backend user sections, excluded pages, mount points in both modes, and the level to start collecting. The pages below a mount point are fetched with one further query per mount point.
The result is the same, the number of queries no longer depends on the number of pages: for 780 pages, 3 instead of 783 queries are needed.
Reviews 1
History 03
-
Gerrit Code Review pushed patch set 1 for main to change 97553 status
NewUnder Review <span data-processor="relativetime" data-value="2026-11-11T15:58:24+00:00" > 11/11/26, 15:58 </span> -
Gerrit Code Review pushed patch set 2 for main to change 97553 <span data-processor="relativetime" data-value="2026-11-15T08:27:54+00:00" > 11/15/26, 08:27 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 97553 <span data-processor="relativetime" data-value="2026-11-19T08:45:10+00:00" > 11/19/26, 08:45 </span>