Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 CLI Reference | 2025.1

# p4 dbstat

Display size or simple statistics for one or more database tables.

## Syntax

    p4 [g-opts] dbstat [-h][-f] | [-p [-w worklevel] [-n numberOfFiles]] {-a | dbtable ...}
    p4 [g-opts] dbstat -s

Syntax conventions

## Description

The `p4 dbstat` command displays statistics on the internal state of the database on the P4 Server. The `dbtable` corresponds to the `db.*` files in your server’s root directory. This command can help to estimate disk seeks due to sequential database scans.

### To tune future checkpoint requests

If your P4 Server contains a few tables that are significantly larger than its average-sized table, you might be able to reduce the amount of time needed to complete checkpoints.

1. Use the `-p`, `-w`, and `-n` options to determine how a multifile parallel checkpoint splits the database tables. For example, to get a report about the computed number of files, the page gap, and the keys generated for the db.nameval table, you might try:
   `p4 dbstat -p -w 2 -n 3 db.nameval`

   The output is a quick heuristic overview of the depth and page count of the B-tree associated with the specified database table.

2. Use that information to tune future checkpoints by setting values for the following configurables: db.checkpoint.reqlevel, db.checkpoint.worklevel, db.checkpoint.numfiles, and db.checkpoint.threads. See both

   - Parallel checkpointing, dumping and recovery and

   - P4 Server Administration Documentation

   in the P4 Server Administration Documentation.

## Options

`-h` | Display a histogram showing distances between leaf pages. This enables you to anticipate disk seeks required for sequential database scans. This scans only the internal node pages of the file, not the leaf or overflow pages, and thus reads only 1-5% of the file. This option blocks write access to the database while it scans the tables. It is best to get guidance from Perforce Support before using this option.
`-f` | Displays a page count, free pages, and percent free data for the specified tables. Using the `-f` with the `-h` option, this command shows a histogram of free page distribution.
`-p` | Requests level and page count information for a database table. Included in the output are details of how the file would be split for a multifile checkpoint request. The output includes the page gap, which is the number of pages between each key selected to be used in the multi-file split. This option blocks write access to the database while it scans the tables. It is best to get guidance from Perforce Support before using this option.
`-a` | Display statistics for all tables.
`-s` | Report file sizes of database tables.
`-w worklevel` | The worklevel determines which level of the table should be used to split the table. This option overrides the db.checkpoint.worklevel configurable so you can specify the `worklevel` at the command line.
`-n numberOfFiles` | This option determines, along with the depth of the database table, the number of checkpoint files that would be generated. A large table might contain multiple pages. The `-n numberOfFiles` requested makes it possible divide the page count to split each chunk of work into similar sizes. This option overrides the db.checkpoint.numfiles configurable so you can specify `numberOfFiles` at the command line.
`dbtable` | Display statistics for the specified table (for instance, `db.have`, `db.user`, and so on.) As you are most likely to need data for a particular table when working with support, they will let you know the name of the table for which you need information.
`g-opts` | See Global options.

## Usage notes

Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required
--- | --- | ---
N/A | N/A | `super` available to an operator user

Your search for returned results