N1ck
N1ck

Reputation: 321

TYPO3 TCA Type IRRE very slow with tt_contents

Has anybody an idea from where the following query comes? When I use the type inline in TCA to relate tt_content records, then I get huge performance problems with this relation because of the huge amount of tt_content records in one folder. (ID:45)

SELECT tt_content.uid
     , tt_content.header
     , tt_content.subheader
     , tt_content.bodytext
     , tt_content.t3ver_id
     , tt_content.t3ver_state
     , tt_content.t3ver_wsid
     , tt_content.t3ver_count
     , tt_content.CType
     , tt_content.hidden
     , tt_content.starttime
     , tt_content.endtime
     , tt_content.fe_group
FROM tt_content, pages
WHERE pages.uid=tt_content.pid
    AND pages.deleted = 0
    AND tt_content.deleted = 0
    AND 1=1
    AND tt_content.pid = 45
    AND tt_content.sys_language_uid IN (-1,0)

I use this configuration:

'content_elements' => [
            'displayCond' => [
                'OR' => [
                    'FIELD:tasktype:=:1',
                    'FIELD:tasktype:=:5'
                ]
            ],
            'exclude' => true,
            'l10n_mode' => 'mergeIfNotBlank',
            'label' => 'content',
            'config' => [
                'type' => 'inline',
                'allowed' => 'tt_content',
                'foreign_table' => 'tt_content',
                'foreign_sortby' => 'sorting',
                'foreign_field' => 'tx_contentmanager_related_content',
                'minitems' => 0,
                'maxitems' => 99,
                'appearance' => [
                    'collapseAll' => true,
                    'expandSingle' => true,
                    'levelLinksPosition' => 'bottom',
                    'useSortable' => true,
                    'showPossibleLocalizationRecords' => true,
                    'showRemovedLocalizationRecords' => true,
                    'showAllLocalizationLink' => true,
                    'showSynchronizationLink' => true,
                    'enabledControls' => [
                        'info' => false,
                    ]
                ]
            ]
        ],

Upvotes: 0

Views: 668

Answers (1)

N1ck
N1ck

Reputation: 321

I debugged the Core-File: /sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php

The problem seems to be in the translation handling of tt_content records.

$GLOBALS['TCA']['tt_content']['columns']['l18n_parent']['config']['foreign_table_where'] = AND tt_content.pid=###CURRENT_PID### AND tt_content.sys_language_uid IN (-1,0)

But i don't know why all content from the current pid has to be fetched. As a temporary solution i changed the TCA-entry, because we don't use tt_content on pages and had no translations yet. I'm not sure if this is a good idea, but at this moment it solves our performance-problem for the editors.

$GLOBALS['TCA']['tt_content']['columns']['l18n_parent']['config']['foreign_table_where'] = 'AND tt_content.pid = -1 AND tt_content.sys_language_uid IN (-1,0)';

Upvotes: 1

Related Questions