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

Improve performance of is_installed check #374

Merged
merged 2 commits into from
Feb 7, 2024

Conversation

noahtallen
Copy link
Contributor

@noahtallen noahtallen commented Feb 6, 2024

We noticed this query performing poorly in some cases, especially when the DB is under load. See this post for more context: p4IuY0-4S6-p2#comment-16728. This PR includes two improvements:

  1. Use an information_schema query for table existence check, rather than SHOW TABLES LIKE .... Running this query by itself on the mysql replica takes under 10ms, whereas the show tables query is more like 700+ms. (Not the best benchmark, but does verify that it should be better.
  2. Just in case, also cache false is_installed values. While it shouldn't happen that frequently since Cron Control is active by default, this query otherwise executes a few times every page load, so it should be a nice little improvement.

is_installed should execute (at least) on admin pageviews, so you can verify the main changes there.

@noahtallen noahtallen requested a review from WPprodigy February 6, 2024 00:42
@noahtallen noahtallen self-assigned this Feb 6, 2024
includes/class-events-store.php Outdated Show resolved Hide resolved
includes/class-events-store.php Show resolved Hide resolved
Co-authored-by: Caleb Burks <[email protected]>
@noahtallen noahtallen merged commit 0a9d13d into main Feb 7, 2024
2 of 10 checks passed
@noahtallen noahtallen deleted the improve-cron-control-is-installed-performance branch February 7, 2024 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants