Performance on 404 redirect admin page

Created on 23 December 2015, almost 9 years ago
Updated 4 February 2020, over 4 years ago

On the 404 redirect admin page, I encountered an timeout issue.
Query seems not to be optimized due to missing "redirect" index on "source" column.

Here is the explain query without index on "source" :

MariaDB [drupal_database]> explain SELECT COUNT(DISTINCT(w.message)) AS expression FROM watchdog w LEFT OUTER JOIN redirect r ON w.message = r.source WHERE  (w.type = 'page not found') AND (r.rid IS NULL );
+------+-------------+-------+-------+---------------+------------------------+---------+-------+-------+--------------------------------------------------------------------------+
| id   | select_type | table | type  | possible_keys | key                    | key_len | ref   | rows  | Extra                                                                    |
+------+-------------+-------+-------+---------------+------------------------+---------+-------+-------+--------------------------------------------------------------------------+
|    1 | SIMPLE      | w     | ref   | type          | type                   | 194     | const | 46900 | Using index condition                                                    |
|    1 | SIMPLE      | r     | index | NULL          | status_source_language | 807     | NULL  | 62550 | Using where; Using index; Not exists; Using join buffer (flat, BNL join) |
+------+-------------+-------+-------+---------------+------------------------+---------+-------+-------+--------------------------------------------------------------------------+

And now with an simple index on source column :

MariaDB [drupal_database]> explain SELECT COUNT(DISTINCT(w.message)) AS expression FROM watchdog w LEFT OUTER JOIN redirect r ON w.message = r.source WHERE  (w.type = 'page not found') AND (r.rid IS NULL );
+------+-------------+-------+------+---------------+--------+---------+------------------------------------+-------+--------------------------------------+
| id   | select_type | table | type | possible_keys | key    | key_len | ref                                | rows  | Extra                                |
+------+-------------+-------+------+---------------+--------+---------+------------------------------------+-------+--------------------------------------+
|    1 | SIMPLE      | w     | ref  | type          | type   | 194     | const                              | 46900 | Using index condition                |
|    1 | SIMPLE      | r     | ref  | source        | source | 767     | monnaiedeparis_platform2.w.message |     1 | Using where; Using index; Not exists |
+------+-------------+-------+------+---------------+--------+---------+------------------------------------+-------+--------------------------------------+
🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇫🇷France Sebastien M.

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