cockroach debug pebble db analyze-data samples data blocks from Pebble files in a store directory and runs compression experiments. The command writes results to a CSV file for analysis.
This command reads data files from disk and can generate noticeable disk I/O and CPU load. When running it on a node that is serving production traffic, we recommend throttling read bandwidth using
--read-mb-per-sec.Subcommands
While thecockroach debug command has a few subcommands, users are expected to use only the , , , , , and subcommands.
We recommend using the and subcommands only when directed by the .
The other debug subcommands are useful only to Cockroach Labs. Output of debug commands may contain sensitive or secret information.
Synopsis
Flags
Thedebug pebble db analyze-data subcommand supports the following flags.
| Flag | Description |
|---|---|
--comparer | Comparer name (use default if empty). |
--merger | Merger name (use default if empty). |
--output | Path for the output CSV file. |
--read-mb-per-sec | Limits read I/O bandwidth to avoid disrupting running workloads (0 = no limit). Recommended range is between 1 (1 MiB) and 10 (10 MiB).Default: 0 |
--sample-percent | Percentage of data to sample before stopping. Default: 100 |
--timeout | Stop after this much time has passed (0 = no timeout).Default: 0 |
Details
Use cases
Use this command to collect real-world compression statistics for a ’s data, such as:- Estimated compression ratios across supported algorithms and levels.
- Estimated compression and decompression CPU costs.
Where to run
- On a node’s : You can run this command alongside a live CockroachDB node’s process. The command does not communicate with the process, but it can compete for disk bandwidth and CPU.
- On a representative subset of nodes: For large clusters, you typically do not need to run this command on every node. You can also run it on one node for a period of time, and then on another node.
- On a backup directory: You can run this command against a backup directory (specified ). This can be much less disruptive than running it on nodes with an active workload.
Output behavior
The output CSV file is periodically rewritten while the command is running. Even if the command is interrupted, you can still use the most recently written output.Review results with Cockroach Labs
The command groups sampled blocks into buckets (by block type, block size, data compressibility) and reports compression results for each bucket.CRis the compression ratio. Higher values mean that compressed data uses less storage.Compis compression throughput. Lower throughput means higher CPU cost when Pebble writes or rewrites SSTs.Decompis decompression throughput. Lower throughput means higher CPU cost when CockroachDB reads compressed data.Snappy,MinLZ1,Zstd1,Auto1/30,Auto1/15, andZstd3are compression experiments. These names are not a one-to-one list of valid values for . Use them to compare the general speed and space tradeoffs of lower-effort, adaptive, and higher-effort compression.

