Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Having a large amount of patterns, in our case 300k of patterns causes page load to hinder or even crash due to the SQL query timing out. This only happens after a cache rebuild.
Steps to reproduce
- Clear cache via drush
- Load any page
- Note that the page takes a very long time to load or will timeout.
Proposed resolution
This logic needs to be rework where it does not load every single patterns
https://git.drupalcode.org/project/patternkit/-/blob/9.1.x/src/Plugin/De...
The query it runs is :
SELECT "base_table"."revision_id" AS "revision_id", "base_table"."id" AS "id"
FROM
"patternkit" "base_table"
INNER JOIN "patternkit_field_data" "patternkit_field_data" ON "patternkit_field_data"."id" = "base_table"."id"
WHERE ("patternkit_field_data"."reusable" IN ('1')) AND ("patternkit_field_data"."default_langcode" IN ('1'))
We have only 5 reusable patterns out of 300k+ and this took a very long time to load.
Remaining tasks
Patch derivative logic
User interface changes
None
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#4 | pattern_load_time-3346548-4.patch | 897 bytes | kunalkursija |
Comments
Comment #2
johnle CreditAttribution: johnle commentedComment #3
kunalkursija CreditAttribution: kunalkursija at Axelerant commentedAdding Patch.
Comment #4
kunalkursija CreditAttribution: kunalkursija at Axelerant commentedIgnore #3, I Added the incorrect patch. Adding the new one now.
Comment #5
johnle CreditAttribution: johnle commentedTested this and is working now.
Comment #6
sluceroLooks good to me! We'll get this merged in for the Beta 7 release.
Comment #8
sluceroMerged for inclusion in the Beta 7 release via #3327256: Beta 7 Release Plan.
Thanks for the work here!