Problem/Motivation
The access check looks if the node has more than one revisions, the query that it executes for that is not indexed:
mysql> select count(*) from node_revision;
+----------+
| count(*) |
+----------+
| 172996 |
+----------+mysql> SELECT sql_no_cache COUNT(*) FROM node_field_revision WHERE nid = N AND default_langcode = 1;
+----------+
| COUNT(*) |
+----------+
| 1 |
+----------+
1 row in set (0.14 sec)
mysql> explain SELECT COUNT(*) FROM node_field_revision WHERE nid = N AND default_langcode = 1;
+----+-------------+---------------------+------+-----------------------+-----------------------+---------+-------+-------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------------------+------+-----------------------+-----------------------+---------+-------+-------+-------------+
| 1 | SIMPLE | node_field_revision | ref | node_default_langcode | node_default_langcode | 4 | const | 86881 | Using where |
Proposed resolution
extend the node_default_langcode index to include NID?
mysql> SELECT sql_no_cache COUNT(*) FROM node_field_revision WHERE nid = N AND default_langcode = 1;
+----------+
| COUNT(*) |
+----------+
| 1 |
+----------+
1 row in set (0.00 sec)mysql> explain SELECT COUNT(*) FROM node_field_revision WHERE nid = N AND default_langcode = 1;
+----+-------------+---------------------+------+-----------------------+-----------------------+---------+-------------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------------------+------+-----------------------+-----------------------+---------+-------------+------+-------------+
| 1 | SIMPLE | node_field_revision | ref | node_default_langcode | node_default_langcode | 8 | const,const | 1 | Using index |
Remaining tasks
User interface changes
API changes
Beta phase evaluation
Issue category | Bug because of performance |
---|---|
Issue priority | Major because of performance |
Prioritized changes | The main goal of this issue is performance |