Homepage: slow query and caching

Created on 13 January 2023, almost 2 years ago
Updated 27 October 2023, about 1 year ago

The homepage is built in L10nCommunityWelcomePageController::build(), which at some point calls L10nStatistics::getProjectsStringCount(), where the following SQL query is run in about 9 seconds on my PC (knowing that only a subset of l.d.o data is loaded as far as I know):

SELECT COUNT(DISTINCT sid) AS string_count, pid FROM l10n_server_line GROUP BY pid;

This page suggests that it could be rewritten this way in order to force InnoDB to plan the query differently (i hope it yields the same result):

SELECT COUNT(i.sid) AS string_count, i.pid FROM (SELECT DISTINCT sid, pid FROM l10n_server_line) i GROUP BY pid;

This one "only" takes about 3 seconds to complete.

Another way would be to select a different engine for this table (MyISAM), but I have little idea of the implications and absolutely no experience. What do you think?

Anyway, we will also have to choose a caching strategy in the controller (see line 236): max age ?

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇫🇷France fmb Perpinyà, Catalonia, EU

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024