brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: wp db size --tables shows which tables take the space in a wordpress database

WordPress
~/tips/tip-wordpress-db-size-tables-breakdown

wp db size --tables --orderby=size --order=desc

Lists the size of every table in the WordPress database to find what makes it grow.

A database that keeps growing needs a look at the tables before any clean-up.

wp db size --tables --orderby=size --order=desc

This prints every table of the WordPress database with its size, the biggest first. --orderby and --order need WP-CLI 2.7 or newer. Add --human-readable for KB and MB, or --format=csv or --format=json for scripts. The usual suspects are wp_options with large autoloaded values, wp_postmeta, a log table of a plugin and old revisions in wp_posts. By default only tables WordPress knows about are listed, so add --all-tables-with-prefix for the rest, and remember that your table prefix may differ from wp_.

Further reading: WP-CLI: wp db size

More WordPress tips wp user application-password create anna backup-script --porcelain define( 'MEDIA_TRASH', true ); wp cli check-update wp theme delete --all wp media image-size All WordPress tips (85) All topics

Link