Project

General

Profile

Actions

Bug #76940

closed

In table sys_file_reference a key for the field "uid_local" should be inserted

Added by Klaus Hörmann-Engl almost 8 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2016-07-05
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
no-brainer
Is Regression:
No
Sprint Focus:

Description

We came across this query when looking at slow log output of mariadb:

SELECT * FROM sys_file_reference WHERE  deleted = N AND hidden = N AND uid_local = N ORDER BY sorting_foreign;

When using the MySQL explain feature following showed up:

MariaDB [t3database]> explain SELECT * FROM sys_file_reference WHERE  deleted = 0 AND hidden = 0 AND uid_local = 123 ORDER BY sorting_foreign;
+------+-------------+--------------------+------+---------------+------+---------+------+------+-----------------------------+
| id   | select_type | table              | type | possible_keys | key  | key_len | ref  | rows | Extra                       |
+------+-------------+--------------------+------+---------------+------+---------+------+------+-----------------------------+
|    1 | SIMPLE      | sys_file_reference | ALL  | deleted       | NULL | NULL    | NULL | 5762 | Using where; Using filesort |
+------+-------------+--------------------+------+---------------+------+---------+------+------+-----------------------------+
1 row in set (0.00 sec)

It basically says that 5762 rows need to bee looked at to find the correct one.
After adding a key to the table for the field "uid_local" the same query showed up as:

MariaDB [t3database]> explain SELECT * FROM sys_file_reference WHERE deleted = 0 AND hidden = 0 AND uid_local = 123 ORDER BY sorting_foreign;
+------+-------------+--------------------+------+-------------------+-----------+---------+-------+------+-----------------------------+
| id   | select_type | table              | type | possible_keys     | key       | key_len | ref   | rows | Extra                       |
+------+-------------+--------------------+------+-------------------+-----------+---------+-------+------+-----------------------------+
|    1 | SIMPLE      | sys_file_reference | ref  | deleted,uid_local | uid_local | 4       | const |    1 | Using where; Using filesort |
+------+-------------+--------------------+------+-------------------+-----------+---------+-------+------+-----------------------------+
1 row in set (0.00 sec)

This would result in a performance boost. What do you guys think?

Actions #1

Updated by Gerrit Code Review over 7 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/49938

Actions #2

Updated by Markus Klein over 7 years ago

  • Description updated (diff)
Actions #3

Updated by Gerrit Code Review over 7 years ago

Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/49980

Actions #4

Updated by Georg Ringer over 7 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #5

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF