Skip to content

Replace use of SHOW TABLES with DESCRIBE. #834

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

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

boonebgorges
Copy link

I recently updated from 6.x to 7.0.1 on a very large WP Multisite installation. MySQL ground to a halt shortly afterward, and after investigation we determined that the enormous number of SHOW TABLES queries coming from litespeed-cache were the culprit.

SHOW TABLES requires touching INFORMATION_SCHEMA, which on very large databases means temp sort and other operations that require enormous resources. See https://bugs.mysql.com/bug.php?id=60961, https://www.percona.com/blog/solving-information_schema-slowness/, https://forums.mysql.com/read.php?24,706979,706979

Every instance of SHOW TABLES in this plugin uses a hardcoded value (no wildcards) and is only check for existence. As such, we can use DESCRIBE (or alternatively SHOW CREATE TABLE), which only loads information about the queried table and doesn't require loading all table info into memory.

I'm running this patch on my client site and the performance problems have gone away.

Thanks in advance for considering.

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

Successfully merging this pull request may close these issues.

2 participants