Project

General

Profile

Actions

Task #96363

closed

Performance optimization for LiveSearch

Added by Stefan Froemken over 2 years ago. Updated 10 months ago.

Status:
Closed
Priority:
Should have
Category:
Performance
Target version:
Start date:
2021-12-15
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
7.4
Tags:
Complexity:
Sprint Focus:

Description

Hello,

TYPO3 LiveSearch uses this query by default for string searches:

WHERE LOWER(column) LIKE "lower-cased-value" 

In case of collations like utf8_general_ci (ci stands for case-insensitive) there is no need to lowercase ALL column values. Of cause a case-sensitive search makes sense for collations like utf8_general_cs, uft8_unicode_bin and where TCA ['config']['search']['case'] is true.

You can test performance yourself on MySQL with case-insensitive column collations:

SET profiling = 1;

SELECT SQL_NO_CACHE uid, pid, header
FROM tt_content
WHERE bodytext LIKE "%HeLlO%";
SHOW profile;

SELECT SQL_NO_CACHE uid, pid, header
FROM tt_content
WHERE LOWER(bodytext) LIKE "%hello%";
SHOW profile;

Last query is always slower than the first query.

I will provide a patch.

PS: IMO ['search']['case']-option has never been working.

Stefan

Actions #1

Updated by Gerrit Code Review over 2 years ago

  • Status changed from New to Under Review

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

Actions #2

Updated by Gerrit Code Review over 2 years ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72668

Actions #3

Updated by Gerrit Code Review about 1 year ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72668

Actions #4

Updated by Gerrit Code Review 10 months ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72668

Actions #5

Updated by Stefan Froemken 10 months ago

  • Status changed from Under Review to Closed

The benefit is 0.003 seconds on a table with 60.000 records. That's not a real performance improvement.

Actions

Also available in: Atom PDF