Review main Abandoned

81447[FEATURE] Introduce QueryBuilderPaginator

Philipp Kitzberger CR -2 V 0 Normal +69 −0 updated 03/06/26, 16:25

Commit message

This is the core's 3rd Paginator: intended for QueryBuilder results.

Running a QueryBuilder through an ArrayPaginator only works when having
fetched all the rows beforehand. This is a massive performance issue.

With the new QueryBuilderPaginator only two queries will be fired:

* Counting all rows
* Fetching one pages rows (items per page)

Review

  • Code review CR -2
    • Stefan Bürk -2
  • Verified V 0
    • core-ci +1 CI

Issues 1

Files 1

Review log 1113

  1. Philipp Kitzberger uploaded patch set 1 10/18/23, 11:37

  2. core-ci voted on patch set 1 V -1 10/18/23, 11:49 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47902

  3. Philipp Kitzberger uploaded patch set 2 V -1 10/18/23, 12:16

  4. core-ci voted on patch set 2 V +1 10/18/23, 12:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47905

  5. Georg Ringer commented on patch set 2 10/18/23, 19:15

    please provide a RST file and is it also possible to have a query with a provided offset/limit which is still respected when paginate? example: having 100 articles and plugin defines an offset of 5 and limit of 30 which means 25 articles and 3 pages (given 10 per page). when using the pagination, the 2nd page must show article 15-25! a functional test would be very nice for that as we had troubles with that all the times before
  6. Mathias Brodala commented on patch set 2 10/19/23, 05:40

    QueryBuilderPaginator.php:49

    I wonder if we should prefer iterate*() here for performance reasons. If not all items are used, then fetching all is not useful, even if the $itemsPerPage is low.
  7. Georg Ringer commented on patch set 2 10/19/23, 06:35

    QueryBuilderPaginator.php:49 Reply

    one could also just feed a select('uid') into it to fetch just the uids.
  8. Mathias Brodala commented on patch set 2 10/19/23, 07:09

    QueryBuilderPaginator.php:49 Reply Unresolved

    You can do this with the $queryBuilder instance before passing it into this paginator, yes. But this is not something the paginator should do.
  9. Stefan Bürk commented on patch set 2 CR -1 10/23/23, 15:58

    Unresolved

    -1 because: * unreliable rowCount() on selects * missing feature rst * open questions (offset/limit) and who is in charge of it * multiple possible fetchAll() calls <-> itetartor (reexecution) question, eventually internal fetch state may make sense to have it only retrieved once * tests (functional)

    Reply

    That's the same discusion as for the other paginator. And a paginator should not deal with shifted offsets. The calculation which offset to use based on the itemsPerPage is the task of the paginator. offset/limit from base querybuilder needs to be cleaned.

    QueryBuilderPaginator.php:67

    rowCount() on select queries are not reliable. That's already documented in the documentation.
  10. Stefan Bürk commented on patch set 2 10/23/23, 16:04

  11. Stefan Bürk commented on patch set 2 CR -2 01/09/25, 08:49

    Unresolved

    Thanks @typo3@kitze.net for providing this change. After reconsidering the whole change I'm going to abandon this change and reject the related issue as "Won't do" after aligning with @benni@typo3.org on the resons. The already mentioned minor issues (see other comments) should be fixable, but doing so is more or less a waste of time because the plain QueryBuilder implementation lacks support of two major things: * Full record language overlay handling * Full workspace support (moved,deleted,added in workspace, resorted, ...) That means the plain QueryBuilder paginator could only be used in single language (default) instance without workspaces and is not reliable in instances using one or both and leading to a fallout of upcoming multipe issues targeting the missing support and asking why it does not automatically resolve these things. The implementation would only work in a small edge case and is abandonded for that reason. I don't see any easy way to implement this in a satisfing way even with a lot of time investment plus the time required to deal with the following issue reports. I'd suggest to provide this paginator implementation as a dedicated extension mentioning the restriction.
  12. Stefan Bürk abandoned the change 01/09/25, 08:50

    Abandon as "Won't do" - see comment and issue for detailed explanation
  13. Stefan Bürk commented on patch set 2 03/06/26, 16:25

    Has been solved / added as feature in another way, see 91373: [FEATURE] Provide pagination for QueryBuilder | https://review.typo3.org/c/Packages/TYPO3.CMS/+/91373