Issue Bug Closed

#81778Performance blocker calling @->getSchemaManager()->listTableColumns($tableName)@

Stephan Großberndt 07/04/17, 09:30 updated 10/02/18, 10:58

Description

I found a massive performance blocker in extbase due to the migration to doctrine: \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend->clearPageCache() (which will be called for each inserted/updated/deleted Domain/Model object) does this to determine if the table has a pid column:

        $columns = GeneralUtility::makeInstance(ConnectionPool::class)
            ->getConnectionForTable($tableName)
            ->getSchemaManager()
            ->listTableColumns($tableName);
        if (array_key_exists('pid', $columns)) {

Calling ->getSchemaManager()->listTableColumns($tableName) is very costly, not only the column names but the whole information about the table including types and the like is fetched.

There are several places in the core where this is used to only iterate the available columns.

I propose to add at least a runtime cache so this information is not fetched during runtime for the same table over and over again.

Reviews 2