Skip to content

Instantly share code, notes, and snippets.

@seanconklin
Created July 17, 2020 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanconklin/666661cac1fef0e2c793c9739f37f7aa to your computer and use it in GitHub Desktop.
Save seanconklin/666661cac1fef0e2c793c9739f37f7aa to your computer and use it in GitHub Desktop.
SELECT
'Autoload KB' as name, ROUND( SUM( LENGTH( option_value ) ) / 1024 ) as size, null as autoload
FROM wp_options
WHERE autoload = 'yes'
UNION
SELECT 'Autoload count', count( * ), null as autoload
FROM wp_options
WHERE autoload = 'yes'
UNION (
SELECT option_name, length( option_value ), autoload
FROM wp_options
WHERE autoload = 'yes'
ORDER BY length( option_value ) DESC
LIMIT 20
)
UNION (
SELECT option_name, length( option_value ), autoload
FROM wp_options
WHERE autoload = 'no'
ORDER BY length( option_value ) DESC
LIMIT 20
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment