Issue Task Closed

#90419Improve performance of DatabaseRecordList->generateList()

Robert Heinig 02/18/20, 15:24 updated 02/27/20, 12:43

Description

When checking if there are any rows to render, a DB query fetches the uids of all records instead of only one. This leads to perceptible bad performance of the backend list view with >100k rows.

File in current master:
https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php

Current:

$firstRow = $queryBuilder->select('uid')
                    ->from($tableName)
                    ->execute()
                    ->fetch();

Could be:

$firstRow = $queryBuilder->select('uid')
                    ->from($tableName)
                    ->setMaxResults(1)
                    ->execute()
                    ->fetch();

This behavior exists at least since TYPO3 8.
Backports to version 9 and 8 are similarly easy changes, but e.g. the code for TYPO3 8 recides in AbstractDatabaseRecordList.

Reviews 2