Project

General

Profile

Actions

Bug #80898

closed

No page tree in a workspaces

Added by Xavier Perseguers about 7 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Category:
Workspaces
Target version:
Start date:
2017-04-19
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I just debugged a problem that the page tree was not shown when in a workspaces. The AJAX request actually timed out.

I finally nailed it down to method \TYPO3\CMS\Workspaces\Service\WorkspaceService::fetchPagesWithVersionsInTable and its query for tableName sys_file_reference.

This is the culprit query:

SELECT `B`.`pid` AS `pageId` FROM `sys_file_reference` `A`, `sys_file_reference` `B` WHERE (`A`.`pid` = -1) AND (`A`.`t3ver_wsid` = 1) AND (((`A`.`t3ver_oid` = `B`.`uid`) AND (`A`.`t3ver_state` <> 4)) OR ((`A`.`t3ver_oid` = `B`.`t3ver_move_id`) AND (`A`.`t3ver_state` = 4))) AND ((`A`.`deleted` = 0) AND (`B`.`deleted` = 0)) GROUP BY `pageId`

It takes 131 seconds to execute on my table having 53k rows and returns 0 rows.

Query rewritten:

SELECT
    B.pid AS pageId
FROM
    sys_file_reference A,
    sys_file_reference B
WHERE
    A.pid = -1 AND A.t3ver_wsid = 1 AND (
        (A.t3ver_oid = B.uid AND A.t3ver_state <> 4)
        OR
        (A.t3ver_oid = B.t3ver_move_id AND A.t3ver_state = 4)
    ) AND A.deleted = 0 AND B.deleted = 0
GROUP BY pageId

The "GROUP BY" is the part killing everything. From what I understand, it looks like it is used to remove duplicates in the result set. If that's really the case, then using a "DISTINCT" instead of a "GROUP BY" effectively drops the execution time from 131 sec. to around 230 ms.


Files

original_query.png (59.8 KB) original_query.png original query Jens Jacobsen, 2017-04-20 11:10
modified_query.png (58.1 KB) modified_query.png modified query Jens Jacobsen, 2017-04-20 11:10

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Task #76626: Doctrine: migrate ext:workspaceClosedEugene Kenah Djomo2016-06-14

Actions
Related to TYPO3 Core - Bug #86945: Performance PageTree in WorkspaceClosedAlexander Opitz2018-11-16

Actions
Actions

Also available in: Atom PDF