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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

johnle created an issue. See original summary.

johnle’s picture

Issue summary: View changes
kunalkursija’s picture

Status: Active » Needs review
FileSize
897 bytes

Adding Patch.

kunalkursija’s picture

FileSize
897 bytes

Ignore #3, I Added the incorrect patch. Adding the new one now.

johnle’s picture

Status: Needs review » Reviewed & tested by the community

Tested this and is working now.

slucero’s picture

Looks good to me! We'll get this merged in for the Beta 7 release.

  • kunalkursija authored 495dbd22 on 9.1.x
    Issue #3346548 by kunalkursija, johnle: Long page load time due to large...
slucero’s picture

Status: Reviewed & tested by the community » Fixed

Merged for inclusion in the Beta 7 release via #3327256: Beta 7 Release Plan.

Thanks for the work here!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.