Description
What happened?
Description
I have a project with around 2000 entries, and a "content blocks" matrix field on the entry. The entries use all the blocks to a certain extent, including the ones with entry fields in them. A new entry edit page takes about 200ms to load, there's about 150 database queries and 2000 events according to the Yii debug toolbar.
When I add a matrix block with an entry field, however, the loading time increases to about 6000ms, there's now 4000 database queries and 60000 events. This does not happen when I add a matrix block without an entry field, it also doesn't happen if I introduce a completely new block to the matrix field with only an entry field and add that to the entry. Therefore I am assuming it is related to the fact that many entries are using the matrix blocks with entry fields and that reduces the time they take to render somehow.
Steps to reproduce
- Make a section.
- Add a matrix field with a block that has an entry field on it
- Make 2000 entries and add matrix blocks with entry fields and add entries to them
- Make a new entry (observe fast load speeds)
- Add matrix block with entry field (observe slow load speeds)
Expected behavior
I am not sure why the amount of entries should matter when rendering the edit-page of an entry in the CP. The expected behaviour would be the same amount of load and similar amounts of db-queries/events happening even if I have a matrix block with an entry added to an entry.
Actual behavior
When I add an entry to a matrix block with an entry field my CP editing experience slows down by about 6 seconds every time I open a new entry or save an existing one.
Craft CMS version
4.5.9
PHP version
8.0.30
Operating system and version
Linux 5.15.68-0-virt
Database type and version
MariaDB 10.4.31
Image driver and version
Imagick 3.7.0 (ImageMagick 6.9.11-60)
Installed plugins and versions
None (I disabled them all to test this out)