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
Comments
Comment #2
johnle commentedComment #3
kunalkursija commentedAdding Patch.
Comment #4
kunalkursija commentedIgnore #3, I Added the incorrect patch. Adding the new one now.
Comment #5
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!