wp-cli / wp-cli/db-command

Size: separate data_length and index_length

Open
#348 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

command:db-size scope:documentation
Dominant language
PHP
Stars
76
Forks
73
Avg merge
9h 31m
Merged PRs (30d)
2

Description

Feature Request

Especially on larger sites, and with DB optimization (i.e. additional indexes), indexes can be quite big already on its own. Calculating data and index sizes together skew things slightly.

Here's an example of one site

Data total: ~3.43 GB
Index total: ~2.80 GB
Grand total: ~6.23 GB

Describe the solution you'd like

At least when using an output format that doesn't just give the size as a number, data and index should be displayed separately. At least it should be clearly documented that index sizes are counted to tally.

For example with --human-readable instead of

+------+------+
| Name | Size |
+------+------+
| wdb  | 7 GB |
+------+------+

return could be

| Name | Data    | Index   | Total   |
|------|---------|---------|---------|
| wdb  | 3.43 GB | 2.80 GB | 6.23 GB |

There's currently also slight rounding issue where 6.23 GB becomes 7 GB.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the database size reporting path used by the --human-readable output and inspect how data and index sizes are currently combined and rounded. Done means the output separates Data, Index, and Total while preserving the combined total and avoiding the demonstrated rounding discrepancy.

Written by the indexing model from the issue text.

Assessment

Tech stack
mariadb, mysql, php
Domain
cli, database
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.