Skip to content

Instantly share code, notes, and snippets.

@yanknudtskov
Created October 18, 2017 12:33
Show Gist options
  • Save yanknudtskov/a77351ff23077b9d6e9cda3c010e5cbd to your computer and use it in GitHub Desktop.
Save yanknudtskov/a77351ff23077b9d6e9cda3c010e5cbd to your computer and use it in GitHub Desktop.
This will show you the autoloaded data size, how many entries are in the table, and the first 10 entries by size. #optimization #database #mysql
SELECT 'autoloaded data in KiB' as name, ROUND(SUM(LENGTH(option_value))/ 1024) as value FROM wp_options WHERE autoload='yes'
UNION
SELECT 'autoloaded data count', count(*) FROM wp_options WHERE autoload='yes'
UNION
(SELECT option_name, length(option_value) FROM wp_options WHERE autoload='yes' ORDER BY length(option_value) DESC LIMIT 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment