@@ -826,12 +826,17 @@ Defaults to all tables registered to the $wpdb database handler.
826826Displays the database name and size.
827827
828828~~~
829- wp db size [--size_format=<format>] [--tables] [--human-readable] [--format=<format>] [--scope=<scope>] [--network] [--decimals=<decimals>] [--all-tables-with-prefix] [--all-tables] [--order=<order>] [--orderby=<orderby>]
829+ wp db size [--size_format=<format>] [--tables] [--human-readable] [--fields=<fields>] [-- format=<format>] [--scope=<scope>] [--network] [--decimals=<decimals>] [--all-tables-with-prefix] [--all-tables] [--order=<order>] [--orderby=<orderby>]
830830~~~
831831
832832Display the database name and size for ` DB_NAME ` specified in wp-config.php.
833833The size defaults to a human-readable number.
834834
835+ The reported size is the sum of the data and the index size. Both can be
836+ displayed separately by adding them to ` --fields ` . For SQLite, the database
837+ size is the size of the database file, which also includes overhead such as
838+ free pages.
839+
835840Available size formats include:
836841* b (bytes)
837842* kb (kilobytes)
@@ -876,6 +881,9 @@ Available size formats include:
876881 [--human-readable]
877882 Display database sizes in human readable formats.
878883
884+ [--fields=<fields>]
885+ Get a specific subset of the fields.
886+
879887 [--format=<format>]
880888 Render output in a particular format.
881889 ---
@@ -893,7 +901,7 @@ Available size formats include:
893901 List all the tables in a multisite install.
894902
895903 [--decimals=<decimals>]
896- Number of digits after decimal point. Defaults to 0.
904+ Number of digits after decimal point. Defaults to 0, or 2 when using --human-readable .
897905
898906 [--all-tables-with-prefix]
899907 List all tables that match the table prefix even if not registered on $wpdb. Overrides --network.
@@ -919,6 +927,18 @@ Available size formats include:
919927 - size
920928 ---
921929
930+ ** AVAILABLE FIELDS**
931+
932+ These fields will be displayed by default:
933+
934+ * Name
935+ * Size
936+
937+ These fields are optionally available:
938+
939+ * Data
940+ * Index
941+
922942** EXAMPLES**
923943
924944 $ wp db size
@@ -946,6 +966,13 @@ Available size formats include:
946966 | wp_commentmeta | 48 KB |
947967 +-----------------------+-------+
948968
969+ $ wp db size --fields=Name,Data,Index,Size --human-readable
970+ +-------------------+---------+--------+---------+
971+ | Name | Data | Index | Size |
972+ +-------------------+---------+--------+---------+
973+ | wordpress_default | 3.43 GB | 2.8 GB | 6.23 GB |
974+ +-------------------+---------+--------+---------+
975+
949976 $ wp db size --size_format=b
950977 5865472
951978
0 commit comments