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

Issue with Statuses query #1314

Open
stevejburge opened this issue Dec 18, 2024 · 0 comments
Open

Issue with Statuses query #1314

stevejburge opened this issue Dec 18, 2024 · 0 comments

Comments

@stevejburge
Copy link
Member

From the WordPress VIP team:

The plugin performs a query on every request that is expensive when under load:

SELECT ID FROM $wpdb->posts WHERE post_status IN ('pitch', 'a
ssigned', 'in-progress', 'approved', 'member', 'staff', 'prem
ium') LIMIT 1

The plugin also updates the option presspermit_legacy_status_control on every page
load if certain conditions are met. Neither this query nor this option update will
scale for moderate to large sites, handling similar sized loads.

The plugin could be refactored to ensure that the option is only updated when it is
first set or when a specific condition changes. One approach is to move these
expensive operations out of the plugins_loaded callback logic and instead put them
somewhere where they will only run once, like when the plugin is activated.
Making sure that the query and option update only run once, rather than on every
page load, will help ensure that sites with lots of data and moderate to heavy
traffic can still leverage the Pro modules like Status Control without experiencing
performance degradation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant