Actions
Bug #80898
closedNo page tree in a workspaces
Status:
Closed
Priority:
Must have
Assignee:
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
Actions