Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load templates in a single database query. #45309

Open
spacedmonkey opened this issue Oct 26, 2022 · 1 comment
Open

Load templates in a single database query. #45309

spacedmonkey opened this issue Oct 26, 2022 · 1 comment
Assignees
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Performance Related to performance efforts

Comments

@spacedmonkey
Copy link
Member

What problem does this address?

Looking looking at stack trace of where database queries comes from, it can be seen that many database locate_block_template (get_block_templates) and render_block_core_template_part.

Instead of relying on these functions to do a WP_Query ( and _prime_post_caches ) to a get a single post object of type wp_template or wp_template_part, do a single database call, to prime all caches in single database call.

Screenshot 2022-10-26 at 11 22 41

Screenshot 2022-10-26 at 11 22 17

What is your proposed solution?

In the post-template block, simple to #40572, loop through nested block, to find all template and template part blocks, get an array and do a single database query to get all template / template parts in a single request.

@spacedmonkey spacedmonkey self-assigned this Oct 26, 2022
@spacedmonkey
Copy link
Member Author

I have done discovery on this ticket. See of POC PRs.

WordPress/wordpress-develop#3836
WordPress/wordpress-develop#3835

@annezazu annezazu added [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") and removed [Feature] Full Site Editing labels Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Performance Related to performance efforts
Projects
None yet
Development

No branches or pull requests

2 participants